///-------------------------------------------------------------------------------- /// <summary>This method processes the delete Feature command.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteFeatureCommand() { FeatureEventArgs message = new FeatureEventArgs(); message.Feature = Feature; message.SolutionID = SolutionID; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <FeatureEventArgs>(MediatorMessages.Command_DeleteFeatureRequested, message); }
///-------------------------------------------------------------------------------- /// <summary>This method sends the edit item performed message to have the /// update applied.</summary> ///-------------------------------------------------------------------------------- public void SendEditFeaturePerformed() { FeatureEventArgs message = new FeatureEventArgs(); message.Feature = Feature; message.SolutionID = SolutionID; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <FeatureEventArgs>(MediatorMessages.Command_EditFeaturePerformed, message); }
///-------------------------------------------------------------------------------- /// <summary>This method applies feature deletes.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteFeaturePerformed(FeatureEventArgs data) { try { bool isItemMatch = false; if (data != null && data.Feature != null) { foreach (FeatureViewModel item in Features.ToList <FeatureViewModel>()) { if (item.Feature.FeatureID == data.Feature.FeatureID) { // remove item from tabs, if present WorkspaceEventArgs message = new WorkspaceEventArgs(); message.ItemID = item.Feature.FeatureID; Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message); // delete children for (int i = item.Items.Count - 1; i >= 0; i--) { if (item.Items[i] is EntityViewModel) { EntityViewModel child = item.Items[i] as EntityViewModel; EntityEventArgs childMessage = new EntityEventArgs(); childMessage.Entity = child.Entity; childMessage.FeatureID = item.Feature.FeatureID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ProcessDeleteEntityPerformed(childMessage); } } // delete item isItemMatch = true; Features.Remove(item); Solution.FeatureList.Remove(item.Feature); Items.Remove(item); Solution.ResetModified(true); OnUpdated(this, null); break; } } if (isItemMatch == false) { ShowIssue(DisplayValues.Issue_DeleteItemNotFound); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
void featureClass_Inserted(object sender, FeatureEventArgs e) { Action action = () => { var modificationInfo = _factory.CreateFeatureModificationInfo(Application.User.Name, ModifyState.Inserted, e.Feature.FID, e.FeatureClass.Name, e.Feature); using (var logChannel = new FeatureLogServiceClient("BasicHttpBinding_IFeatureLogService")) { logChannel.AddFeatureModifyLog(modificationInfo); } }; StartNewTask(action); }
///-------------------------------------------------------------------------------- /// <summary>This method processes the new feature command.</summary> ///-------------------------------------------------------------------------------- public void ProcessNewFeatureCommand() { FeatureEventArgs message = new FeatureEventArgs(); message.Feature = new Feature(); message.Feature.FeatureID = Guid.NewGuid(); message.Feature.SolutionID = Solution.SolutionID; message.Feature.Solution = Solution; message.SolutionID = Solution.SolutionID; message.Feature.Solution = Solution; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <FeatureEventArgs>(MediatorMessages.Command_EditFeatureRequested, message); }
void featureClass_Updated(object sender, FeatureEventArgs e) { Action action = () => { var modificationInfo = _factory.GetUpdatingModificationInfo(x => x.UserName == Application.User.Name && x.FID == e.FID); using (var logChannel = new FeatureLogServiceClient("BasicHttpBinding_IFeatureLogService")) { if (modificationInfo != null && (modificationInfo.SemanticsInfo.Any() || modificationInfo.GeometryInfo != null)) { logChannel.AddFeatureModifyLog(modificationInfo); } if (modificationInfo != null) { _factory.RemoveUpdatingModificationInfo(modificationInfo); } } }; StartNewTask(action); }
///-------------------------------------------------------------------------------- /// <summary>This method applies feature updates.</summary> ///-------------------------------------------------------------------------------- public void ProcessEditFeaturePerformed(FeatureEventArgs data) { try { bool isItemMatch = false; if (data != null && data.Feature != null) { foreach (FeatureViewModel item in Features) { if (item.Feature.FeatureID == data.Feature.FeatureID) { isItemMatch = true; item.Feature.TransformDataFromObject(data.Feature, null, false); item.OnUpdated(item, null); item.ShowInTreeView(); break; } } if (isItemMatch == false) { // add new Feature data.Feature.Solution = Solution; FeatureViewModel newItem = new FeatureViewModel(data.Feature, Solution); newItem.Updated += new EventHandler(Children_Updated); Features.Add(newItem); Solution.FeatureList.Add(newItem.Feature); Items.Add(newItem); OnUpdated(this, null); newItem.ShowInTreeView(); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
private void WindowPositioningEngineSnapIn_AfterActionTakenForFeature(object sender, FeatureEventArgs e) { if (e.Feature != null) { // /// is the feature a configuration? if so try and delete the file // if (e.Feature.GetType() == typeof(ConfigurationFeature)) // { // ConfigurationFeature cf = e.Feature as ConfigurationFeature; // if (cf != null) // { // switch(cf.ConfigurationName) // { // case SnapInHostingEngine.COMMON_CONFIGURATION: // if (e.Feature.Action == FeatureActions.ResetToDefault) // { // this.InstallMyCommonOptions(); // this.ReadMyCommonOptions(); // } // break; // // case SnapInHostingEngine.LOCALUSER_CONFIGURATION: // if (e.Feature.Action == FeatureActions.ResetToDefault) // { // this.InstallMyLocalUserOptions(); // this.ReadMyLocalUserOptions(); // } // break; // }; // } // } if (e.Feature.GetType() == typeof(WindowPositionFeature)) { WindowPositionFeature wpf = e.Feature as WindowPositionFeature; if (wpf != null) { WindowPositionListener wpl = wpf.Tag as WindowPositionListener; IWindowPositioningEngineFeaturable feature = wpl.Target as IWindowPositioningEngineFeaturable; wpl.Target.Size = feature.GetDefaultSize(); wpl.Target.Location = feature.GetDefaultLocation(); wpl.Target.WindowState = feature.GetDefaultWindowState(); } } } }
private void WindowPositioningEngineSnapIn_TakeActionForFeature(object sender, FeatureEventArgs e) { }
///-------------------------------------------------------------------------------- /// <summary>This method applies solution deletes.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteSolutionPerformed(SolutionEventArgs data) { try { bool isItemMatch = false; if (data != null && data.Solution != null) { foreach (SolutionViewModel item in Solutions.ToList <SolutionViewModel>()) { if (item.Solution.SolutionID == data.Solution.SolutionID) { // remove item from tabs, if present WorkspaceEventArgs message = new WorkspaceEventArgs(); message.ItemID = item.Solution.SolutionID; Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message); // delete children for (int i = item.Items.Count - 1; i >= 0; i--) { if (item.Items[i] is ViewViewModel) { ViewViewModel child = item.Items[i] as ViewViewModel; ViewEventArgs childMessage = new ViewEventArgs(); childMessage.View = child.View; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ViewsFolder.ProcessDeleteViewPerformed(childMessage); } if (item.Items[i] is DatabaseSourceViewModel) { DatabaseSourceViewModel child = item.Items[i] as DatabaseSourceViewModel; DatabaseSourceEventArgs childMessage = new DatabaseSourceEventArgs(); childMessage.DatabaseSource = child.DatabaseSource; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.SpecificationSourcesFolder.ProcessDeleteDatabaseSourcePerformed(childMessage); } if (item.Items[i] is XmlSourceViewModel) { XmlSourceViewModel child = item.Items[i] as XmlSourceViewModel; XmlSourceEventArgs childMessage = new XmlSourceEventArgs(); childMessage.XmlSource = child.XmlSource; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.SpecificationSourcesFolder.ProcessDeleteXmlSourcePerformed(childMessage); } if (item.Items[i] is ProjectViewModel) { ProjectViewModel child = item.Items[i] as ProjectViewModel; ProjectEventArgs childMessage = new ProjectEventArgs(); childMessage.Project = child.Project; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ProjectsFolder.ProcessDeleteProjectPerformed(childMessage); } if (item.Items[i] is FeatureViewModel) { FeatureViewModel child = item.Items[i] as FeatureViewModel; FeatureEventArgs childMessage = new FeatureEventArgs(); childMessage.Feature = child.Feature; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.FeaturesFolder.ProcessDeleteFeaturePerformed(childMessage); } if (item.Items[i] is WorkflowViewModel) { WorkflowViewModel child = item.Items[i] as WorkflowViewModel; WorkflowEventArgs childMessage = new WorkflowEventArgs(); childMessage.Workflow = child.Workflow; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.WorkflowsFolder.ProcessDeleteWorkflowPerformed(childMessage); } if (item.Items[i] is ModelViewModel) { ModelViewModel child = item.Items[i] as ModelViewModel; ModelEventArgs childMessage = new ModelEventArgs(); childMessage.Model = child.Model; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ModelsFolder.ProcessDeleteModelPerformed(childMessage); } if (item.Items[i] is DiagramViewModel) { DiagramViewModel child = item.Items[i] as DiagramViewModel; DiagramEventArgs childMessage = new DiagramEventArgs(); childMessage.Diagram = child.Diagram; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.DiagramsFolder.ProcessDeleteDiagramPerformed(childMessage); } if (item.Items[i] is AuditPropertyViewModel) { AuditPropertyViewModel child = item.Items[i] as AuditPropertyViewModel; AuditPropertyEventArgs childMessage = new AuditPropertyEventArgs(); childMessage.AuditProperty = child.AuditProperty; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.AuditPropertiesFolder.ProcessDeleteAuditPropertyPerformed(childMessage); } if (item.Items[i] is SpecTemplateViewModel) { SpecTemplateViewModel child = item.Items[i] as SpecTemplateViewModel; SpecTemplateEventArgs childMessage = new SpecTemplateEventArgs(); childMessage.SpecTemplate = child.SpecTemplate; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.SpecTemplatesFolder.ProcessDeleteSpecTemplatePerformed(childMessage); } if (item.Items[i] is CodeTemplateViewModel) { CodeTemplateViewModel child = item.Items[i] as CodeTemplateViewModel; CodeTemplateEventArgs childMessage = new CodeTemplateEventArgs(); childMessage.CodeTemplate = child.CodeTemplate; childMessage.SolutionID = item.Solution.SolutionID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.CodeTemplatesFolder.ProcessDeleteCodeTemplatePerformed(childMessage); } } // delete item isItemMatch = true; Solutions.Remove(item); Items.Remove(item); OnUpdated(this, null); break; } } if (isItemMatch == false) { ShowIssue(DisplayValues.Issue_DeleteItemNotFound); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
private void featureClass_UpdatingCanceled(object sender, FeatureEventArgs e) { _factory.RemoveUpdatingModificationInfo(x => x.UserName == Application.User.Name && x.FID == e.FID); }