public override void ExecuteCommand(IList <Microsoft.EnterpriseManagement.ConsoleFramework.NavigationModelNodeBase> nodes, Microsoft.EnterpriseManagement.ConsoleFramework.NavigationModelNodeTask task, ICollection <string> parameters) { try { //LogFile _LogFile = new LogFile(@"C:\LogForms.txt",true); IDataItem dataItem = null; //There will only ever be one item because we are going to limit this task to single select foreach (NavigationModelNodeBase node in nodes) { //Check if task was started from form bool startedFromForm = FormUtilities.Instance.IsNodeWithinForm(nodes[0]); //If started from form if (startedFromForm) { dataItem = FormUtilities.Instance.GetFormDataContext(node); } //Else started from view else { dataItem = node; } } EnterpriseManagementGroup emg = GetSession(); Guid CurrentNodeId = (Guid)dataItem["$Id$"]; EnterpriseManagementObject EMO = emg.EntityObjects.GetObject <EnterpriseManagementObject>(CurrentNodeId, ObjectQueryOptions.Default); var newWindow = new SCSForm(EMO); newWindow.Show(); } catch (Exception ex) { System.Windows.MessageBox.Show(DateTime.Now + " : " + "ExecuteCommand Error : " + ex.Message); } }
private void brd_SCSForm_MouseDown(object sender, MouseButtonEventArgs e) { try { if (this.CabelsTreeView.SelectedItem != null) { TreeViewItem SelectedTreeItem = (TreeViewItem)this.CabelsTreeView.SelectedItem; if (SelectedTreeItem.Header.ToString().Contains("Cable.Footage")) { System.Windows.MessageBox.Show("Select object!", "Service Manager", MessageBoxButton.OK, MessageBoxImage.Warning); } else { Guid G = new Guid(SelectedTreeItem.Tag.ToString()); EMO = emg.EntityObjects.GetObject <EnterpriseManagementObject>(G, ObjectQueryOptions.Default); var newWindow = new SCSForm(EMO); newWindow.Show(); } } else { System.Windows.MessageBox.Show("Select object!", "Service Manager", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { System.Windows.MessageBox.Show("brd_SCSForm_MouseDown procedure error : " + ex.Message, "Service Manager", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.SCSWindow = ((SMCenter.Forms.SCSForm)(target)); #line 5 "..\..\SCSForm.xaml" this.SCSWindow.Loaded += new System.Windows.RoutedEventHandler(this.ConnectionsWindow_Loaded); #line default #line hidden return; case 2: this.CabelsTreeView = ((System.Windows.Controls.TreeView)(target)); #line 18 "..\..\SCSForm.xaml" this.CabelsTreeView.SelectedItemChanged += new System.Windows.RoutedPropertyChangedEventHandler <object>(this.CabelsTreeView_SelectedItemChanged); #line default #line hidden #line 18 "..\..\SCSForm.xaml" this.CabelsTreeView.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.CabelsTreeView_MouseDoubleClick); #line default #line hidden return; case 3: this.Logo = ((System.Windows.Controls.Image)(target)); return; case 4: this.lbCancel = ((System.Windows.Controls.Label)(target)); #line 22 "..\..\SCSForm.xaml" this.lbCancel.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.lbCancel_MouseDown); #line default #line hidden return; case 5: this.CablesButtons = ((System.Windows.Controls.StackPanel)(target)); return; case 6: this.brd_CI_Add = ((System.Windows.Controls.Border)(target)); return; case 7: this.CI_Image_Add = ((System.Windows.Controls.Image)(target)); return; case 8: this.brd_CI_Edit = ((System.Windows.Controls.Border)(target)); return; case 9: this.CI_Image_Edit = ((System.Windows.Controls.Image)(target)); return; case 10: this.brd_CI_Delete = ((System.Windows.Controls.Border)(target)); #line 35 "..\..\SCSForm.xaml" this.brd_CI_Delete.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.brd_CI_Delete_MouseDown); #line default #line hidden return; case 11: this.CI_Image_Delete = ((System.Windows.Controls.Image)(target)); return; case 12: this.brd_F1 = ((System.Windows.Controls.Border)(target)); return; case 13: this.txtF1 = ((System.Windows.Controls.TextBox)(target)); #line 40 "..\..\SCSForm.xaml" this.txtF1.LostFocus += new System.Windows.RoutedEventHandler(this.txtF1_LostFocus); #line default #line hidden return; case 14: this.brd_F2 = ((System.Windows.Controls.Border)(target)); return; case 15: this.txtF2 = ((System.Windows.Controls.TextBox)(target)); #line 43 "..\..\SCSForm.xaml" this.txtF2.LostFocus += new System.Windows.RoutedEventHandler(this.txtF2_LostFocus); #line default #line hidden return; case 16: this.brdRack1 = ((System.Windows.Controls.Border)(target)); return; case 17: this.cboxRack1 = ((System.Windows.Controls.ComboBox)(target)); #line 62 "..\..\SCSForm.xaml" this.cboxRack1.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cboxRack1_SelectionChanged); #line default #line hidden return; case 18: this.cboxPP1 = ((System.Windows.Controls.ComboBox)(target)); #line 63 "..\..\SCSForm.xaml" this.cboxPP1.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cboxPP1_SelectionChanged); #line default #line hidden return; case 19: this.cboxPPP1 = ((System.Windows.Controls.ComboBox)(target)); return; case 20: this.cboxRack2 = ((System.Windows.Controls.ComboBox)(target)); #line 69 "..\..\SCSForm.xaml" this.cboxRack2.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cboxRack2_SelectionChanged); #line default #line hidden return; case 21: this.cboxPP2 = ((System.Windows.Controls.ComboBox)(target)); #line 70 "..\..\SCSForm.xaml" this.cboxPP2.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cboxPP2_SelectionChanged); #line default #line hidden return; case 22: this.cboxPPP2 = ((System.Windows.Controls.ComboBox)(target)); return; case 23: this.brd_PPAdd = ((System.Windows.Controls.Border)(target)); #line 72 "..\..\SCSForm.xaml" this.brd_PPAdd.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.brd_PPAdd_MouseDown); #line default #line hidden return; case 24: this.Image_PPAdd = ((System.Windows.Controls.Image)(target)); return; case 25: this.brd_PPCopy = ((System.Windows.Controls.Border)(target)); #line 75 "..\..\SCSForm.xaml" this.brd_PPCopy.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.brd_PPCopy_MouseDown); #line default #line hidden return; case 26: this.Image_PPCopy = ((System.Windows.Controls.Image)(target)); return; case 27: this.brdModule = ((System.Windows.Controls.Border)(target)); return; case 28: this.lbLocation = ((System.Windows.Controls.Label)(target)); #line 89 "..\..\SCSForm.xaml" this.lbLocation.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.lbLocation_MouseDown); #line default #line hidden return; case 29: this.cboxModule = ((System.Windows.Controls.ComboBox)(target)); return; case 30: this.brd_ModuleAdd = ((System.Windows.Controls.Border)(target)); #line 91 "..\..\SCSForm.xaml" this.brd_ModuleAdd.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.brd_ModuleAdd_MouseDown); #line default #line hidden return; case 31: this.Image_ModuleAdd = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }