private void AddElectricalComponentProperty(NodeView nodeView) { AddEditEquipmentPropertyDialog dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.ElectricalProperty); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value && dialog.ComponentProperty!=null) { NodeView child = new NodeView(nodeView) { Id = dialog.ComponentProperty.Id, Name = dialog.ComponentProperty.Name, Description = dialog.ComponentProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ElectricalProperty, HasChildren = false, SortField = dialog.ComponentProperty.Name }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } }; }
public ElectricalEquipmentConfigControl(Tab tab) { if (DesignerProperties.IsInDesignTool) { return; } InitializeComponent(); mTab = tab; ConfigurationTreeView.LoadOnDemand += ConfigurationTreeViewLoadOnDemand; ObservableCollection<NodeView> configurationRootNode = new ObservableCollection<NodeView>(); NodeView electricalTypeNode = new NodeView(null) { Name = "Electrical Equipment Types", HasChildren = true, Type = NodeType.ElectricalTypesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView electricalComponentTypesNode = new NodeView(null) { Name = "Electrical Equipment Component Types", HasChildren = true, Type = NodeType.ElectricalComponentTypes, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView standardComponentPropertiesNode = new NodeView(null) { Name = "Electrical Equipment Properties", HasChildren = true, Type = NodeType.ElectricalProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView reportsNode = new NodeView(null) { Name = "Reports", HasChildren = true, Type = NodeType.ReportsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView manufacturersNode = new NodeView(null) { Name = "Manufacturers", HasChildren = true, Type = NodeType.ManufacturersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; configurationRootNode.Add(electricalTypeNode); configurationRootNode.Add(electricalComponentTypesNode); configurationRootNode.Add(standardComponentPropertiesNode); configurationRootNode.Add(reportsNode); configurationRootNode.Add(manufacturersNode); ConfigurationTreeView.ItemsSource = configurationRootNode; }
private void AddExistingMobilePlantComponentProperty(NodeView nodeView) { int electricalEquipmentComponentTypeId = nodeView.Id; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetMobilePlantComponentTypeCompleted += (s, e) => { AddEditExistingMobilePlantComponentPropertyDialog dialog = new AddEditExistingMobilePlantComponentPropertyDialog(e.Result); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddMobilePlantComponentTypePropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { MobilePlantComponentTypeProperty pcpt = eventArgs.Result; if (pcpt != null) { NodeView child = new NodeView(nodeView) { Id = pcpt.Id, Name = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Name, Description = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.MobilePlantComponentTypeProperty, HasChildren = false, SortField = dialog.MobilePlantComponentTypeProperty.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.AddMobilePlantComponentTypePropertyCompleted -= addCompleted; }; cmsWebServiceClient.AddMobilePlantComponentTypePropertyCompleted += addCompleted; MobilePlantComponentTypeProperty electricalEquipmentComponentTypeProperty = new MobilePlantComponentTypeProperty { MobilePlantComponentTypeId = electricalEquipmentComponentTypeId, MobilePlantPropertyId = dialog.MobilePlantComponentTypeProperty.MobilePlantPropertyId, Ordinal = dialog.MobilePlantComponentTypeProperty.Ordinal }; cmsWebServiceClient.AddMobilePlantComponentTypePropertyAsync(electricalEquipmentComponentTypeProperty); } }; }; cmsWebServiceClient.GetMobilePlantComponentTypeAsync(electricalEquipmentComponentTypeId); }
public DocumentConfigControl(Tab tab) { if (DesignerProperties.IsInDesignTool){return;} // Required to initialize variables InitializeComponent(); mTab = tab; ConfigurationTreeView.LoadOnDemand += ConfigurationTreeView_LoadOnDemand; RadTreeViewItem treeViewItem = ConfigurationTreeView.SelectedContainer; ObservableCollection<NodeView> configurationRootNode = new ObservableCollection<NodeView>(); NodeView authorsNode = new NodeView(null) { Name = "Authors", HasChildren = true, Type = NodeType.DocumentAuthorsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView disciplinesNode = new NodeView(null) { Name = "Disciplines", HasChildren = true, Type = NodeType.DocumentDisciplinesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView locationsNode = new NodeView(null) { Name = "Locations", HasChildren = true, Type = NodeType.DocumentLocationsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView purchaseOrdersNode = new NodeView(null) { Name = "Purchase Orders", HasChildren = true, Type = NodeType.DocumentPurchaseOrdersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView reportsNode = new NodeView(null) { Name = "Reports", HasChildren = true, Type = NodeType.ReportsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView typesNode = new NodeView(null) { Name = "Types", HasChildren = true, Type = NodeType.DocumentTypesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; //alpha configurationRootNode.Add(authorsNode); configurationRootNode.Add(disciplinesNode); configurationRootNode.Add(locationsNode); configurationRootNode.Add(purchaseOrdersNode); configurationRootNode.Add(reportsNode); configurationRootNode.Add(typesNode); ConfigurationTreeView.ItemsSource = configurationRootNode; }
private void AddNewDocumentAuthor(NodeView nodeView) { AddEditDocumentAuthorDialog dialog = new AddEditDocumentAuthorDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { NodeView child = new NodeView(nodeView) { Id = dialog.DocumentAuthor.Id, Name = dialog.DocumentAuthor.Name, Description = dialog.DocumentAuthor.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.DocumentAuthorNode, SortField = dialog.DocumentAuthor.Ordinal.ToString(), HasChildren = false }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } }; }
public MobilePlantConfigControl(Tab tab) { if (DesignerProperties.IsInDesignTool) { return; } // Required to initialize variables InitializeComponent(); mTab = tab; ConfigurationTreeView.LoadOnDemand += ConfigurationTreeView_LoadOnDemand; RadTreeViewItem treeViewItem = ConfigurationTreeView.SelectedContainer; ObservableCollection<NodeView> configurationRootNode = new ObservableCollection<NodeView>(); NodeView mobilePlantTypesNode = new NodeView(null) { Name = "Mobile Plant Types", HasChildren = true, Type = NodeType.MobilePlantTypesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView mobilePlantComponentTypesNode = new NodeView(null) { Name = "Mobile Plant Component Types", HasChildren = true, Type = NodeType.MobilePlantComponentTypes, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView standardComponentPropertiesNode = new NodeView(null) { Name = "Mobile Plant Properties", HasChildren = true, Type = NodeType.MobilePropertiesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView mobilePlantHirersNode = new NodeView(null) { Name = "Mobile Plant MobileHirers", HasChildren = true, Type = NodeType.MobileHirersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView mobilePlantOwnersNode = new NodeView(null) { Name = "Mobile Plant Owners", HasChildren = true, Type = NodeType.MobileOwnersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView reportsNode = new NodeView(null) { Name = "Reports", HasChildren = true, Type = NodeType.ReportsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView manufacturersNode = new NodeView(null) { Name = "Manufacturers", HasChildren = true, Type = NodeType.ManufacturersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; configurationRootNode.Add(mobilePlantTypesNode); configurationRootNode.Add(mobilePlantComponentTypesNode); configurationRootNode.Add(standardComponentPropertiesNode); configurationRootNode.Add(mobilePlantHirersNode); configurationRootNode.Add(mobilePlantOwnersNode); configurationRootNode.Add(reportsNode); configurationRootNode.Add(manufacturersNode); ConfigurationTreeView.ItemsSource = configurationRootNode; }
public InstrumentConfigControl(Tab tab) { if (DesignerProperties.IsInDesignTool) { return; } InitializeComponent(); mTab = tab; ConfigurationTreeView.LoadOnDemand += ConfigurationTreeViewLoadOnDemand; ObservableCollection<NodeView> configurationRootNode = new ObservableCollection<NodeView>(); NodeView instrumentTypesNode = new NodeView(null) { Name = "Instrument Types ", HasChildren = true, Type = NodeType.InstrumentTypesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView instrumentComponentTypesNode = new NodeView(null) { Name = "Instrument Component Types", HasChildren = true, Type = NodeType.InstrumentComponentTypes, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView instrumentPropertiesNode = new NodeView(null) { Name = "Instrument Properties", HasChildren = true, Type = NodeType.InstrumentProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView calibrationComponentTypesNode = new NodeView(null) { Name = "Calibration Component Types", HasChildren = true, Type = NodeType.CalibrationComponentTypes, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView calibrationPropertiesNode = new NodeView(null) { Name = "Calibration Properties", HasChildren = true, Type = NodeType.CalibrationPropertiesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView reportsNode = new NodeView(null) { Name = "Reports", HasChildren = true, Type = NodeType.ReportsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView manufacturersNode = new NodeView(null) { Name = "Manufacturers", HasChildren = true, Type = NodeType.ManufacturersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView engineeringUnits = new NodeView(null) { Name = "Calibration Engineering Units", HasChildren = true, Type = NodeType.EngineeeringUnitsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; configurationRootNode.Add(instrumentTypesNode); configurationRootNode.Add(instrumentComponentTypesNode); configurationRootNode.Add(instrumentPropertiesNode); configurationRootNode.Add(calibrationComponentTypesNode); configurationRootNode.Add(calibrationPropertiesNode); configurationRootNode.Add(reportsNode); configurationRootNode.Add(manufacturersNode); configurationRootNode.Add(engineeringUnits); ConfigurationTreeView.ItemsSource = configurationRootNode; }
private void AddCalibrationComponentType(NodeView nodeView) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); AddEditCalibrationComponentTypeDialog dialog = new AddEditCalibrationComponentTypeDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddCalibrationComponentTypeCompletedEventArgs> addCompleted = null; addCompleted = (s2, e2) => { if (e2.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e2.Result.ServerErrorMessages)); errorDialog.Show(); } else { CalibrationComponentType calibrationComponentType = e2.Result.EntityResult; if (calibrationComponentType != null) { NodeView child = new NodeView(nodeView) { Id = calibrationComponentType.Id, Name = dialog.ComponentType.Name, Description = dialog.ComponentType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.CalibrationComponentType, HasChildren = true, SortField = dialog.ComponentType.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.AddCalibrationComponentTypeCompleted -= addCompleted; } }; cmsWebServiceClient.AddCalibrationComponentTypeCompleted += addCompleted; cmsWebServiceClient.AddCalibrationComponentTypeAsync(dialog.ComponentType); } }; }
private void AddExistingPipeProperty(NodeView nodeView) { AddExistingPipeComponentProperty dialog = new AddExistingPipeComponentProperty(nodeView.Id); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddPipeComponentTypePropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { PipeComponentTypeProperty pcpt = eventArgs.Result; if (pcpt != null) { NodeView child = new NodeView(nodeView) { Id = pcpt.Id, Name = dialog.ComponentTypeProperty.PipeProperty.Name, Description = dialog.ComponentTypeProperty.PipeProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.PipeComponentTypeProperty, HasChildren = false, SortField = pcpt.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(true); } } mCmsWebServiceClient.AddPipeComponentTypePropertyCompleted -= addCompleted; }; mCmsWebServiceClient.AddPipeComponentTypePropertyCompleted += addCompleted; mCmsWebServiceClient.AddPipeComponentTypePropertyAsync(dialog.ComponentTypeProperty); } }; }
public PipeConfigControl(Tab tab) { if (DesignerProperties.IsInDesignTool) { return; } mCmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); // Required to initialize variables InitializeComponent(); mTab = tab; ConfigurationTreeView.LoadOnDemand += new EventHandler<Telerik.Windows.RadRoutedEventArgs>(ConfigurationTreeView_LoadOnDemand); RadTreeViewItem treeViewItem = ConfigurationTreeView.SelectedContainer; ObservableCollection<NodeView> configurationRootNode = new ObservableCollection<NodeView>(); NodeView pipePropertiesNode = new NodeView(null) { Name = "Pipe Properties", HasChildren = true, Type = NodeType.PipePropertiesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView pipingComponentTypesNode = new NodeView(null) { Name = "Pipe Component Types", HasChildren = true, Type = NodeType.PipingComponentTypesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView standardComponentPropertiesNode = new NodeView(null) { Name = "Pipe Component Properties", HasChildren = true, Type = NodeType.StandardComponentProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView reportsNode = new NodeView(null) { Name = "Reports", HasChildren = true, Type = NodeType.ReportsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; //Nodes under Pipe Properties NodeView pipeClassNode = new NodeView(pipePropertiesNode) { Name = "Pipe Class", HasChildren = true, Type = NodeType.PipeClassRootNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView pipeSizeNode = new NodeView(pipePropertiesNode) { Name = "Pipe Size", HasChildren = true, Type = NodeType.PipeSizeRootNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView pipeFluidCodeNode = new NodeView(pipePropertiesNode) { Name = "Pipe Fluid Code", HasChildren = true, Type = NodeType.PipeFluidCodeRootNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView specialFeatureNode = new NodeView(pipePropertiesNode) { Name = "Pipe Special Feature", HasChildren = true, Type = NodeType.PipeSpecialFeatureRootNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView pipeCategoryNode = new NodeView(pipePropertiesNode) { Name = "Pipe Category", HasChildren = true, Type = NodeType.PipeCategoryRootNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; NodeView manufacturersNode = new NodeView(null) { Name = "Manufacturers", HasChildren = true, Type = NodeType.ManufacturersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; pipePropertiesNode.Children.Add(pipeClassNode); pipePropertiesNode.Children.Add(pipeSizeNode); pipePropertiesNode.Children.Add(pipeFluidCodeNode); pipePropertiesNode.Children.Add(specialFeatureNode); pipePropertiesNode.Children.Add(pipeCategoryNode); configurationRootNode.Add(pipePropertiesNode); configurationRootNode.Add(pipingComponentTypesNode); configurationRootNode.Add(standardComponentPropertiesNode); configurationRootNode.Add(reportsNode); configurationRootNode.Add(manufacturersNode); ConfigurationTreeView.ItemsSource = configurationRootNode; }
private void LoadReports(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetReportLinksByTabIdCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var reportLinks = eventArgs.Result; foreach (var reportLink in reportLinks) { var child = new NodeView(expandedNode) { Id = reportLink.Id, Name = reportLink.ReportName, Description = reportLink.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ReportNode, HasChildren = false, SortField = reportLink.Ordinal.ToString() }; expandedNode.Children.Add(child); expandedNode.Sort(); cmsWebServiceClient.GetReportLinksByTabIdCompleted -= fetchCompleted; } Utils.HideSpinner(expandedNode); }; cmsWebServiceClient.GetReportLinksByTabIdCompleted += fetchCompleted; cmsWebServiceClient.GetReportLinksByTabIdAsync(mTab.Id); }
private void LoadManufacturers(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetManufacturersCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var manufacturers = eventArgs.Result; foreach (var manufacturer in manufacturers) { var child = new NodeView(expandedNode) { Id = manufacturer.Id, Name = manufacturer.Name, Description = manufacturer.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ManufacturerNode, HasChildren = true, SortField = manufacturer.Ordinal.ToString() }; expandedNode.Children.Add(child); } Utils.HideSpinner(expandedNode); cmsWebServiceClient.GetManufacturersCompleted -= fetchCompleted; expandedNode.Sort(); }; cmsWebServiceClient.GetManufacturersCompleted += fetchCompleted; cmsWebServiceClient.GetManufacturersAsync((int)CommonUtils.EquipmentTypeCode.CONTR); }
private void AddInterlockType(NodeView nodeView) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); var dialog = new AddEditInterlockTypeDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddInterlockTypeCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { var mect = eventArgs.Result; if (mect != null) { var child = new NodeView(nodeView) { Id = mect.Id, Name = dialog.InterlockType.Name, Description = dialog.InterlockType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.InterlockType, HasChildren = true, SortField = dialog.InterlockType.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.AddInterlockTypeCompleted -= addCompleted; }; cmsWebServiceClient.AddInterlockTypeCompleted += addCompleted; cmsWebServiceClient.AddInterlockTypeAsync(dialog.InterlockType); } }; }
private void AddExistingSystemTypeTest(NodeView nodeView) { int? groupId = null; var controlSystemTypeId = -1; if (nodeView.Type == NodeType.ComponentTypeGroup) { groupId = nodeView.GroupId; controlSystemTypeId = nodeView.Parent.Parent.Id; } else { controlSystemTypeId = nodeView.Parent.Id; } var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetControlSystemTypeCompleted += (s, e) => { var dialog = new AddEditExistingControlTypeTestingPropertyDialog(e.Result, groupId); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddUpdateControlSystemTypeTestingPropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { var pcpt = eventArgs.Result; if (pcpt != null) { var child = new NodeView(nodeView) { Id = pcpt.Id, Name = dialog.SystemTypeTestingProperty.ControlSystemTestingProperty.Name, Description = dialog.SystemTypeTestingProperty.ControlSystemTestingProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTypeTest, HasChildren = false, SortField = groupId.HasValue ? pcpt.GroupOrdinal.ToString() : pcpt.Ordinal.ToString() }; nodeView.Children.Add(child); nodeView.Sort(true); } cmsWebServiceClient.AddUpdateControlSystemTypeTestingPropertyCompleted -= addCompleted; }; cmsWebServiceClient.AddUpdateControlSystemTypeTestingPropertyCompleted += addCompleted; var controlSystemEquipmentComponentTypeProperty = new ControlSystemTypeTestingProperty { ControlSystemTypeId = controlSystemTypeId, TestPropertyId = dialog.SystemTypeTestingProperty.TestPropertyId, ComponentTypeGroupId = dialog.SystemTypeTestingProperty.ComponentTypeGroupId, Ordinal = dialog.SystemTypeTestingProperty.Ordinal, GroupOrdinal = dialog.SystemTypeTestingProperty.GroupOrdinal }; if (dialog.GroupChanged) { //Group has changed, reload the Nodes ReloadComponentTypeEquipmentProperties(CommonUtils.EquipmentPropertyType.SystemTestingProperty, nodeView, NodeType.SystemTypeTests); } cmsWebServiceClient.AddUpdateControlSystemTypeTestingPropertyAsync(controlSystemEquipmentComponentTypeProperty); } }; }; cmsWebServiceClient.GetControlSystemTypeAsync(controlSystemTypeId); }
private void AddExistingControlSystemComponentTypeAlarmProperty(NodeView nodeView) { var controlSystemEquipmentComponentTypeId = nodeView.Parent.Id; var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetControlSystemComponentTypeCompleted += (s, e) => { var dialog = new AddEditExistingControlSystemComponentAlarmPropertyDialog(e.Result); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<SaveControlSystemComponentTypeAlarmPropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { var entityResult = eventArgs.Result.EntityResult; if (eventArgs.Result.HasErrors) { var popup = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages)); popup.Show(); return; } if (entityResult != null) { var child = new NodeView(nodeView) { Id = entityResult.Id, Name = dialog.ControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Name, Description = dialog.ControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ControlSystemComponentTypeAlarmProperty, HasChildren = false, SortField = entityResult.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted -= addCompleted; }; cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted += addCompleted; var systemComponentTypeTuningProperty = new ControlSystemComponentTypeAlarmProperty { ComponentTypeId = controlSystemEquipmentComponentTypeId, AlarmPropertyId = dialog.ControlSystemComponentTypeAlarmProperty.AlarmPropertyId, Ordinal = dialog.ControlSystemComponentTypeAlarmProperty.Ordinal }; cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyAsync(systemComponentTypeTuningProperty); } }; }; cmsWebServiceClient.GetControlSystemComponentTypeAsync(controlSystemEquipmentComponentTypeId); }
private void RemoveControlSystemComponentTypeAlarmProperty(NodeView nodeView) { var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, string.Format("Delete property '{0}'?", nodeView.Name)); confirmDialog.Show(); confirmDialog.Closed += (s, e) => { if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteControlSystemComponentTypeAlarmPropertyCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { if (!eventArgs.Result.HasErrors) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages)); errorDialog.Show(); } cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyCompleted += deleteCompleted; cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyAsync(nodeView.Id); } }; }
private void RecursiveLoadGraphics(List<Graphic> graphics, Graphic graphic, NodeView node) { var linked = (from x in graphics where x.ParentGraphicId.HasValue && x.ParentGraphicId.Value == graphic.Id orderby x.Ordinal select x).ToList(); var child = new NodeView(node) { Id = graphic.Id, Name = graphic.Name, Description = graphic.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.GraphicNode, IsActive = true, SortField = graphic.Ordinal.ToString(), HasChildren = linked.Any() }; node.Children.Add(child); Utils.HideSpinner(child); foreach (var linkedGraphic in linked) { RecursiveLoadGraphics(graphics, linkedGraphic, child); } }
private void LoadSystemTests(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetAllControlSystemTestingPropertiesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var properties = eventArgs.Result; if (properties != null) { foreach (var property in properties) { var child = new NodeView(expandedNode) { Id = property.Id, Name = property.Name, Description = property.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTest, HasChildren = false, SortField = property.Name }; expandedNode.Children.Add(child); cmsWebServiceClient.GetAllControlSystemTestingPropertiesCompleted -= fetchCompleted; } expandedNode.Sort(); } }; cmsWebServiceClient.GetAllControlSystemTestingPropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetAllControlSystemTestingPropertiesAsync(); }
private void LoadSystemTypeTests(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetControlSystemTypeTestingPropertiesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var typeTestingProperties = eventArgs.Result; typeTestingProperties = typeTestingProperties.OrderBy(x => x.Ordinal).ThenBy(x => x.GroupOrdinal).ToList(); foreach (var property in typeTestingProperties) { if (property.ComponentTypeGroupId.HasValue) { var childGroup = expandedNode.Children.FirstOrDefault(x => x.GroupId == property.ComponentTypeGroupId.Value); if (childGroup == null) { childGroup = new NodeView(expandedNode) { Id = property.Id, GroupId = property.ComponentTypeGroupId.Value, Name = property.ComponentTypeGroup.Name, Description = property.ComponentTypeGroup.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ComponentTypeGroup, HasChildren = true, SortField = property.Ordinal.ToString() }; expandedNode.Children.Add(childGroup); } else { Utils.HideSpinner(childGroup); } if (property.TestPropertyId.HasValue) { var child = new NodeView(childGroup) { Id = property.Id, Name = property.ControlSystemTestingProperty.Name, Description = property.ControlSystemTestingProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTypeTest, HasChildren = false, SortField = property.GroupOrdinal.ToString() }; childGroup.Children.Add(child); } } else { var child = new NodeView(expandedNode) { Id = property.Id, Name = property.ControlSystemTestingProperty.Name, Description = property.ControlSystemTestingProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTypeTest, HasChildren = false, SortField = property.Ordinal.ToString() }; expandedNode.Children.Add(child); } } Utils.HideSpinner(expandedNode); cmsWebServiceClient.GetControlSystemTypeTestingPropertiesCompleted -= fetchCompleted; }; cmsWebServiceClient.GetControlSystemTypeTestingPropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetControlSystemTypeTestingPropertiesAsync(expandedNode.Parent.Id); }
public ControlSystemConfigControl(Tab tab) { InitializeComponent(); CompositionInitializer.SatisfyImports(this); mTab = tab; ConfigurationTreeView.LoadOnDemand += ConfigurationTreeViewLoadOnDemand; var configurationRootNode = new ObservableCollection<NodeView>(); var controlSystemTypesNode = new NodeView(null) { Name = "ControlSystem Types ", HasChildren = true, Type = NodeType.ControlSystemTypesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var controlSystemComponentTypesNode = new NodeView(null) { Name = "ControlSystem Component Types", HasChildren = true, Type = NodeType.ControlSystemComponentTypes, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var controlSystemPropertiesNode = new NodeView(null) { Name = "ControlSystem Properties", HasChildren = true, Type = NodeType.ControlSystemProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; #region Alarms var alarmsNode = new NodeView(null) { Name = "Alarms", HasChildren = true, Type = NodeType.AlarmsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var alarmColours = new NodeView(alarmsNode) { Name = "Alarm Colour", HasChildren = true, Type = NodeType.AlarmColoursNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; alarmsNode.Children.Add(alarmColours); var alarmPriorities = new NodeView(alarmsNode) { Name = "Alarm Priority", HasChildren = true, Type = NodeType.AlarmPrioritiesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; alarmsNode.Children.Add(alarmPriorities); var alarmPurposes = new NodeView(alarmsNode) { Name = "Alarm Purpose", HasChildren = true, Type = NodeType.AlarmPurposesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; alarmsNode.Children.Add(alarmPurposes); var alarmResponses = new NodeView(alarmsNode) { Name = "Alarm Response", HasChildren = true, Type = NodeType.AlarmResponsesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; alarmsNode.Children.Add(alarmResponses); var alarmConsequenses = new NodeView(alarmsNode) { Name = "Alarm Consequence", HasChildren = true, Type = NodeType.AlarmConsequencesNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; alarmsNode.Children.Add(alarmConsequenses); var alarmCentums = new NodeView(alarmsNode) { Name = "Alarm Table - CENTUM DCS", HasChildren = true, Type = NodeType.AlarmCentums, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; alarmsNode.Children.Add(alarmCentums); #endregion #region Interlocks var interlocksNode = new NodeView(null) { Name = "Interlocks", HasChildren = true, Type = NodeType.InterlocksNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var interlockPropertiesNode = new NodeView(interlocksNode) { Name = "Interlock Properties", HasChildren = true, Type = NodeType.InterlockProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var interlockTypesNode = new NodeView(interlocksNode) { Name = "Interlock Types", HasChildren = true, Type = NodeType.InterlockTypes, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; interlocksNode.Children.Add(interlockTypesNode); interlocksNode.Children.Add(interlockPropertiesNode); #endregion var controlSystemEngineeringPropertiesNode = new NodeView(controlSystemPropertiesNode) { Name = "Engineering Properties", HasChildren = true, Type = NodeType.ControlSystemEngineeringProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var controlSystemTuningPropertiesNode = new NodeView(controlSystemPropertiesNode) { Name = "Tuning Properties", HasChildren = true, Type = NodeType.ControlSystemTuningProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var controlSystemAlarmPropertiesNode = new NodeView(controlSystemPropertiesNode) { Name = "Alarm Properties", HasChildren = true, Type = NodeType.ControlSystemAlarmProperties, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var componentTestsNode = new NodeView(controlSystemPropertiesNode) { Name = "Component Tests", HasChildren = true, Type = NodeType.ComponentTests, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var systemTestsNode = new NodeView(controlSystemPropertiesNode) { Name = "System Tests", HasChildren = true, Type = NodeType.SystemTests, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; controlSystemPropertiesNode.Children.Add(controlSystemEngineeringPropertiesNode); controlSystemPropertiesNode.Children.Add(controlSystemTuningPropertiesNode); controlSystemPropertiesNode.Children.Add(controlSystemAlarmPropertiesNode); controlSystemPropertiesNode.Children.Add(systemTestsNode); controlSystemPropertiesNode.Children.Add(componentTestsNode); var reportsNode = new NodeView(null) { Name = "Reports", HasChildren = true, Type = NodeType.ReportsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; var manufacturersNode = new NodeView(null) { Name = "Manufacturers", HasChildren = true, Type = NodeType.ManufacturersNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; mGraphicsTopNode = new NodeView(null) { Name = "Graphics List", HasChildren = true, Type = NodeType.GraphicsNode, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png" }; configurationRootNode.Add(controlSystemTypesNode); configurationRootNode.Add(controlSystemComponentTypesNode); configurationRootNode.Add(controlSystemPropertiesNode); configurationRootNode.Add(alarmsNode); configurationRootNode.Add(interlocksNode); configurationRootNode.Add(mGraphicsTopNode); configurationRootNode.Add(reportsNode); configurationRootNode.Add(manufacturersNode); ConfigurationTreeView.ItemsSource = configurationRootNode; }
private void ReloadComponentTypeEquipmentProperties(CommonUtils.EquipmentPropertyType equipmentPropertyType, NodeView componentTypeEquipmentPropertiesNode, NodeType nodeTypeIn) { var parent = componentTypeEquipmentPropertiesNode.Parent; var index = parent.Children.IndexOf(componentTypeEquipmentPropertiesNode); componentTypeEquipmentPropertiesNode.Parent.Children.Remove(componentTypeEquipmentPropertiesNode); //Remove old controlSystemEquipmentPropertiesNode var nodeName = string.Empty; switch (equipmentPropertyType) { case CommonUtils.EquipmentPropertyType.ControlEngineeringProperty: nodeName = "Engineering Properties"; break; case CommonUtils.EquipmentPropertyType.SystemTestingProperty: if (nodeTypeIn == NodeType.ComponentTypeTests) { nodeName = "Component Tests"; //was "Testing Properties" } else if (nodeTypeIn == NodeType.SystemTypeTests) { nodeName = "System Tests"; } break; } componentTypeEquipmentPropertiesNode = new NodeView(parent) { Name = nodeName, Type = nodeTypeIn, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", HasChildren = true }; parent.Children.Insert(index, componentTypeEquipmentPropertiesNode); }
private void LoadComponentTypeTuningProperties(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetControlSystemComponentTypeTuningPropertiesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var componentTypeProperties = eventArgs.Result; componentTypeProperties = componentTypeProperties.OrderBy(x => x.Ordinal).ThenBy(x => x.GroupOrdinal).ToList(); foreach (var componentProperty in componentTypeProperties) { var desc = componentProperty.ControlSystemTuningProperty.Name; if (!string.IsNullOrEmpty(componentProperty.ControlSystemTuningProperty.Description)) { desc = string.Format("{0} ({1})", componentProperty.ControlSystemTuningProperty.Name, componentProperty.ControlSystemTuningProperty.Description); } if (componentProperty.ComponentTypeGroupId.HasValue) { var childGroup = expandedNode.Children.FirstOrDefault(x => x.Id == componentProperty.ComponentTypeGroupId.Value); if (childGroup == null) { childGroup = new NodeView(expandedNode) { Id = componentProperty.ComponentTypeGroupId.Value, Name = componentProperty.ComponentTypeGroup.Name, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ComponentTypeGroup, HasChildren = true, SortField = componentProperty.Ordinal.ToString() }; expandedNode.Children.Add(childGroup); } var child = new NodeView(childGroup) { Id = componentProperty.Id, Name = desc, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ControlSystemComponentTypeTuningProperty, HasChildren = false, SortField = componentProperty.GroupOrdinal.ToString() }; childGroup.Children.Add(child); } else { var child = new NodeView(expandedNode) { Id = componentProperty.Id, Name = desc, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ControlSystemComponentTypeTuningProperty, HasChildren = false, SortField = componentProperty.Ordinal.ToString() }; expandedNode.Children.Add(child); } } Utils.HideSpinner(expandedNode); expandedNode.Sort(); cmsWebServiceClient.GetControlSystemComponentTypeTuningPropertiesCompleted -= fetchCompleted; }; cmsWebServiceClient.GetControlSystemComponentTypeTuningPropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetControlSystemComponentTypeTuningPropertiesAsync(expandedNode.Parent.Id); }
private void RemoveInterlockTypeProperty(NodeView nodeView) { var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, string.Format("Delete property '{0}'?", nodeView.Name)); confirmDialog.Show(); confirmDialog.Closed += (s, e) => { if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<RemoveInterlockTypePropertyCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { var error = eventArgs.Result; if (string.IsNullOrEmpty(error)) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, error); errorDialog.Show(); } cmsWebServiceClient.RemoveInterlockTypePropertyCompleted -= deleteCompleted; }; cmsWebServiceClient.RemoveInterlockTypePropertyCompleted += deleteCompleted; cmsWebServiceClient.RemoveInterlockTypePropertyAsync(nodeView.Id); } }; }
private void LoadControlSystemTypes(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetControlSystemTypesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var equipmentTypes = eventArgs.Result; foreach (var equipmentType in equipmentTypes) { var systemTypeNode = new NodeView(expandedNode) { Id = equipmentType.Id, Name = equipmentType.Name, Description = equipmentType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ControlSystemTypeNode, HasChildren = true, SortField = equipmentType.Name }; var systemTestsNode = new NodeView(systemTypeNode) { Name = "System Type Tests", Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTypeTests, HasChildren = true }; expandedNode.Children.Add(systemTypeNode); systemTypeNode.Children.Add(systemTestsNode); Utils.HideSpinner(expandedNode); Utils.HideSpinner(systemTestsNode); } cmsWebServiceClient.GetControlSystemTypesCompleted -= fetchCompleted; expandedNode.Sort(); }; cmsWebServiceClient.GetControlSystemTypesCompleted += fetchCompleted; cmsWebServiceClient.GetControlSystemTypesAsync(false); }
private void AddExistingInterlockProperty(NodeView nodeView) { var interlockTypeId = nodeView.Id; var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetInterlockTypeCompleted += (s, e) => { var addEditExistingInterlockProperty = new AddEditExistingInterlockPropertyDialog(e.Result); addEditExistingInterlockProperty.Show(); addEditExistingInterlockProperty.Closed += (s1, e1) => { if (addEditExistingInterlockProperty.DialogResult.HasValue && addEditExistingInterlockProperty.DialogResult.Value) { EventHandler<AddUpdateInterlockTypePropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { var pcpt = eventArgs.Result; if (pcpt != null) { var child = new NodeView(nodeView) { Id = pcpt.Id, Name = addEditExistingInterlockProperty.InterlockTypeProperty.InterlockProperty.Name, Description = addEditExistingInterlockProperty.InterlockTypeProperty.InterlockProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.InterlockTypeProperty, HasChildren = false, SortField = pcpt.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.AddUpdateInterlockTypePropertyCompleted -= addCompleted; }; cmsWebServiceClient.AddUpdateInterlockTypePropertyCompleted += addCompleted; var interlockTypeProperty = new InterlockTypeProperty { InterlockTypeId = interlockTypeId, InterlockPropertyId = addEditExistingInterlockProperty.InterlockTypeProperty.InterlockPropertyId, Ordinal = addEditExistingInterlockProperty.InterlockTypeProperty.Ordinal }; cmsWebServiceClient.AddUpdateInterlockTypePropertyAsync(interlockTypeProperty); } }; }; cmsWebServiceClient.GetInterlockTypeAsync(interlockTypeId); }
private void LoadGraphics(NodeView expandedNode) { DatabaseLoader.GetGraphics().ContinueWith(getGraphicsTask => { CMS.UiFactory.StartNew(() => { var graphics = getGraphicsTask.Result; var topparents = (from x in graphics where !x.ParentGraphicId.HasValue orderby x.Ordinal select x).ToList(); foreach (var graphic in topparents) { var linked = (from x in graphics where x.ParentGraphicId.HasValue && x.ParentGraphicId.Value == graphic.Id orderby x.Ordinal select x).ToList(); var childNode = new NodeView(expandedNode) { Id = graphic.Id, Name = graphic.Name, Description = graphic.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.GraphicNode, IsActive = true, SortField = graphic.Ordinal.ToString(), HasChildren = linked.Any() }; expandedNode.Children.Add(childNode); Utils.HideSpinner(childNode); foreach (var childGraphic in linked) { RecursiveLoadGraphics(graphics, childGraphic, childNode); } } expandedNode.Sort(); Utils.HideSpinner(expandedNode); }); }); }
private void AddInterlockProperty(NodeView nodeView) { var dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.ControlInterlockProperty); dialog.Show(); dialog.Closed += (s1, e1) => { var parentNode = nodeView; if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var child = new NodeView(parentNode) { Id = dialog.ComponentProperty.Id, Name = dialog.ComponentProperty.Name, Description = dialog.ComponentProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.InterlockProperty, HasChildren = false, SortField = dialog.ComponentProperty.Name }; if (nodeView.ChildrenLoaded) { parentNode.Children.Add(child); nodeView.Sort(); } } }; }
private void LoadInterlockTypeProperties(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetInterlockTypePropertiesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var interlockTypeProperties = eventArgs.Result; foreach (var interlockTypeProperty in interlockTypeProperties) { var desc = interlockTypeProperty.InterlockProperty.Name; if (!string.IsNullOrEmpty(interlockTypeProperty.InterlockProperty.Description)) { desc = string.Format("{0} ({1})", interlockTypeProperty.InterlockProperty.Name, interlockTypeProperty.InterlockProperty.Description); } var child = new NodeView(expandedNode) { Id = interlockTypeProperty.Id, Name = desc, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.InterlockTypeProperty, HasChildren = false, SortField = interlockTypeProperty.Ordinal.ToString() }; expandedNode.Children.Add(child); } Utils.HideSpinner(expandedNode); expandedNode.Sort(); cmsWebServiceClient.GetInterlockTypePropertiesCompleted -= fetchCompleted; }; cmsWebServiceClient.GetInterlockTypePropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetInterlockTypePropertiesAsync(expandedNode.Id); }
private void AddManufacturer(NodeView nodeView) { var dialog = new AddEditManufacturerDialog(CommonUtils.EquipmentTypeCode.CONTR); dialog.Show(); dialog.Closed += (s1, e1) => { var parentNode = nodeView; if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var child = new NodeView(parentNode) { Id = dialog.Manufacturer.Id, Name = dialog.Manufacturer.Name, Description = dialog.Manufacturer.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ManufacturerNode, HasChildren = true, SortField = dialog.Manufacturer.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { parentNode.Children.Add(child); parentNode.Sort(); } } }; }
private void LoadInterlockTypes(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetInterlockTypesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var interlockTypes = eventArgs.Result; if (interlockTypes != null) { foreach (var interlockType in interlockTypes) { var child = new NodeView(expandedNode) { Id = interlockType.Id, Name = interlockType.Name, Description = interlockType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.InterlockType, HasChildren = true, SortField = interlockType.Ordinal.ToString() }; expandedNode.Children.Add(child); } Utils.HideSpinner(expandedNode); expandedNode.Sort(); } }; cmsWebServiceClient.GetInterlockTypesCompleted += fetchCompleted; cmsWebServiceClient.GetInterlockTypesAsync(); }