public static PointViewModel CreatePoint(this DesignerViewModel designer, Vector2 position) { var newPoint = new PointViewModel(Guid.NewGuid(), position); newPoint.AddTo(designer); return(newPoint); }
public DesignerWindow() { InitializeComponent(); _viewModel = new DesignerViewModel(this); DataContext = _viewModel; }
public SolutionViewModel NewSolution(BuilderViewModel builder, DesignerViewModel designer, string solutionName, string solutionNamespace, string outputFilename, string company, string product, string version, string solutionPath, string templatePath) { builder.ProcessNewCommand(builder.SolutionsFolder); var solutionVM = designer.SelectedItem as SolutionViewModel; Assert.IsNotNull(solutionVM, "Couldn't find SolutionViewModel"); solutionVM.SolutionName = solutionName; solutionVM.Namespace = solutionNamespace; solutionVM.OutputSolutionFileName = outputFilename; solutionVM.CompanyName = company; solutionVM.ProductName = product; solutionVM.ProductVersion = version; solutionVM.SolutionPath = solutionPath; solutionVM.TemplatePath = templatePath; solutionVM.Update(); // get the solution view model from the builder and return that instead of solutionVM Assert.AreNotEqual(0, builder.SolutionsFolder.Solutions.Count, "Couldn't find SolutionViewModel from builder"); SolutionViewModel builderSolutionVM = builder.SolutionsFolder.Solutions[0]; builderSolutionVM.SolutionPath = solutionPath; SaveSolution(builderSolutionVM); return(builderSolutionVM); }
public static void Move( this DesignerViewModel designer, ComponentViewModel component, Vector2 delta, List <ComponentViewModel> movingComponents, CancellationTokenSource cancellationToken) { var unselectedItems = designer.ConnectedComponents.Except(movingComponents); component.Move(designer, delta); if (component.CollidesWith(CollisionType.Margin, new Vector2(0, 0), new Vector2(designer.Width, designer.Height))) { component.Move(designer, -delta); cancellationToken.Cancel(); return; } var collidingItems = unselectedItems .Where(i => i.CollidesWith(CollisionType.Margin, component.Points.ToArray())).ToList(); movingComponents.AddRange(collidingItems); foreach (var collidingItem in collidingItems) { Move(designer, collidingItem, delta, movingComponents, cancellationToken); } if (cancellationToken.IsCancellationRequested) { component.Move(designer, -delta); } }
public static ConnectedComponentViewModel CreateConnectedComponent(this DesignerViewModel designer, string name, Vector2 position, Vector2 size) { var connectedComponent = new ConnectedComponentViewModel(Guid.NewGuid(), name, position, size); connectedComponent.AddTo(designer); return(connectedComponent); }
public static ConnectionViewModel CreateConnection(this DesignerViewModel designer, ConnectionPointViewModel point1, ConnectionPointViewModel point2) { var newConnection = new ConnectionViewModel(designer, point1, point2); newConnection.AddTo(designer); return(newConnection); }
public static ConnectionPointViewModel CreateConnectionPoint(this DesignerViewModel designer, ConnectedComponentViewModel connectedComponent) { var newConnectionPoint = new ConnectionPointViewModel(Guid.NewGuid(), connectedComponent); newConnectionPoint.AddTo(designer); return(newConnectionPoint); }
public IActionResult Create(DesignerViewModel model) { if (!ModelState.IsValid) { return(new BadRequestResult()); } return(View()); }
public ActionResult Index(DesignerViewModel model) { if (!CaptchaImage.isValid(model.captcha)) { ViewBag.Error = "عبارت امنیتی به درستی وارد نشده است."; return(BaseView(model)); } if (string.IsNullOrEmpty(model.fullName)) { ViewBag.Error = "عبارت امنیتی به درستی وارد نشده است."; return(BaseView(model)); } if (string.IsNullOrEmpty(model.mobileNumber) && model.mobileNumber.Length < 6) { ViewBag.Error = "تلفن تماس به درستی وارد نشده است."; return(BaseView(model)); } if (string.IsNullOrEmpty(model.message)) { ViewBag.Error = "وارد کردن متن پیام اجباری است."; return(BaseView(model)); } UserPrincipal currentUser = null; if (Request.IsAuthenticated) { currentUser = GetAuthenticatedUser(); } var message = new MessageBox() { FullName = model.fullName.ToStandardPersian(), MobileNumber = model.mobileNumber, Email = model.email, Text = model.message.ToStandardPersian(), StatusId = MessageBoxStatus.New.Id, MessageTypeId = 1, CreateUserId = currentUser?.id, ModifyUserId = currentUser?.id, CreateDate = GetDatetime(), ModifyDate = GetDatetime(), CreateIp = GetCurrentIp(), ModifyIp = GetCurrentIp(), }; _context.MessageBox.Add(message); _context.SaveChanges(); ViewBag.Success = "پیام شما با موفقیت ثبت شد."; return(BaseView()); }
public void ProjectChanged(Workspace project) { _designerViewModel = null; _workspaceService = null; DiagramDrawer = null; if (project.CurrentGraph != null) { LoadDiagram(project.CurrentGraph); } else { } }
public void NewDatabaseSource(BuilderViewModel builder, DesignerViewModel designer, SolutionViewModel solutionVM, string serverName, string databaseName, string templatePath) { solutionVM.SpecificationSourcesFolder.ProcessNewDatabaseSourceCommand(); var newDBSource = new DatabaseSourceViewModel(); var dbSource = designer.SelectedItem as DatabaseSourceViewModel ?? newDBSource; Assert.AreNotSame(dbSource, newDBSource, "Couldn't find database source"); dbSource.DatabaseTypeCode = (int)DatabaseTypeCode.SqlServer; dbSource.SourceDbServerName = serverName; dbSource.SourceDbName = databaseName; dbSource.TemplatePath = templatePath; Assert.IsTrue(File.Exists(dbSource.TemplatePath), "Solution template not found!"); dbSource.Order = 1; dbSource.Update(); solutionVM.Update(); solutionVM.SpecTemplatesFolder.LoadSpecTemplates(solutionVM.Solution); SaveSolution(solutionVM); }
protected async override Task OnInitializedAsync() { Designer = new DesignerViewModel(200, 100); var item1 = Designer.CreateConnectedComponent("State 1", new Vector2(10, 8), new Vector2(15, 5)); var item2 = Designer.CreateConnectedComponent("State 2", new Vector2(10, 20), new Vector2(15, 5)); var item3 = Designer.CreateConnectedComponent("State 3", new Vector2(40, 40), new Vector2(15, 5)); var item4 = Designer.CreateConnectedComponent("State 4", new Vector2(40, 60), new Vector2(15, 5)); var item5 = Designer.CreateConnectedComponent("State 5", new Vector2(40, 70), new Vector2(15, 5)); var item6 = Designer.CreateConnectedComponent("State 6", new Vector2(70, 70), new Vector2(15, 5)); var connectionPoint1 = Designer.CreateConnectionPoint(item1); var connectionPoint2 = Designer.CreateConnectionPoint(item2); var connectionPoint3 = Designer.CreateConnectionPoint(item3); var connectionPoint4 = Designer.CreateConnectionPoint(item4); var connection = connectionPoint1.Connect(Designer, connectionPoint2); var connection2 = connectionPoint1.Connect(Designer, connectionPoint3); await base.OnInitializedAsync(); }
public ActionResult Index(DesignerKey designerKey, int p = 1) { // Modèle. var pagedList = _patternService.ListPreviews(designerKey, p, PreviewsPageSize_); if (pagedList == null) { return(new HttpNotFoundResult()); } var designer = GetDesigner_(designerKey, AllCategoryKey); var model = new DesignerViewModel { Designer = designer, IsFirstPage = pagedList.IsFirstPage, IsLastPage = pagedList.IsLastPage, PageCount = pagedList.PageCount, PageIndex = pagedList.PageIndex, Previews = from _ in pagedList.Previews select PatternViewItem.Of(_, designer.DisplayName) }; // Ontologie. Ontology.Title = String.Format( CultureInfo.CurrentUICulture, Strings.Designer_Index_TitleFormat, model.Designer.DisplayName); Ontology.Description = String.Format( CultureInfo.CurrentUICulture, Strings.Designer_Index_DescriptionFormat, model.Designer.DisplayName); Ontology.Relationships.CanonicalUrl = SiteMap.Designer(designerKey, p); var image = model.Previews.First(); SetOpenGraphImage_(designerKey, image.Reference, image.Variant); // LayoutViewModel. LayoutViewModel.AddAlternateUrls(Environment.Language, _ => _.Designer(designerKey, p)); LayoutViewModel.DesignerMenuCssClass = ViewUtility.DesignerClass(designerKey); return(View(Constants.ViewName.Designer.Index, model)); }
public ProjectViewModel CreateNewProject(SolutionViewModel solutionVM, DesignerViewModel solutionDesigner, string projectName, string projectNamespace, string dbServerName, string dbName, string templateFilename, string tags) { solutionVM.ProjectsFolder.ProcessNewProjectCommand(); var newProject = new ProjectViewModel(); var project = solutionDesigner.SelectedItem as ProjectViewModel ?? newProject; Assert.AreNotSame(project, newProject, "Couldn't find project"); project.Name = projectName; project.Namespace = projectNamespace; project.DbServerName = dbServerName; project.DbName = dbName; project.TemplatePath = templateFilename; project.Tags = tags; Assert.IsTrue(project.IsValid, "Project has errors!"); project.Update(); solutionVM.Update(); SaveSolution(solutionVM); solutionVM.ProjectsFolder.LoadProjects(solutionVM.Solution); return(project); }
public static List <Vector2> GetPath(this DesignerViewModel designer, Vector2 startPoint, Vector2 endPoint, INeighbourFinder neighbourFinder = null) { var points = new List <Vector2>(); try { var mapBuilder = new MapBuilder(); foreach (var item in designer.ConnectedComponents.ToList()) { mapBuilder.AddObstacle(item.Position - Vector2.One, item.Size + (Vector2.One * 2)); } mapBuilder.SetStart(startPoint); mapBuilder.SetEnd(endPoint); mapBuilder.SetDimensions(designer.Width, designer.Height); var mapResult = mapBuilder.Build(); if (!mapResult.Success) { throw new Exception(mapResult.Message); } var pathFinder = new PathFinder.Algorithm.PathFinder(mapResult.Map, neighbourFinder ?? DefaultNeighbourFinder.Straight(0.5f)); points.AddRange(pathFinder.FindPath()); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(points); }
public DesignerView(DesignerViewModel viewModel) { this.DataContext = viewModel; InitializeComponent(); }
public static void CreateDesigner() { if (_designer == null) { _designer = new DesignerViewModel(); } }
protected override void DoExecute(string playground) { TestLocaldb.Execute("sqllocaldb.exe", "stop v11.0"); TestLocaldb.Execute("sqllocaldb.exe", "start v11.0"); var dbName = "Northwind-" + Guid.NewGuid(); mDatabaseFileName = Path.Combine(playground, dbName + ".mdf"); mDatabaseLogFileName = Path.Combine(playground, dbName + "_log.ldf"); mTemplatesPath = Path.Combine(playground, "Templates"); // setup database NorthwindUtility.Create(dbName, mDatabaseFileName, mDatabaseLogFileName); var gettingStartedPath = Path.Combine(playground, "GettingStartedPack"); Directory.CreateDirectory(gettingStartedPath); // unpack sapmle pack to <Playground>\GettingStartedPack SamplePacksUtility.ExtractGettingStartedTo(gettingStartedPath); var solutionDesigner = new DesignerViewModel(); var builder = new BuilderViewModel(); var solutionVM = NewSolution(builder, solutionDesigner, "TestSolution", "TestNamespace", "TestSolution.sln", "TestCompany", "TestProduct", "0.1", Path.Combine(playground, "TestSolution.xml"), Path.Combine(playground, Path.Combine(playground, "NorthwindSolutionFile.mpt"))); solutionVM.Solution.OutputRequested += SolutionOnOutputRequested; #region create solution template if (solutionVM.CodeTemplatesFolder == null) { throw new InvalidOperationException("Couldn't find CodeTemplatesFolder"); } solutionVM.CodeTemplatesFolder.ProcessNewCodeTemplateCommand(); var newSolTpl = new CodeTemplateViewModel(); var solutionTemplate = solutionDesigner.SelectedItem as CodeTemplateViewModel ?? newSolTpl; Assert.AreNotSame(solutionTemplate, newSolTpl, "Couldn't find template!"); solutionTemplate.TemplateName = "NorthwindSolutionFile"; solutionTemplate.IsTopLevelTemplate = true; solutionTemplate.TemplateOutput = "<%%=Solution.SolutionDirectory%%><%%-\\%%><%%=Solution.OutputSolutionFileName%%>\r\n" + "<%%:\r\n" + " update(Path)\r\n" + "%%>"; solutionTemplate.TemplateContent = "<%%-Entities:\r\n" + "%%><%%:\r\n" + "foreach(Entity)\r\n" + "{\r\n" + " <%%- - %%><%%=Feature.FeatureName%%><%%--%%><%%=Entity.EntityName%%><%%-\r\n" + "%%>\r\n" + "}%%>"; solutionTemplate.Update(); solutionVM.TemplatePath = Path.Combine(playground, Path.Combine(playground, "NorthwindSolutionFile.mpt")); SaveSolution(solutionVM); solutionVM.CodeTemplatesFolder.LoadTemplates(solutionVM.Solution); #endregion create solution template NewDatabaseSource(builder, solutionDesigner, solutionVM, @"(localdb)\v11.0", mDatabaseFileName, Path.Combine(gettingStartedPath, @"GettingStarted\Specifications\SQLServer\MDLSqlModel.mps")); BuildSolution(solutionVM); UpdateOutputSolution(solutionVM); var expectedOutput = "Entities:\r\n" + " - Domain-Category\r\n" + " - Domain-CustomerCustomerDemo\r\n" + " - Domain-CustomerDemographic\r\n" + " - Domain-Customer\r\n" + " - Domain-Employee\r\n" + " - Domain-EmployeeTerritory\r\n" + " - Domain-OrderDetail\r\n" + " - Domain-Order\r\n" + " - Domain-Product\r\n" + " - Domain-Region\r\n" + " - Domain-Shipper\r\n" + " - Domain-Supplier\r\n" + " - Domain-Territory\r\n"; var output = File.ReadAllText(Path.Combine(playground, "TestSolution.sln")); Assert.AreEqual(expectedOutput, output); }
protected override void DoExecute(string playground) { TestLocaldb.Execute("sqllocaldb.exe", "stop v11.0"); TestLocaldb.Execute("sqllocaldb.exe", "start v11.0"); var dbName = "Northwind-" + Guid.NewGuid(); mDatabaseFileName = Path.Combine(playground, dbName + ".mdf"); mDatabaseLogFileName = Path.Combine(playground, dbName + "_log.ldf"); mTemplatesPath = Path.Combine(playground, "Templates"); // setup database NorthwindUtility.Create(dbName, mDatabaseFileName, mDatabaseLogFileName); var gettingStartedPath = Path.Combine(playground, "Pack"); Directory.CreateDirectory(gettingStartedPath); // unpack sapmle pack to <Playground>\GettingStartedPack SamplePacksUtility.ExtractSampleCSharpSQLServerXmlTo(gettingStartedPath); var templateBaseDir = Path.Combine(playground, "Pack", "Sample_CSharp_SQLServer_MySQL_Xml", "Templates", "CSharp_VS2012"); var solutionDesigner = new DesignerViewModel(); var builder = new BuilderViewModel(); var solutionVM = NewSolution(builder, solutionDesigner, "TestSolution", "TestNamespace", "TestSolution.sln", "TestCompany", "TestProduct", "0.1", Path.Combine(playground, "TestSolution.xml"), Path.Combine(templateBaseDir, "SolutionFile.mpt")); NewDatabaseSource(builder, solutionDesigner, solutionVM, @"(localdb)\v11.0", mDatabaseFileName, Path.Combine(gettingStartedPath, @"Sample_CSharp_SQLServer_MySQL_Xml\Specifications\SQLServer\MDLSqlModel.mps")); Assert.AreEqual(1, solutionVM.Solution.DatabaseSourceList.Count); var efbllProj = CreateNewProject(solutionVM, solutionDesigner, "EFBLL", "EFBLL", null, null, Path.Combine(templateBaseDir, "Project", "EntityFramework.mpt"), "BLL"); Assert.AreEqual(1, solutionVM.Solution.DatabaseSourceList.Count); Assert.AreEqual(1, solutionVM.Solution.ProjectList.Count); var efdsProj = CreateNewProject(solutionVM, solutionDesigner, "EFDataServices", "EFDataServices", null, null, Path.Combine(templateBaseDir, "Project", "EFDataServices.mpt"), "DS"); ReferenceProjects(solutionVM, efdsProj, efbllProj.ProjectID); Assert.AreEqual(1, solutionVM.Solution.DatabaseSourceList.Count); Assert.AreEqual(2, solutionVM.Solution.ProjectList.Count); var vmProj = CreateNewProject(solutionVM, solutionDesigner, "ViewModels", "ViewModels", null, null, Path.Combine(templateBaseDir, "Project", "VMEFDS.mpt"), "VM"); ReferenceProjects(solutionVM, vmProj, efbllProj.ProjectID); Assert.AreEqual(1, solutionVM.Solution.DatabaseSourceList.Count); Assert.AreEqual(3, solutionVM.Solution.ProjectList.Count); var shellProj = CreateNewProject(solutionVM, solutionDesigner, "Shell", "Shell", null, null, Path.Combine(templateBaseDir, "Project", "WPFUI.mpt"), null); ReferenceProjects(solutionVM, shellProj, vmProj.ProjectID); Assert.AreEqual(1, solutionVM.Solution.DatabaseSourceList.Count); Assert.AreEqual(4, solutionVM.Solution.ProjectList.Count); UpdateOutputSolution(solutionVM); Assert.IsTrue(File.Exists(Path.Combine(playground, "TestSolution.sln")), "Solution file has not been created!"); Console.WriteLine("Calling MSBuild now"); MSBuildUtility.Execute(Path.Combine(playground, "TestSolution.sln"), multiThreaded: true); Console.WriteLine("TEst finished for now"); }
public DesignerView() { InitializeComponent(); DataContext = new DesignerViewModel(); LoadGrid(); }
public override void RemoveFrom(DesignerViewModel designer) { designer.Selection = null; designer.Remove(this); }
public override void AddTo(DesignerViewModel designer) { designer.Selection = this; designer.Add(this); }
/* This tests creates a simple solution containing 1 feature and 1 entity (forward-engineered). There's 1 * solution template, which iterates the entities and outputs a simple text file containing - featurename-entityname */ protected override void DoExecute(string playground) { var solutionDesigner = new DesignerViewModel(); var builder = new BuilderViewModel(); builder.ProcessNewCommand(builder.SolutionsFolder); var solutionVM = solutionDesigner.SelectedItem as SolutionViewModel; if (solutionVM == null) { throw new InvalidOperationException("Couldn't find SolutionViewModel"); } solutionVM.SolutionName = "TestSolution"; solutionVM.Namespace = "TestNamespace"; solutionVM.OutputSolutionFileName = "TestSolution.sln"; solutionVM.CompanyName = "TestCompany"; solutionVM.ProductName = "TestProduct"; solutionVM.ProductVersion = "0.1"; solutionVM.SolutionPath = Path.Combine(playground, "TestSolution.xml"); solutionVM.TemplatePath = Path.Combine(playground, "SolutionFile.mpt"); solutionVM.Update(); var solution = solutionVM.Solution; if (solution == null) { throw new InvalidOperationException("Couldn't find Solution!"); } solutionVM.UpdateCommand.Execute(null); solutionVM.SaveSolution(); solutionVM.LoadSolution(solution, true); //solutionVM.Refresh(true, 3); if (solutionVM.CodeTemplatesFolder == null) { throw new InvalidOperationException("Couldn't find CodeTemplatesFolder"); } solutionVM.CodeTemplatesFolder.ProcessNewCodeTemplateCommand(); var newSolTpl = new CodeTemplateViewModel(); var solutionTemplate = solutionDesigner.SelectedItem as CodeTemplateViewModel ?? newSolTpl; Assert.AreNotSame(solutionTemplate, newSolTpl, "Couldn't find template!"); solutionTemplate.TemplateName = "SolutionFile"; solutionTemplate.IsTopLevelTemplate = true; solutionTemplate.TemplateOutput = "<%%=Solution.SolutionDirectory%%><%%-\\%%><%%=Solution.OutputSolutionFileName%%>\r\n" + "<%%:\r\n" + " update(Path)\r\n" + "%%>"; solutionTemplate.TemplateContent = "<%%-Entities:\r\n" + "%%><%%:\r\n" + "foreach(Entity)\r\n" + "{\r\n" + " <%%- - %%><%%=Feature.FeatureName%%><%%--%%><%%=Entity.EntityName%%><%%-\r\n" + "%%>\r\n" + "}%%>"; solutionTemplate.Update(); solutionVM.FeaturesFolder.ProcessNewFeatureCommand(); var newFeature = new FeatureViewModel(); var feature = solutionDesigner.SelectedItem as FeatureViewModel ?? newFeature; Assert.AreNotSame(feature, newFeature, "Couldn't find feature!"); feature.Solution = solution; feature.FeatureName = "TestFeature"; feature.UpdateCommand.Execute(null); solutionDesigner.ShowItemInTreeView(feature); feature.ProcessNewEntityCommand(); var newEntity = new EntityViewModel(); var entity = solutionDesigner.SelectedItem as EntityViewModel ?? newEntity; Assert.AreNotSame(entity, newEntity, "Couldn't find entity!"); entity.EntityName = "TestEntity"; entity.EntityTypeCode = 3; // primary entity.IdentifierTypeCode = 1; // generated entity.Update(); entity.LoadEntity(entity.Entity); entity.PropertiesFolder.ProcessNewPropertyCommand(); var newProperty = new PropertyViewModel(); var property = solutionDesigner.SelectedItem as PropertyViewModel ?? newProperty; Assert.AreNotSame(property, newProperty, "Couldn't find Property!"); solutionVM.UpdateCommand.Execute(null); solutionVM.SaveSolution(); using (var resetEvent = new AutoResetEvent(false)) { var updated = new EventHandler((sender, args) => { Console.WriteLine("Solution updated!"); resetEvent.Set(); }); solutionVM.Updated += updated; solutionVM.UpdateOutputSolution(); Assert.IsTrue(resetEvent.WaitOne(EventWaitTimeout), "Timeout waiting for solution update!"); solutionVM.Updated -= updated; } var expectedOutput = "Entities:\r\n" + " - TestFeature-TestEntity\r\n"; var output = File.ReadAllText(Path.Combine(playground, "TestSolution.sln")); Assert.AreEqual(expectedOutput, output); }
public bool CreateDesignClass() { if (SelectedNameSpace == null) { MessageBox.Show("请选择命名空间!", "提示"); return(false); } switch (MainTypeName) { case "EntityClass": DesignClass.MainType = 0; DesignClass.MainTypeImage = ApplicationDesignCache.EntityClassImage; //添加主键属性 designProperty = new DesignProperty(); designProperty.PropertyID = -1; designProperty.PropertyName = DesignClass.ClassName + "ID"; if (!string.IsNullOrEmpty(DesignClass.DisplayName)) { designProperty.DisplayName = DesignClass.DisplayName + "ID"; } designProperty.Description = DesignClass.DisplayName + "主键"; designProperty.IsNullable = false; designProperty.IsPersistable = true; designProperty.IsPrimarykey = true; designProperty.DataType = "I32"; designProperty.SqlType = "int"; designProperty.CollectionType = "None"; designProperty.RelationType = "无"; designProperty.State = "added"; DesignClass.Properties.Add(designProperty); //添加名称属性 designProperty = new DesignProperty(); designProperty.PropertyID = -1; designProperty.PropertyName = DesignClass.ClassName + "Name"; if (!string.IsNullOrEmpty(DesignClass.DisplayName)) { designProperty.DisplayName = DesignClass.DisplayName + "名称"; } designProperty.Description = DesignClass.DisplayName + "名称"; designProperty.IsNullable = true; designProperty.IsPersistable = true; designProperty.DataType = "String"; designProperty.SqlType = "nvarchar"; designProperty.DbFieldLength = 50; designProperty.CollectionType = "None"; designProperty.RelationType = "无"; designProperty.State = "added"; DesignInfo UIDesignInfo = new DesignInfo(); UIDesignInfo.GridColAlign = "left"; UIDesignInfo.GridColSorting = "str"; UIDesignInfo.GridColType = "ro"; UIDesignInfo.GridWidth = 0; UIDesignInfo.InputType = "TextBox"; UIDesignInfo.ValidateType = "None"; UIDesignInfo.QueryForm = "Fuzzy"; UIDesignInfo.ReferType = ""; designProperty.UIDesignInfo = UIDesignInfo; DesignClass.Properties.Add(designProperty); break; case "RelationClass": DesignClass.MainType = 2; DesignClass.MainTypeImage = ApplicationDesignCache.RelationClassImage; //添加关联属性 DesignClass.Properties.Add(DesignClass.RelationPropertyA); DesignClass.Properties.Add(DesignClass.RelationPropertyB); if (string.IsNullOrEmpty(DesignClass.RelationPropertyA.StructName)) { MessageBox.Show("关联属性一没有选择关联类型请检查!", "提示"); return(false); } if (string.IsNullOrEmpty(DesignClass.RelationPropertyB.StructName)) { MessageBox.Show("关联属性二没有选择关联类型请检查!", "提示"); return(false); } break; case "ControlClass": DesignClass.MainType = 1; DesignClass.MainTypeImage = ApplicationDesignCache.ControlClassImage; DesignClass.BaseClassName = null; DesignClass.IsPersistable = false; break; default: break; } DesignClass.MainTypeName = MainTypeName; DesignClass.NamespaceID = SelectedNameSpace.NamespaceID; DesignClass.ModuleID = DesignerViewModel.SelectedTreeNode.TreeNodeID; DesignClass.ClassID = -1; DesignerViewModel.CurrentDesignClass = DesignClass; DesignerViewModel.AddNewDesignClass(); DesignerViewModel.SaveClassCommand.RaiseCanExecuteChanged(); return(true); }
public static void ClearDesigner() { if (_designer == null) { return; } _designer.Cleanup(); _designer = null; }
public DesignerPanelViewModel() { DesignerViewModel = new DesignerViewModel(); Messenger.Default.Register <IBaseChoosableItem>(this, HandleBaseItemSelection); }