You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.3 KiB
87 lines
2.3 KiB
// <file> |
|
// <copyright see="prj:///doc/copyright.txt"/> |
|
// <license see="prj:///doc/license.txt"/> |
|
// <owner name="Russell Wilkins" email=""/> |
|
// <version>$Revision$</version> |
|
// </file> |
|
|
|
using System; |
|
using System.Diagnostics; |
|
using System.IO; |
|
using System.Text; |
|
using ICSharpCode.Core; |
|
using ICSharpCode.SharpDevelop; |
|
using ICSharpCode.SharpDevelop.Gui; |
|
using ICSharpCode.SharpDevelop.Project; |
|
|
|
namespace WorkflowDesigner |
|
{ |
|
/// <summary> |
|
/// Description of PrimaryViewContent. |
|
/// </summary> |
|
public class WorkflowPrimaryViewContent : AbstractViewContent, IHasPropertyContainer |
|
{ |
|
ViewContentControl control; |
|
|
|
public WorkflowPrimaryViewContent(OpenedFile primaryFile) : base(primaryFile) |
|
{ |
|
this.TabPageText = "Workflow"; |
|
control = new ViewContentControl(this); |
|
|
|
primaryFile.ForceInitializeView(this); // call Load() |
|
|
|
} |
|
|
|
public override System.Windows.Forms.Control Control { |
|
get { |
|
return control; |
|
} |
|
} |
|
|
|
public override void Load(OpenedFile file, Stream stream) |
|
{ |
|
Debug.Assert(file == this.PrimaryFile); |
|
|
|
XomlDesignerLoader loader = null; |
|
|
|
// First look for a code separation file. |
|
IProject project = ProjectService.OpenSolution.FindProjectContainingFile(file.FileName); |
|
if (project != null) { |
|
FileProjectItem fpi = project.FindFile(file.FileName); |
|
string codeFileName = file.FileName + "." + project.LanguageProperties.CodeDomProvider.FileExtension; |
|
FileProjectItem dfpi = project.FindFile(codeFileName); |
|
if (dfpi.DependentUpon == Path.GetFileName(fpi.VirtualName)) { |
|
loader = new XomlCodeSeparationDesignerLoader(this, file.FileName, stream, dfpi.FileName); |
|
} |
|
} |
|
|
|
// No separation file so the nocode loader will be used. |
|
if (loader == null) |
|
loader = new XomlDesignerLoader(this, file.FileName, stream); |
|
|
|
control.LoadWorkflow(loader); |
|
} |
|
|
|
public override void Save(OpenedFile file, Stream stream) |
|
{ |
|
Debug.Assert(file == this.PrimaryFile); |
|
|
|
control.SaveWorkflow(stream); |
|
} |
|
|
|
public void LoadContent(string content) |
|
{ |
|
XomlDesignerLoader xomlDesignerLoader = new XomlDesignerLoader(this); |
|
xomlDesignerLoader.Xoml = content; |
|
control.LoadWorkflow(xomlDesignerLoader); |
|
} |
|
|
|
#region IHasPropertyContainer |
|
public PropertyContainer PropertyContainer { |
|
get { |
|
return control.PropertyContainer; |
|
} |
|
} |
|
#endregion |
|
} |
|
}
|
|
|