Browse Source

Various fixes to designer services and FxCop Updates

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2378 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Russell Wilkins 19 years ago
parent
commit
c66404d480
  1. 3
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Gui/ViewContentControl.cs
  2. 26
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/NRefactoryDesignerLoader.cs
  3. 2
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/XomlCodeSeparationDesignerLoader.cs
  4. 35
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/XomlDesignerLoader.cs
  5. 6
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/PrimaryView/PrimaryViewContent.cs
  6. 3
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/SecondaryView/SecondaryDisplayBinding.cs
  7. 4
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/WorkflowDesignerEventBindingService.cs
  8. 33
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/IdentifierCreationService.cs
  9. 28
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/MemberCreationService.cs
  10. 75
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/PropertyValueUIService.cs
  11. 2
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/TypeProviderService.cs
  12. 28
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowMenuCommandService.cs
  13. 1
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/WorkflowDesigner.csproj

3
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Gui/ViewContentControl.cs

@ -145,7 +145,7 @@ namespace WorkflowDesigner
// Monitor for updates and make the view dirty. // Monitor for updates and make the view dirty.
IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService)); IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService));
componentChangeService.ComponentAdding += new ComponentEventHandler(ComponentAddingHandler); //componentChangeService.ComponentAdding += new ComponentEventHandler(ComponentAddingHandler);
componentChangeService.ComponentAdded += new ComponentEventHandler(ComponentAddedHandler); componentChangeService.ComponentAdded += new ComponentEventHandler(ComponentAddedHandler);
componentChangeService.ComponentChanged += new ComponentChangedEventHandler(ComponentChangedHandler); componentChangeService.ComponentChanged += new ComponentChangedEventHandler(ComponentChangedHandler);
@ -192,7 +192,6 @@ namespace WorkflowDesigner
propertyContainer.SelectableObjects = DesignerHost.Container.Components; propertyContainer.SelectableObjects = DesignerHost.Container.Components;
propertyContainer.Host = DesignerHost; propertyContainer.Host = DesignerHost;
propertyContainer.SelectedObjects = selArray; propertyContainer.SelectedObjects = selArray;
PropertyPad.Grid.CommandsVisibleIfAvailable = false;
} }
internal void Deselected() internal void Deselected()

26
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/NRefactoryDesignerLoader.cs

@ -35,6 +35,7 @@ namespace WorkflowDesigner
{ {
public class DefaultMemberRelationshipService : MemberRelationshipService public class DefaultMemberRelationshipService : MemberRelationshipService
{ {
public override bool SupportsRelationship(MemberRelationship source, MemberRelationship relationship) public override bool SupportsRelationship(MemberRelationship source, MemberRelationship relationship)
{ {
return true; return true;
@ -51,7 +52,6 @@ namespace WorkflowDesigner
public class NRefactoryDesignerLoader : CodeDomDesignerLoader public class NRefactoryDesignerLoader : CodeDomDesignerLoader
{ {
TextEditorControl textEditorControl; TextEditorControl textEditorControl;
ITypeResolutionService typeResolutionService;
//IDesignerGenerator generator = new CSharpDesignerGenerator(); //IDesignerGenerator generator = new CSharpDesignerGenerator();
IViewContent viewContent; IViewContent viewContent;
@ -72,7 +72,7 @@ namespace WorkflowDesigner
protected override ITypeResolutionService TypeResolutionService { protected override ITypeResolutionService TypeResolutionService {
get { get {
return typeResolutionService; return GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
} }
} }
@ -85,22 +85,28 @@ namespace WorkflowDesigner
protected override void Initialize() protected override void Initialize()
{ {
ITypeProvider typeProvider = TypeProviderService.GetTypeProvider(ProjectService.OpenSolution.FindProjectContainingFile(viewContent.PrimaryFileName));
try {
typeProvider.GetType("System.ComponentModel.Design.Serialization.CodeDomSerializer", true);
} catch (Exception ex) {
MessageService.ShowErrorFormatted("Unable to find class CodeDomSerializer, make sure the project has a reference to assembly System.Design");
throw ex;
}
LoaderHost.AddService(typeof(ITypeProvider), typeProvider);
LoaderHost.AddService(typeof(IIdentifierCreationService), new IdentifierCreationService()); LoaderHost.AddService(typeof(IIdentifierCreationService), new IdentifierCreationService());
LoaderHost.AddService(typeof(IMemberCreationService), new MemberCreationService()); LoaderHost.AddService(typeof(IMemberCreationService), new MemberCreationService(LoaderHost));
LoaderHost.AddService(typeof(IEventBindingService), new CSharpWorkflowDesignerEventBindingService(LoaderHost, viewContent.PrimaryFileName)); LoaderHost.AddService(typeof(IEventBindingService), new CSharpWorkflowDesignerEventBindingService(LoaderHost, viewContent.PrimaryFileName));
LoaderHost.AddService(typeof(IToolboxService), new WorkflowToolboxService(LoaderHost)); LoaderHost.AddService(typeof(IToolboxService), new WorkflowToolboxService(LoaderHost));
LoaderHost.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService()); LoaderHost.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService());
LoaderHost.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(LoaderHost)); LoaderHost.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(LoaderHost));
LoaderHost.AddService(typeof(ITypeProvider), TypeProviderService.GetTypeProvider(ProjectService.CurrentProject)); LoaderHost.AddService(typeof(ITypeResolutionService), new TypeResolutionService(LoaderHost));
typeResolutionService = new TypeResolutionService(LoaderHost); LoaderHost.AddService(typeof(IPropertyValueUIService), new PropertyValueUIService());
LoaderHost.AddService(typeof(ITypeResolutionService), typeResolutionService);
base.Initialize(); base.Initialize();
} }
#region Taken from FormDesigner.NRefactoryDesignerLoad to get a CodeCompileUnit for the activity. #region Taken from FormDesigner.NRefactoryDesignerLoad to get a CodeCompileUnit for the activity.
string lastTextContent; string lastTextContent;
protected override CodeCompileUnit Parse() protected override CodeCompileUnit Parse()
@ -123,12 +129,6 @@ namespace WorkflowDesigner
missingReferenceMessage, new string[,] {{ "Name" , "System.Workflow.Activities"}} missingReferenceMessage, new string[,] {{ "Name" , "System.Workflow.Activities"}}
)); ));
} }
/*if (formClass.ProjectContent.GetClass("System.Windows.Forms.Form", 0) == null) {
throw new WorkflowDesignerLoadException(
StringParser.Parse(
missingReferenceMessage, new string[,] {{ "Name" , "System.Windows.Forms"}}
));
}*/
List<KeyValuePair<string, CompilationUnit>> compilationUnits = new List<KeyValuePair<string, CompilationUnit>>(); List<KeyValuePair<string, CompilationUnit>> compilationUnits = new List<KeyValuePair<string, CompilationUnit>>();
bool foundInitMethod = false; bool foundInitMethod = false;

2
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/XomlCodeSeparationDesignerLoader.cs

@ -39,7 +39,7 @@ namespace WorkflowDesigner
base.Initialize(); base.Initialize();
// TODO: Install the Add the additional services into the designer here. // TODO: Install the Add the additional services into the designer here.
LoaderHost.AddService(typeof(IMemberCreationService), new MemberCreationService()); LoaderHost.AddService(typeof(IMemberCreationService), new MemberCreationService(LoaderHost));
LoaderHost.AddService(typeof(IEventBindingService), new CSharpWorkflowDesignerEventBindingService(LoaderHost,codeFileName)); LoaderHost.AddService(typeof(IEventBindingService), new CSharpWorkflowDesignerEventBindingService(LoaderHost,codeFileName));
} }

35
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/XomlDesignerLoader.cs

@ -7,6 +7,7 @@
#region Using #region Using
using System; using System;
using System.Globalization;
using System.Text; using System.Text;
using System.Workflow.ComponentModel; using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Serialization; using System.Workflow.ComponentModel.Serialization;
@ -82,7 +83,7 @@ namespace WorkflowDesigner
CreateRulesProjectItem(); CreateRulesProjectItem();
} }
return new StringWriter(rules); return new StringWriter(rules, CultureInfo.CurrentCulture);
} }
private void CreateRulesProjectItem() private void CreateRulesProjectItem()
@ -106,15 +107,12 @@ namespace WorkflowDesigner
Activity rootActivity = LoaderHost.RootComponent as Activity; Activity rootActivity = LoaderHost.RootComponent as Activity;
if (rootActivity != null) { if (rootActivity != null) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
XmlTextWriter xmlWriter = new XmlTextWriter(new StringWriter(sb)); XmlTextWriter xmlWriter = new XmlTextWriter(new StringWriter(sb, CultureInfo.CurrentCulture));
try try {
{
WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer(); WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer();
xomlSerializer.Serialize(serializationManager, xmlWriter, rootActivity); xomlSerializer.Serialize(serializationManager, xmlWriter, rootActivity);
xoml = sb.ToString(); xoml = sb.ToString();
} } finally {
finally
{
xmlWriter.Close(); xmlWriter.Close();
} }
} }
@ -128,13 +126,14 @@ namespace WorkflowDesigner
protected override void Initialize() protected override void Initialize()
{ {
base.Initialize();
LoaderHost.AddService(typeof(IToolboxService), new WorkflowToolboxService(LoaderHost)); LoaderHost.AddService(typeof(IToolboxService), new WorkflowToolboxService(LoaderHost));
LoaderHost.AddService(typeof(ITypeProvider), TypeProviderService.GetTypeProvider(Project)); LoaderHost.AddService(typeof(ITypeProvider), TypeProviderService.GetTypeProvider(Project));
LoaderHost.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(LoaderHost)); LoaderHost.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(LoaderHost));
LoaderHost.AddService(typeof(ITypeResolutionService), new TypeResolutionService(LoaderHost)); LoaderHost.AddService(typeof(ITypeResolutionService), new TypeResolutionService(LoaderHost));
LoaderHost.AddService(typeof(IPropertyValueUIService), new PropertyValueUIService());
base.Initialize();
} }
@ -156,13 +155,10 @@ namespace WorkflowDesigner
// get the root activity from the xml. // get the root activity from the xml.
XmlReader reader = new XmlTextReader(new StringReader(xoml)); XmlReader reader = new XmlTextReader(new StringReader(xoml));
Activity rootActivity = null; Activity rootActivity = null;
try try {
{
WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer(); WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer();
rootActivity = xomlSerializer.Deserialize(serializationManager, reader) as Activity; rootActivity = xomlSerializer.Deserialize(serializationManager, reader) as Activity;
} } finally {
finally
{
reader.Close(); reader.Close();
} }
@ -183,8 +179,7 @@ namespace WorkflowDesigner
protected void AddChildren(CompositeActivity compositeActivity) protected void AddChildren(CompositeActivity compositeActivity)
{ {
foreach (Activity activity in compositeActivity.Activities) foreach (Activity activity in compositeActivity.Activities) {
{
LoaderHost.Container.Add(activity, activity.QualifiedName); LoaderHost.Container.Add(activity, activity.QualifiedName);
CompositeActivity compositeActivity2 = activity as CompositeActivity; CompositeActivity compositeActivity2 = activity as CompositeActivity;
@ -197,22 +192,18 @@ namespace WorkflowDesigner
{ {
try { try {
// Remove all the services from the from the host designer. // Remove all the services from the from the host designer.
if (LoaderHost != null) if (LoaderHost != null) {
{
LoaderHost.RemoveService(typeof(IToolboxService)); LoaderHost.RemoveService(typeof(IToolboxService));
LoaderHost.RemoveService(typeof(ITypeProvider)); LoaderHost.RemoveService(typeof(ITypeProvider));
LoaderHost.RemoveService(typeof(IEventBindingService)); LoaderHost.RemoveService(typeof(IEventBindingService));
LoaderHost.RemoveService(typeof(IMemberCreationService)); LoaderHost.RemoveService(typeof(IMemberCreationService));
LoaderHost.RemoveService(typeof(IMenuCommandService)); LoaderHost.RemoveService(typeof(IMenuCommandService));
LoaderHost.RemoveService(typeof(IPropertyValueUIService));
LoaderHost.RemoveService(typeof(ITypeResolutionService));
} }
} finally { } finally {
base.Dispose(); base.Dispose();
} }
} }
} }
} }

6
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/PrimaryView/PrimaryViewContent.cs

@ -25,6 +25,9 @@ namespace WorkflowDesigner
public WorkflowPrimaryViewContent(OpenedFile primaryFile) : base(primaryFile) public WorkflowPrimaryViewContent(OpenedFile primaryFile) : base(primaryFile)
{ {
if (primaryFile == null)
throw new ArgumentNullException("primaryFile");
this.TabPageText = "Workflow"; this.TabPageText = "Workflow";
control = new ViewContentControl(this); control = new ViewContentControl(this);
@ -71,6 +74,9 @@ namespace WorkflowDesigner
public void LoadContent(string content) public void LoadContent(string content)
{ {
if (content == null)
throw new ArgumentNullException("content");
XomlDesignerLoader xomlDesignerLoader = new XomlDesignerLoader(this); XomlDesignerLoader xomlDesignerLoader = new XomlDesignerLoader(this);
xomlDesignerLoader.Xoml = content; xomlDesignerLoader.Xoml = content;
control.LoadWorkflow(xomlDesignerLoader); control.LoadWorkflow(xomlDesignerLoader);

3
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/SecondaryView/SecondaryDisplayBinding.cs

@ -34,6 +34,9 @@ namespace WorkflowDesigner
public bool CanAttachTo(IViewContent content) public bool CanAttachTo(IViewContent content)
{ {
if (content == null)
throw new ArgumentNullException("content");
if (content is ITextEditorControlProvider) { if (content is ITextEditorControlProvider) {
ITextEditorControlProvider textAreaControlProvider = (ITextEditorControlProvider)content; ITextEditorControlProvider textAreaControlProvider = (ITextEditorControlProvider)content;
string fileExtension = String.Empty; string fileExtension = String.Empty;

4
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/WorkflowDesignerEventBindingService.cs

@ -43,7 +43,7 @@ namespace WorkflowDesigner
string codeFileName; string codeFileName;
CodeCompileUnit ccu; CodeCompileUnit ccu;
public WorkflowDesignerEventBindingService(IServiceProvider provider, string codeSeparationFileName) protected WorkflowDesignerEventBindingService(IServiceProvider provider, string codeSeparationFileName)
{ {
this.provider = provider; this.provider = provider;
this.codeFileName = codeSeparationFileName; this.codeFileName = codeSeparationFileName;
@ -274,7 +274,7 @@ namespace WorkflowDesigner
throw new ArgumentNullException("component"); throw new ArgumentNullException("component");
if (e == null) if (e == null)
throw new ArgumentNullException("eventDescriptor"); throw new ArgumentNullException("e");
Activity activity = component as Activity; Activity activity = component as Activity;
if (component == null) if (component == null)

33
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/IdentifierCreationService.cs

@ -5,19 +5,19 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
#region Using
using System; using System;
using System.Workflow.ComponentModel.Design; using System.Workflow.ComponentModel.Design;
using ICSharpCode.Core; using ICSharpCode.Core;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Workflow.Activities; using System.Workflow.Activities;
using System.Workflow.ComponentModel; using System.Workflow.ComponentModel;
using System.ComponentModel; using System.ComponentModel;
using System.Text; using System.Text;
//using System #endregion
namespace WorkflowDesigner namespace WorkflowDesigner
{ {
/// <summary> /// <summary>
/// Description of IdentifierCreationService. /// Description of IdentifierCreationService.
@ -28,16 +28,35 @@ using System.Text;
{ {
} }
public void EnsureUniqueIdentifiers(System.Workflow.ComponentModel.CompositeActivity parentActivity, System.Collections.ICollection childActivities) public void EnsureUniqueIdentifiers(CompositeActivity parentActivity, System.Collections.ICollection childActivities)
{ {
if (parentActivity == null)
throw new ArgumentNullException("parentActivity");
if (childActivities == null)
throw new ArgumentNullException("childActivities");
LoggingService.DebugFormatted("EnsureUniqueIdentifiers(parentActivity={0}, childActivities={1})", parentActivity, childActivities); LoggingService.DebugFormatted("EnsureUniqueIdentifiers(parentActivity={0}, childActivities={1})", parentActivity, childActivities);
//throw new NotImplementedException();
foreach (Activity activity in childActivities)
{
LoggingService.DebugFormatted("{0}", activity.Name);
// TODO: Something here?
}
} }
public void ValidateIdentifier(System.Workflow.ComponentModel.Activity activity, string identifier) public void ValidateIdentifier(Activity activity, string identifier)
{ {
if (activity == null)
throw new ArgumentNullException("activity");
if (identifier == null)
throw new ArgumentNullException("identifier");
LoggingService.DebugFormatted("ValidateIdentifier(ValidateIdentifier={0}, identifier={1})", activity, identifier); LoggingService.DebugFormatted("ValidateIdentifier(ValidateIdentifier={0}, identifier={1})", activity, identifier);
//throw new NotImplementedException();
//TODO: Something here?
} }
} }

28
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/MemberCreationService.cs

@ -5,32 +5,46 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
#region Using
using System; using System;
using System.CodeDom;
using System.Workflow.ComponentModel.Design; using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Compiler;
using ICSharpCode.Core; using ICSharpCode.Core;
#endregion
namespace WorkflowDesigner namespace WorkflowDesigner
{ {
/// <summary> /// <summary>
/// Description of MemberCreationService. /// Description of MemberCreationService.
/// </summary> /// </summary>
public class MemberCreationService : IMemberCreationService public class MemberCreationService : IMemberCreationService, IServiceProvider
{ {
public MemberCreationService() #region IServiceProvider implementation
IServiceProvider provider;
public object GetService(Type serviceType)
{ {
return provider.GetService(serviceType);
} }
#endregion
public void CreateField(string className, string fieldName, Type fieldType, Type[] genericParameterTypes, System.CodeDom.MemberAttributes attributes, System.CodeDom.CodeSnippetExpression initializationExpression, bool overwriteExisting) public MemberCreationService(IServiceProvider provider)
{
this.provider = provider;
}
public void CreateField(string className, string fieldName, Type fieldType, Type[] genericParameterTypes, MemberAttributes attributes, System.CodeDom.CodeSnippetExpression initializationExpression, bool overwriteExisting)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void CreateProperty(string className, string propertyName, Type propertyType, System.Workflow.ComponentModel.Compiler.AttributeInfo[] attributes, bool emitDependencyProperty, bool isMetaProperty, bool isAttached, Type ownerType, bool isReadOnly) public void CreateProperty(string className, string propertyName, Type propertyType, AttributeInfo[] attributes, bool emitDependencyProperty, bool isMetaProperty, bool isAttached, Type ownerType, bool isReadOnly)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void CreateEvent(string className, string eventName, Type eventType, System.Workflow.ComponentModel.Compiler.AttributeInfo[] attributes, bool emitDependencyProperty) public void CreateEvent(string className, string eventName, Type eventType, AttributeInfo[] attributes, bool emitDependencyProperty)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -38,7 +52,7 @@ namespace WorkflowDesigner
public void UpdateTypeName(string oldClassName, string newClassName) public void UpdateTypeName(string oldClassName, string newClassName)
{ {
LoggingService.DebugFormatted("UpdateTypeName(oldClassName={0}, newClassName={1})", oldClassName, newClassName); LoggingService.DebugFormatted("UpdateTypeName(oldClassName={0}, newClassName={1})", oldClassName, newClassName);
//throw new NotImplementedException(); throw new NotImplementedException();
} }
public void UpdateBaseType(string className, Type baseType) public void UpdateBaseType(string className, Type baseType)
@ -66,7 +80,7 @@ namespace WorkflowDesigner
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void ShowCode(System.Workflow.ComponentModel.Activity activity, string methodName, Type delegateType) public void ShowCode(Activity activity, string methodName, Type delegateType)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

75
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/PropertyValueUIService.cs

@ -0,0 +1,75 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of PropertyValueUIService.
/// </summary>
public class PropertyValueUIService : IPropertyValueUIService
{
private PropertyValueUIHandler handler;
public PropertyValueUIService()
{
}
public event EventHandler PropertyUIValueItemsChanged;
public void AddPropertyValueUIHandler(PropertyValueUIHandler newHandler)
{
if (newHandler == null)
throw new ArgumentNullException("newHandler");
handler += newHandler;
}
public PropertyValueUIItem[] GetPropertyUIValueItems(ITypeDescriptorContext context, PropertyDescriptor propDesc)
{
if (context == null)
throw new ArgumentNullException("context");
if (propDesc == null)
throw new ArgumentNullException("propDesc");
if (handler != null){
ArrayList valueUIItemList = new ArrayList();
handler(context, propDesc, valueUIItemList);
if (valueUIItemList.Count > 0) {
PropertyValueUIItem[] valueItems = new PropertyValueUIItem[valueUIItemList.Count];
valueUIItemList.CopyTo(valueItems, 0);
return valueItems;
}
}
return null;
}
public void NotifyPropertyValueUIItemsChanged()
{
if (PropertyUIValueItemsChanged != null)
PropertyUIValueItemsChanged(this, EventArgs.Empty);
}
public void RemovePropertyValueUIHandler(PropertyValueUIHandler newHandler)
{
if (newHandler == null)
throw new ArgumentNullException("newHandler");
handler -= newHandler;
}
}
}

2
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/TypeProviderService.cs

@ -27,7 +27,7 @@ namespace WorkflowDesigner
/// </summary> /// </summary>
public class TypeProviderService public class TypeProviderService
{ {
private static Dictionary<IProject, TypeProvider> providers; private static Dictionary<IProject, TypeProvider> providers = null;
#region Property Accessorors #region Property Accessorors
private static Dictionary<IProject, TypeProvider> Providers { private static Dictionary<IProject, TypeProvider> Providers {

28
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowMenuCommandService.cs

@ -5,6 +5,7 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
#region Using
using System; using System;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using System.Workflow.ComponentModel.Design; using System.Workflow.ComponentModel.Design;
@ -13,6 +14,7 @@ using System.Drawing;
using System.Collections; using System.Collections;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
#endregion
namespace WorkflowDesigner namespace WorkflowDesigner
{ {
@ -21,6 +23,7 @@ namespace WorkflowDesigner
/// </summary> /// </summary>
public class WorkflowMenuCommandService : System.ComponentModel.Design.MenuCommandService public class WorkflowMenuCommandService : System.ComponentModel.Design.MenuCommandService
{ {
private const string DESIGNER_ACTION_GUID = "3bd4a275-fccd-49f0-b617-765ce63b4340";
public WorkflowMenuCommandService(IServiceProvider host) : base(host) public WorkflowMenuCommandService(IServiceProvider host) : base(host)
{ {
@ -37,28 +40,32 @@ namespace WorkflowDesigner
ContextMenuStrip contextMenu = null; ContextMenuStrip contextMenu = null;
if (menuID == WorkflowMenuCommands.DesignerActionsMenu) { if (menuID == WorkflowMenuCommands.DesignerActionsMenu) {
contextMenu = new ContextMenuStrip();
Guid DesignerActionGuid = new Guid("3bd4a275-fccd-49f0-b617-765ce63b4340"); Guid designerActionGuid = new Guid(DESIGNER_ACTION_GUID);
ICollection collection = this.GetCommandList(menuID.Guid); ICollection collection = this.GetCommandList(menuID.Guid);
foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection) { foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection) {
// Only interested in the errors. // Only interested in the errors.
if (menuCommand.CommandID.ID == 8342) { if (menuCommand.CommandID.ID == 8342) {
if (contextMenu == null)
contextMenu = new ContextMenuStrip();
ToolStripMenuItem menuItem = new ToolStripMenuItem(menuCommand.Properties["Text"].ToString()); ToolStripMenuItem menuItem = new ToolStripMenuItem(menuCommand.Properties["Text"].ToString());
menuItem.Click += new EventHandler(DesignerActionsMenuClickHandler); menuItem.Click += new EventHandler(DesignerActionsMenuClickHandler);
menuItem.Tag = menuCommand.Properties[DesignerActionGuid]; menuItem.Tag = menuCommand.Properties[designerActionGuid];
contextMenu.Items.Add(menuItem); contextMenu.Items.Add(menuItem);
} }
} }
} else if (menuID == WorkflowMenuCommands.SelectionMenu) { } else if (menuID == WorkflowMenuCommands.SelectionMenu) {
contextMenu = new ContextMenuStrip();
foreach (DesignerVerb verb in Verbs) { foreach (DesignerVerb verb in Verbs) {
if (verb.Visible) { if (verb.Visible) {
if (contextMenu == null)
contextMenu = new ContextMenuStrip();
ToolStripMenuItem menuItem = new ToolStripMenuItem(verb.Text); ToolStripMenuItem menuItem = new ToolStripMenuItem(verb.Text);
menuItem.Click += new EventHandler(SelectionMenuClickHandler); menuItem.Click += new EventHandler(SelectionMenuClickHandler);
menuItem.Enabled = verb.Enabled; menuItem.Enabled = verb.Enabled;
@ -70,11 +77,11 @@ namespace WorkflowDesigner
} }
if (contextMenu != null) { if (contextMenu != null) {
WorkflowView workflowView = GetService(typeof(WorkflowView)) as WorkflowView; //WorkflowView workflowView = GetService(typeof(WorkflowView)) as WorkflowView;
contextMenu.Show(workflowView , workflowView.PointToClient(new Point(x, y))); //contextMenu.Show(workflowView , workflowView.PointToClient(new Point(x, y)));
contextMenu.Show(x, y);
//contextMenu.Capture = true;
} }
} }
private void SelectionMenuClickHandler(object sender, EventArgs e) private void SelectionMenuClickHandler(object sender, EventArgs e)
@ -96,8 +103,7 @@ namespace WorkflowDesigner
designerAction.Invoke(); // Will change the selectedObject in the designer designerAction.Invoke(); // Will change the selectedObject in the designer
if (!string.IsNullOrEmpty( designerAction.PropertyName)) if (!string.IsNullOrEmpty( designerAction.PropertyName)) {
{
// No easy way I can find to search for a specific griditem so // No easy way I can find to search for a specific griditem so
// find the root item in the grid, and search for items for the property. // find the root item in the grid, and search for items for the property.
GridItem item = PropertyPad.Grid.SelectedGridItem; GridItem item = PropertyPad.Grid.SelectedGridItem;

1
src/AddIns/DisplayBindings/WorkflowDesigner/Project/WorkflowDesigner.csproj

@ -106,6 +106,7 @@
<Compile Include="Src\Services\EventBindingService\WorkflowDesignerEventBindingService.cs" /> <Compile Include="Src\Services\EventBindingService\WorkflowDesignerEventBindingService.cs" />
<Compile Include="Src\Services\IdentifierCreationService.cs" /> <Compile Include="Src\Services\IdentifierCreationService.cs" />
<Compile Include="Src\Services\MemberCreationService.cs" /> <Compile Include="Src\Services\MemberCreationService.cs" />
<Compile Include="Src\Services\PropertyValueUIService.cs" />
<Compile Include="Src\Services\TypeProviderService.cs" /> <Compile Include="Src\Services\TypeProviderService.cs" />
<Compile Include="Src\Services\TypeResolutionService.cs" /> <Compile Include="Src\Services\TypeResolutionService.cs" />
<Compile Include="Src\Services\WorkflowSideTabService.cs" /> <Compile Include="Src\Services\WorkflowSideTabService.cs" />

Loading…
Cancel
Save