示例#1
0
        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();
     }
 }