diff --git a/CIIP.Designer.Module.Win/CIIP.Designer.Module.Win.csproj b/CIIP.Designer.Module.Win/CIIP.Designer.Module.Win.csproj index 56b9c67..eb8fa9a 100644 --- a/CIIP.Designer.Module.Win/CIIP.Designer.Module.Win.csproj +++ b/CIIP.Designer.Module.Win/CIIP.Designer.Module.Win.csproj @@ -276,6 +276,12 @@ SmartVisualStudio.cs + + Component + + + Form + True True diff --git a/CIIP.Designer.Module.Win/Editors/ObjectPropertyEditorEx.cs b/CIIP.Designer.Module.Win/Editors/ObjectPropertyEditorEx.cs index 3d31887..51e876f 100644 --- a/CIIP.Designer.Module.Win/Editors/ObjectPropertyEditorEx.cs +++ b/CIIP.Designer.Module.Win/Editors/ObjectPropertyEditorEx.cs @@ -1,29 +1,104 @@ using System; +using System.ComponentModel; +using System.Drawing; using System.Linq; +using System.Windows.Forms; +using CIIP.Designer; +using DevExpress.ExpressApp; +using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Editors; +using DevExpress.ExpressApp.Localization; using DevExpress.ExpressApp.Model; +using DevExpress.ExpressApp.SystemModule; +using DevExpress.ExpressApp.Win; +using DevExpress.ExpressApp.Win.Core; using DevExpress.ExpressApp.Win.Editors; +using DevExpress.ExpressApp.Win.SystemModule; using DevExpress.Xpo; +using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; +using DevExpress.XtraEditors.Drawing; +using DevExpress.XtraEditors.ViewInfo; namespace CIIP.Module.Win.Editors { - [PropertyEditor(typeof(object), "OPE", false)] - public class ObjectPropertyEditorEx : ObjectPropertyEditor + public class AssignDefaultAssocicationInfoController : ObjectViewController + { + public AssignDefaultAssocicationInfoController() + { + + } + + protected override void OnActivated() + { + base.OnActivated(); + foreach (ObjectPropertyEditor objectPropertyEditor in View.GetItems()) + { + ((ISupportViewShowing)objectPropertyEditor).ViewShowingNotification += AssignDefaultAssocicationInfoController_ViewShowingNotification; + } + } + + private void AssignDefaultAssocicationInfoController_ViewShowingNotification(object sender, EventArgs e) + { + Application.ViewShowing += Application_ViewShowing; + + } + + private void Application_ViewShowing(object sender, ViewShowingEventArgs e) + { + Application.ViewShowing -= Application_ViewShowing; + if (e.View != null && e.View.Id == "AssocicationInfo_DetailView") + { + var associcationInfo = (AssocicationInfo)e.View.CurrentObject; + if (e.View.ObjectSpace.IsNewObject(associcationInfo)) + { + if (associcationInfo.Properties.Count < 1) + { + associcationInfo.Properties.Add(e.View.ObjectSpace.GetObject(ViewCurrentObject)); + } + //shownAddress.Street = ViewCurrentObject.DefaultStreet; + } + } + } + + protected override void OnDeactivated() + { + base.OnDeactivated(); + foreach (ObjectPropertyEditor objectPropertyEditor in View.GetItems()) + { + ((ISupportViewShowing)objectPropertyEditor).ViewShowingNotification -= AssignDefaultAssocicationInfoController_ViewShowingNotification; + } + } + + } + + + [PropertyEditor(typeof(AssocicationInfo), "OPE", false)] + public class ObjectPropertyEditorEx : ObjectPropertyEditor,IComplexViewItem { public ObjectPropertyEditorEx(Type objectType, IModelMemberViewItem model) : base(objectType, model) { } + XafApplication app; + IObjectSpace os; + + void IComplexViewItem.Setup(IObjectSpace os, XafApplication app) + { + this.app = app; + this.os = os; + base.Setup(os, app); + } protected override object CreateControlCore() { var c = base.CreateControlCore() as ObjectEdit; c.Properties.NullText = "<<自动设置>>"; + //c.ShowPopupWindow += C_ShowPopupWindow; c.Properties.NullValuePrompt = "自动设置"; var manual = c.Properties.Buttons.FirstOrDefault(x => x.Kind == ButtonPredefines.Ellipsis); if (manual != null) { - manual.ToolTip = "手动设置"; + manual.ToolTip = "手动设置"; } var clear = new EditorButton(ButtonPredefines.Delete); clear.Caption = "清除"; diff --git a/CIIP.Designer.Module.Win/ModelEditor/ModelEditorControlEx.cs b/CIIP.Designer.Module.Win/ModelEditor/ModelEditorControlEx.cs new file mode 100644 index 0000000..7d67ea2 --- /dev/null +++ b/CIIP.Designer.Module.Win/ModelEditor/ModelEditorControlEx.cs @@ -0,0 +1,72 @@ +using DevExpress.ExpressApp.Model; +using DevExpress.ExpressApp.Model.Core; +using DevExpress.ExpressApp.Utils; +using DevExpress.ExpressApp.Win.Core.ModelEditor; +using DevExpress.ExpressApp.Win.Core.ModelEditor.NodesTree; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +namespace CIIP.Win.ModelEditor +{ + [ToolboxItem(false)] + public class ModelEditorControlEx : ModelEditorControl + { + + public ModelEditorControlEx(ModelTreeList treeList,SettingsStorage settings) : base(treeList) + { + var fs = typeof(ModelEditorControl).GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + var field = fs.Single(x => x.Name == "settings"); //this.GetType().GetField("settings", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + + field.SetValue(this, settings); + //ReflectionHelper..SetMemberValue(this, "settings", settings); + } + } + + public class CIIPExtendModelInterfaceAdapter: ExtendModelInterfaceAdapter + { + public override string GetDisplayPropertyValue(object nodeObject) + { + var t = ((ModelTreeListNode)nodeObject).ModelNode; + Debug.WriteLine(t); + + var caption = base.GetDisplayPropertyValue(nodeObject); + switch (caption) + { + case "ActionDesign": + return "按钮设置"; + case "Actions": + return "按钮"; + + case "ActionToContainerMapping": + return "容器映射"; + case "Controllers": + return "控制器"; + case "DisableReasons": + return "禁用原因"; + case "BOModel": + return "模型"; + case "CreatableItems": + return "快速创建"; + case "ImageSources": + return "图像来源"; + case "Localization": + return "本地化"; + case "NavigationItems": + return "导航设置"; + case "Options": + return "选项"; + case "Validation": + return "验证"; + case "ViewItems": + return "视图项目"; + case "Views": + return "视图"; + default: + break; + } + + + return caption; + } + } +} diff --git a/CIIP.Designer.Module.Win/ModelEditor/ModelEditorForm.cs b/CIIP.Designer.Module.Win/ModelEditor/ModelEditorForm.cs new file mode 100644 index 0000000..552417e --- /dev/null +++ b/CIIP.Designer.Module.Win/ModelEditor/ModelEditorForm.cs @@ -0,0 +1,139 @@ +using DevExpress.ExpressApp.Templates; +using DevExpress.ExpressApp.Utils; +using DevExpress.ExpressApp.Win.Controls; +using DevExpress.ExpressApp.Win.Core; +using DevExpress.ExpressApp.Win.Core.ModelEditor; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CIIP.Win.ModelEditor +{ + [ToolboxItem(false)] + public class ModelEditorForm : DevExpress.ExpressApp.Win.Templates.Bars.DetailFormV2, IModelEditorSettings + { + public const string Title = "模型设置"; + private IModelEditorController controller; + private SettingsStorage settingsStorage; + private ModelEditorControl modelEditorControl; + private bool dropModelDifs = false; + public ModelEditorForm(ModelEditorViewController controller, SettingsStorage settingsStorage) + : base() + { + this.settingsStorage = settingsStorage; + ((IBarManagerHolder)this).BarManager.MainMenu.Visible = false; + var t = new CIIPExtendModelInterfaceAdapter(); + //*********************************************************** + //here modified + modelEditorControl = new ModelEditorControlEx(new DevExpress.ExpressApp.Win.Core.ModelEditor.NodesTree.ModelTreeList(t), settingsStorage); + + controller.SetControl(modelEditorControl); + controller.SetTemplate(this); + this.controller = controller; + modelEditorControl.Dock = DockStyle.Fill; + ((Control)((IViewSiteTemplate)this).ViewSiteControl).Controls.Add(modelEditorControl); + if (settingsStorage != null) + { + new FormStateAndBoundsManager().Load(this, settingsStorage); + } + Image modelEditorImage = ImageLoader.Instance.GetImageInfo("EditModel").Image; + if (modelEditorImage != null) + { + this.Icon = Icon.FromHandle(new Bitmap(modelEditorImage).GetHicon()); + } + Text = Title; + Disposed += new EventHandler(ModelEditorForm_Disposed); + this.controller.LoadSettings(); + this.Tag = "testdialog=ModelEditor"; + } + void ModelEditorForm_Disposed(object sender, EventArgs e) + { + } + public void SetCaption(string text) + { + Text = string.IsNullOrEmpty(text) ? Title : string.Format("{0} - {1}", text, Title); + } + protected virtual DialogResult CloseModelEditorDialog() + { + return ModelEditorViewController.CloseModelEditorDialog; + } + protected override void OnClosing(CancelEventArgs e) + { + if (controller.IsModified) + { + switch (CloseModelEditorDialog()) + { + case DialogResult.Yes: + { + if (controller.Save()) + { + DialogResult = DialogResult.Yes; + } + else + { + e.Cancel = true; + } + break; + } + case DialogResult.No: + { + dropModelDifs = true; + break; + } + case DialogResult.Cancel: + { + e.Cancel = true; + break; + } + } + } + if (!e.Cancel) + { + //((ModelEditorViewController)controller).UnSubscribeEvents(); + ModelEditorSaveSettings(); + } + } + protected override void OnClosed(EventArgs e) + { + if (dropModelDifs) + { + controller.ReloadModel(false, false); + } + modelEditorControl.OnClosed(); + controller.Dispose(); + controller = null; + base.OnClosed(e); + } + protected override void Dispose(bool disposing) + { + lock (ModelEditorViewController.LockDisposeObject) + { + if (controller != null) + { + controller.IsDisposing = true; + } + base.Dispose(disposing); + controller = null; + settingsStorage = null; + if (disposing) + { + modelEditorControl.Dispose(); + } + } + } + #region IModelEditorSettingsStorage Members + public void ModelEditorSaveSettings() + { + if (controller != null) + { + controller.SaveSettings(); + } + modelEditorControl.CurrentModelTreeListNode = null; + new FormStateAndBoundsManager().Save(this, settingsStorage); + } + #endregion + } +} diff --git a/CIIP.Designer.Module/BusinessObjects/Property/AssocicationInfo.cs b/CIIP.Designer.Module/BusinessObjects/Property/AssocicationInfo.cs index 2e93749..e81158a 100644 --- a/CIIP.Designer.Module/BusinessObjects/Property/AssocicationInfo.cs +++ b/CIIP.Designer.Module/BusinessObjects/Property/AssocicationInfo.cs @@ -7,22 +7,96 @@ using System.Linq; using System.Diagnostics; using DevExpress.Persistent.BaseImpl; +using DevExpress.Persistent.Validation; +using DevExpress.ExpressApp; +using DevExpress.ExpressApp.Actions; namespace CIIP.Designer { - [NavigationItem] + [NavigationItem] public class AssocicationInfo : NameObject { public AssocicationInfo(Session s) : base(s) { + Properties.CollectionChanged += Properties_CollectionChanged; } - [Association, DevExpress.Xpo.Aggregated,XafDisplayName("属性")] - public XPCollection Properties + private void Properties_CollectionChanged(object sender, XPCollectionChangedEventArgs e) + { + if (!IsLoading && !IsSaving) + { + _propertiesDataSource = null; + OnChanged(nameof(CollectionPropertyCount)); + OnChanged(nameof(ReferencePropertyCount)); + OnChanged(nameof(PropertyCount)); + calcName(); + } + } + + void calcName() + { + var ps = Properties.OrderBy(x => x.Name); + var first = ps.FirstOrDefault(); + var last = ps.LastOrDefault(); + Name = first?.DisplayName + "-" + last?.DisplayName; + } + + [RuleValueComparison(ValueComparisonType.GreaterThanOrEqual, 1, CustomMessageTemplate = "至少应有一个集合属性!")] + [XafDisplayName("集合属性数量")] + public int CollectionPropertyCount { get { return Properties.OfType().Count(); } } + + [RuleValueComparison(ValueComparisonType.LessThan,2,CustomMessageTemplate ="最多只能有一个引用型属性,即为一对多关系.")] + [XafDisplayName("引用属性数量")] + public int ReferencePropertyCount { get { return Properties.OfType().Where(x => x.PropertyType.CanCreateAssocication).Count(); } } + + [RuleValueComparison(ValueComparisonType.Equals,2,CustomMessageTemplate ="必须有选择两个属性!")] + [XafDisplayName("属性数量")] + public int PropertyCount { get { return Properties.Count; } } + + public string 关系类型 { get { - return GetCollection(nameof(Properties)); + if (PropertyCount == 2 && (ReferencePropertyCount + CollectionPropertyCount) == 2) + { + if (CollectionPropertyCount == 2) + { + return "对多对"; + } + return "一对多"; + } + return ""; + } + } + + + [Association,XafDisplayName("属性"),DataSourceProperty(nameof(PropertiesDataSource))] + public XPCollection Properties + { + get + { + return GetCollection(nameof(Properties)); + } + } + + List _propertiesDataSource; + List PropertiesDataSource + { + get + { + if (_propertiesDataSource == null) + { + var fromProperty = Properties.FirstOrDefault(); + if (fromProperty != null) + { + _propertiesDataSource = Session.QueryInTransaction().ToArray().Where(x => x.PropertyType.CanCreateAssocication && x.BusinessObject == fromProperty.PropertyType && !Properties.Contains(x)).ToList(); + } + else + { + throw new UserFriendlyException("错误,请先将来源属性填加!"); + } + } + return _propertiesDataSource; } } @@ -197,26 +271,65 @@ public XPCollection Properties // set { SetPropertyValue(nameof(RightProperty), value); } // } } - - public class AssocicationItem : BaseObject + + public class CreateAssocicationPropertyViewController : ObjectViewController { - public AssocicationItem(Session session) : base(session) + public CreateAssocicationPropertyViewController() { - } + TargetViewNesting = Nesting.Nested; + TargetViewId = "AssocicationInfo_Properties_ListView"; - [Association] - public AssocicationInfo AssocicationInfo + var crp = new SimpleAction(this, "CreateAssocicationReferenceProperty", PredefinedCategory.ObjectsCreation); + crp.Caption = "自动创建引用属性"; + crp.Execute += Crp_Execute; + var ccp = new SimpleAction(this, "CreateAssocicationCollectionProperty", PredefinedCategory.ObjectsCreation); + ccp.Caption = "自动创建集合属性"; + ccp.Execute += Ccp_Execute; + //action.Items.Add() + } + + private void Ccp_Execute(object sender, SimpleActionExecuteEventArgs e) { - get { return GetPropertyValue(nameof(AssocicationInfo)); } - set { SetPropertyValue(nameof(AssocicationInfo), value); } + //创建集合属性. + var cs = this.View.CollectionSource;//.List.FirstOrDefault(); + var ai = (Frame as NestedFrame).ViewItem.CurrentObject as AssocicationInfo; + if (ai.Properties.Count == 1) + { + var cp = ai.Properties[0]; + //当前是xpcollection<学生> 学生s {get;} 属性 + //自动创建的属性是 xpcollection<教师> 教师s {get;} 属性 + var property = ObjectSpace.CreateObject(); + property.BusinessObject = cp.PropertyType; + property.PropertyType = cp.BusinessObject; + property.Name = cp.BusinessObject.Name; + property.Caption = cp.BusinessObject.Caption; + } + else + { + Application.ShowViewStrategy.ShowMessage("当前列表中有一个属性时才可以推导创建出另一个属性!", InformationType.Info, 3000, InformationPosition.Bottom); + } } - - public PropertyBase Property + private void Crp_Execute(object sender, SimpleActionExecuteEventArgs e) { - get { return GetPropertyValue(nameof(Property)); } - set { SetPropertyValue(nameof(Property), value); } + //创建引用属性 + var cs = this.View.CollectionSource;//.List.FirstOrDefault(); + var ai = (Frame as NestedFrame).ViewItem.CurrentObject as AssocicationInfo; + if (ai.Properties.Count == 1) + { + var cp = ai.Properties[0]; + // //当前是xpcollection orders {get;} 属性 + // //自动创建的属性是 customer customer {get;} 属性 + var property = ObjectSpace.CreateObject(); + property.BusinessObject = cp.PropertyType; + property.PropertyType = cp.BusinessObject; + property.Name = cp.BusinessObject.Name; + property.Caption = cp.BusinessObject.Caption; + } + else + { + Application.ShowViewStrategy.ShowMessage("当前列表中有一个属性时才可以推导创建出另一个属性!", InformationType.Info, 3000, InformationPosition.Bottom); + } } - } } \ No newline at end of file diff --git a/CIIP.Designer.Module/BusinessObjects/Property/Editors.cs b/CIIP.Designer.Module/BusinessObjects/Property/Editors.cs new file mode 100644 index 0000000..67539fa --- /dev/null +++ b/CIIP.Designer.Module/BusinessObjects/Property/Editors.cs @@ -0,0 +1,7 @@ +namespace CIIP +{ + public class Editors + { + public const string PropertyTypeTokenEditor = "PropertyTypeTokenEditor"; + } +} diff --git a/CIIP.Designer.Module/BusinessObjects/Property/Property.cs b/CIIP.Designer.Module/BusinessObjects/Property/Property.cs index 3aee591..fae2602 100644 --- a/CIIP.Designer.Module/BusinessObjects/Property/Property.cs +++ b/CIIP.Designer.Module/BusinessObjects/Property/Property.cs @@ -7,14 +7,6 @@ using DevExpress.Persistent.Validation; using DevExpress.Xpo; -namespace CIIP -{ - public class Editors - { - public const string PropertyTypeTokenEditor = "PropertyTypeTokenEditor"; - } -} - namespace CIIP.Designer { @@ -100,8 +92,6 @@ public int Size set { SetPropertyValue(nameof(Size), value); } } - - public override void AfterConstruction() { base.AfterConstruction(); diff --git a/CIIP.Designer.Module/BusinessObjects/Property/PropertyBase.cs b/CIIP.Designer.Module/BusinessObjects/Property/PropertyBase.cs index 1718c00..46d309f 100644 --- a/CIIP.Designer.Module/BusinessObjects/Property/PropertyBase.cs +++ b/CIIP.Designer.Module/BusinessObjects/Property/PropertyBase.cs @@ -162,6 +162,7 @@ public void CalcNameCaption() Caption = PropertyType.Caption; } } + //protected override void OnChanged(string propertyName, object oldValue, object newValue) //{ // base.OnChanged(propertyName, oldValue, newValue); @@ -181,7 +182,7 @@ public override void AfterConstruction() //[ModelDefault("AllowEdit", "False")] [XafDisplayName("")] - [EditorAlias("OPE")] + [EditorAlias("OPE"),Association,VisibleInDetailView(true)] public AssocicationInfo AssocicationInfo { get { return GetPropertyValue(nameof(AssocicationInfo)); } @@ -256,68 +257,17 @@ public bool IsAssocication set { SetPropertyValue(nameof(IsAssocication), value); } } - public PropertyBase(Session s) : base(s) + [XafDisplayName("˵")] + [Size(-1)] + [ModelDefault("RowCount","2")] + public string Memo { + get { return GetPropertyValue(nameof(Memo)); } + set { SetPropertyValue(nameof(Memo), value); } } - } - public class PropertyBaseViewController : ObjectViewController - { - public PropertyBaseViewController() + public PropertyBase(Session s) : base(s) { - var action = new SimpleAction(this, "CreateRelationProperty", "CreateRelationProperty"); - action.Caption = ""; - action.ImageName = "Action_New"; - action.Execute += Action_Execute; } - - private void Action_Execute(object sender, SimpleActionExecuteEventArgs e) - { - //var os = this.ObjectSpace.CreateNestedObjectSpace(); - //var obj = CreateRelationProperty(os.GetObject(this.ViewCurrentObject), os); - - //os.Committed += (s, evt) => - //{ - // this.ViewCurrentObject.AssocicationInfo.LeftProperty = this.ObjectSpace.GetObject(obj); - - //}; - - //var view = Application.CreateDetailView(os, obj, true); - //e.ShowViewParameters.CreatedView = view; - //e.ShowViewParameters.Context = TemplateContext.PopupWindow; - //e.ShowViewParameters.NewWindowTarget = NewWindowTarget.Separate; - //e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow; - //var dc = new DialogController(); - - //dc.Accepting += (s, evt) => - //{ - // //os.CommitChanges(); - //}; - - //e.ShowViewParameters.Controllers.Add(dc); - - } - - //public PropertyBase CreateRelationProperty(PropertyBase currentProperty, IObjectSpace os) - //{ - // PropertyBase property; - // if (currentProperty.AssocicationInfo.ManyToMany) - // { - // //ǰxpcollection<ѧ> ѧs {get;} - // //Զ xpcollection<ʦ> ʦs {get;} - // property = new CollectionProperty((os as XPObjectSpace).Session, currentProperty.AssocicationInfo);// os.CreateObject(); - // } - // else - // { - // //ǰxpcollection orders {get;} - // //Զ customer customer {get;} - // property = os.CreateObject(); - // } - // property.BusinessObject = currentProperty.PropertyType; - // property.PropertyType = currentProperty.BusinessObject; - // property.Name = currentProperty.BusinessObject.Name; - // property.Caption = currentProperty.BusinessObject.Caption; - // return property; - //} } } \ No newline at end of file diff --git a/CIIP.Designer.Module/CIIP.Designer.Module.csproj b/CIIP.Designer.Module/CIIP.Designer.Module.csproj index 0e228dd..2a1a53a 100644 --- a/CIIP.Designer.Module/CIIP.Designer.Module.csproj +++ b/CIIP.Designer.Module/CIIP.Designer.Module.csproj @@ -202,6 +202,7 @@ + @@ -428,6 +429,14 @@ Model.DesignedDiffs.xafml Designer + + Model.DesignedDiffs.xafml + Designer + + + Model.DesignedDiffs.xafml + Designer + diff --git a/CIIP.Designer.Module/Model.DesignedDiffs.xafml b/CIIP.Designer.Module/Model.DesignedDiffs.xafml index d629bde..5af69ff 100644 --- a/CIIP.Designer.Module/Model.DesignedDiffs.xafml +++ b/CIIP.Designer.Module/Model.DesignedDiffs.xafml @@ -44,6 +44,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -280,8 +302,8 @@ - + @@ -292,14 +314,23 @@ + - - + + + + + + + + + + @@ -312,7 +343,9 @@ - + + + @@ -445,6 +478,9 @@ + + + @@ -473,7 +509,9 @@ - + + + diff --git a/CIIP.Designer.Module/UnusableNodes22.xml b/CIIP.Designer.Module/UnusableNodes22.xml new file mode 100644 index 0000000..14761e5 --- /dev/null +++ b/CIIP.Designer.Module/UnusableNodes22.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CIIP.Designer.Module/UnusableNodes23.xml b/CIIP.Designer.Module/UnusableNodes23.xml new file mode 100644 index 0000000..90eaf75 --- /dev/null +++ b/CIIP.Designer.Module/UnusableNodes23.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CIIP.Designer.Win/CIIP.Designer.Win.csproj b/CIIP.Designer.Win/CIIP.Designer.Win.csproj index 78b9ed9..a3984fc 100644 --- a/CIIP.Designer.Win/CIIP.Designer.Win.csproj +++ b/CIIP.Designer.Win/CIIP.Designer.Win.csproj @@ -219,11 +219,11 @@ - + Component - - CIIPDesignerWindowsFormsApplication.cs + + WinApplication.cs PreserveNewest @@ -601,8 +601,8 @@ Resources.resx True - - CIIPDesignerWindowsFormsApplication.cs + + WinApplication.cs Designer diff --git a/CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.Designer.cs b/CIIP.Designer.Win/WinApplication.Designer.cs similarity index 100% rename from CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.Designer.cs rename to CIIP.Designer.Win/WinApplication.Designer.cs diff --git a/CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.cs b/CIIP.Designer.Win/WinApplication.cs similarity index 81% rename from CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.cs rename to CIIP.Designer.Win/WinApplication.cs index 35c3582..fdb3e9e 100644 --- a/CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.cs +++ b/CIIP.Designer.Win/WinApplication.cs @@ -16,6 +16,9 @@ using CIIP.Module.BusinessObjects; using DevExpress.ExpressApp.Actions; using CIIP.Module.BusinessObjects.SYS; +using System.Windows.Forms; +using DevExpress.ExpressApp.Win.Core.ModelEditor; +using DevExpress.ExpressApp.Utils; namespace CIIP.Win { // For more typical usage scenarios, be sure to check out https://documentation.devexpress.com/eXpressAppFramework/DevExpressExpressAppWinWinApplicationMembersTopicAll.aspx @@ -25,6 +28,22 @@ public CIIPDesignerWindowsFormsApplication() InitializeComponent(); InitializeDefaults(); } + + protected override Form CreateModelEditorForm() + { + ModelEditorViewController controller = new ModelEditorViewController(this.Model, base.CreateUserModelDifferenceStore()); + ModelDifferenceStore moduleStore = base.CreateModelDifferenceStore(); + if (moduleStore != null) + { + List modulesDiffStoreInfo = new List { + new ModuleDiffStoreInfo(null, moduleStore, "Model") + }; + controller.SetModuleDiffStore(modulesDiffStoreInfo); + } + return new ModelEditor.ModelEditorForm(controller, new SettingsStorageOnModel(((IModelApplicationModelEditor)this.Model).ModelEditorSettings)); + + } + private void InitializeDefaults() { LinkNewObjectToParentImmediately = false; diff --git a/CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.resx b/CIIP.Designer.Win/WinApplication.resx similarity index 100% rename from CIIP.Designer.Win/CIIPDesignerWindowsFormsApplication.resx rename to CIIP.Designer.Win/WinApplication.resx diff --git a/CIIP.Designer.sln b/CIIP.Designer.sln index 106c859..f9afaf1 100644 --- a/CIIP.Designer.sln +++ b/CIIP.Designer.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIIP.Designer.Module.Win", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIIP.Designer.Win", "CIIP.Designer.Win\CIIP.Designer.Win.csproj", "{D05D93DF-312D-4D4E-B980-726871EC7833}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevExpress.ExpressApp.Win", "C:\Program Files (x86)\DevExpress 18.1\Components\Sources\DevExpress.ExpressApp\DevExpress.ExpressApp.Win\DevExpress.ExpressApp.Win.csproj", "{C5DBCF36-36A3-4871-8EDC-5C52408C7317}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -50,6 +52,11 @@ Global {D05D93DF-312D-4D4E-B980-726871EC7833}.EasyTest|Any CPU.Build.0 = EasyTest|Any CPU {D05D93DF-312D-4D4E-B980-726871EC7833}.Release|Any CPU.ActiveCfg = Release|Any CPU {D05D93DF-312D-4D4E-B980-726871EC7833}.Release|Any CPU.Build.0 = Release|Any CPU + {C5DBCF36-36A3-4871-8EDC-5C52408C7317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5DBCF36-36A3-4871-8EDC-5C52408C7317}.EasyTest|Any CPU.ActiveCfg = Release|Any CPU + {C5DBCF36-36A3-4871-8EDC-5C52408C7317}.EasyTest|Any CPU.Build.0 = Release|Any CPU + {C5DBCF36-36A3-4871-8EDC-5C52408C7317}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5DBCF36-36A3-4871-8EDC-5C52408C7317}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE