Esempio n. 1
0
 /// <summary>
 /// Copies the given <paramref name="selection"/> to an existing workpad
 /// with the given <paramref name="name"/>.
 /// </summary>
 /// <param name="name">the name of the workpad</param>
 /// <param name="selection">the selection to copy</param>
 private void CopyToExistingWorkpad(string name, ISelection selection)
 {
     IResultNode[] results = selection.Results;
     if (results != null)
     {
         Workpad workpad = GetWorkpad(name);
         if (workpad != null)
         {
             workpad.AddResults(results);
         }
     }
 }
Esempio n. 2
0
        public RenameForm(Workpad renameTarget)
        {
            if (renameTarget == null)
            {
                throw new ArgumentNullException("renameTarget");
            }

            InitializeComponent();
            _renameTarget    = renameTarget;
            Text             = "Rename Workpad";
            textBoxName.Text = renameTarget.WorkpadName;
        }
Esempio n. 3
0
 /// <summary>
 /// Copies the given <paramref name="selection"/> to a new workpad.
 /// </summary>
 /// <param name="selection">the selection to copy</param>
 private void CopyToNewWorkpad(ISelection selection)
 {
     IResultNode[] results = selection.Results;
     if (results != null)
     {
         Workpad workpad = CreateWorkpad();
         if (workpad != null)
         {
             workpad.Show(_dockPanel, DockState.Document);
             workpad.AddResults(results);
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Creates a new workpad.
        /// </summary>
        /// <return>the newly created workpad</return>
        public Workpad CreateWorkpad()
        {
            Workpad workpad = _createWorkPad();

            workpad.FormClosed  += new FormClosedEventHandler(Workpad_FormClosed);
            workpad.NameChanged += Workpad_NameChanged;

            // Add the workpad and send event
            _workpads.Add(workpad);

            if (WorkpadsChanged != null)
            {
                WorkpadsChanged(this, _workpadsChangedEventArgs);
            }
            return(workpad);
        }
Esempio n. 5
0
        /// <summary>
        /// Adds drop down menu items for existing and new workpads to the
        /// given <paramref name="toolStripMenuItem"/>.
        /// </summary>
        /// <param name="toolStripMenuItem">the item to add the drop down items to</param>
        /// <param name="selection">the selection to send to workpads</param>
        /// <param name="excludeWorkpad">the workpad to exclude</param>
        public void AddDropDownMenuItems(ToolStripMenuItem toolStripMenuItem, ISelection selection, Workpad excludeWorkpad)
        {
            // Add the 'new workpad' item to the drop down menu
            toolStripMenuItem.DropDownItems.Add("New Workpad", null, (sender, e) => CopyToNewWorkpad(selection));

            // Create and add items for existing workpads to the drop down menu
            ICollection <Workpad> existingWorkpads = Workpads;

            if (existingWorkpads.Count > 0 && (excludeWorkpad == null || existingWorkpads.Count >= 2))
            {
                var existingWorkpadMenuItem = new ToolStripMenuItem("Existing Workpad");
                toolStripMenuItem.DropDownItems.Add(existingWorkpadMenuItem);

                // Add all workpad that are not in the exclude list
                // We do not want the workpad itself appear in the list of existing workpads
                foreach (Workpad existingWorkpad in existingWorkpads.Where(workpad => workpad != excludeWorkpad))
                {
                    existingWorkpadMenuItem.DropDownItems.Add(existingWorkpad.WorkpadName, null, (sender, e) => CopyToExistingWorkpad(((ToolStripMenuItem)sender).Text, selection));
                }
            }
        }