1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
4
using ICSharpCode.Core;
8
using ICSharpCode.SharpDevelop;
9
using ICSharpCode.SharpDevelop.Editor;
10
using ICSharpCode.SharpDevelop.Gui;
12
namespace ICSharpCode.WorkflowDesigner
15
/// Display binding that attaches the workflow designer to .xaml files.
17
public class WorkflowDisplayBinding : ISecondaryDisplayBinding
19
public bool CanAttachTo(IViewContent content)
21
ITextEditorProvider p = content as ITextEditorProvider;
24
using (XmlTextReader r = new XmlTextReader(p.TextEditor.Document.CreateReader())) {
26
// find the opening of the root element:
27
while (r.Read() && r.NodeType != XmlNodeType.Element);
28
// attach if this is a workflow node
29
return r.NamespaceURI == "http://schemas.microsoft.com/netfx/2009/xaml/activities";
31
} catch (XmlException e) {
32
LoggingService.Debug("WorkflowDisplayBinding got exception: " + e.Message);
41
/// When you return true for this property, the CreateSecondaryViewContent method
42
/// is called again after the LoadSolutionProjects thread has finished.
44
public bool ReattachWhenParserServiceIsReady {
48
public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
50
return new IViewContent[] { new WorkflowDesignerViewContent(viewContent.PrimaryFile) };