/// <summary>
 /// Shows the given min-priority queue with the given title, provided leftToShow is
 /// positive.
 /// </summary>
 /// <param name="q">The min-priority queue.</param>
 /// <param name="leftToShow">If positive, the drawing will be shown.</param>
 /// <param name="title">The form title.</param>
 /// <returns>leftToShow - 1 if leftToShow is positive, or leftToShow
 /// otherwise.</returns>
 private decimal Show(MinPriorityQueue <int, string> q, decimal leftToShow,
                      string title)
 {
     if (leftToShow > 0)
     {
         TreeForm f = q.HeapDrawing;
         f.Text = title;
         f.Show();
         leftToShow--;
     }
     return(leftToShow);
 }
Beispiel #2
0
 // Show tree form
 public void showTreeForm(Word.Document document)
 {
     try
     {
         if (treeForm == null)
         {
             treeForm = new TreeForm(document, configXML);
         }
         else
         {
             treeForm.setApplication(document);
         }
         treeForm.Show();
         treeForm.startUp();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #3
0
 // Show tree form
 public void showTreeForm(Excel.Workbook workbook)
 {
     try
     {
         if (treeForm == null)
         {
             treeForm = new TreeForm(workbook, configXML);
         }
         else
         {
             treeForm.setApplication(workbook);
         }
         treeForm.Show();
         treeForm.startUp();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #4
0
 // Show tree form
 public void showTreeForm(PowerPoint.Presentation presentation)
 {
     try
     {
         presentation.Save(); // Saves the document
         if (treeForm == null)
         {
             treeForm = new TreeForm(presentation.FullName, configXML);
         }
         else
         {
             treeForm.setApplication(presentation.FullName);
         }
         treeForm.Show();
         treeForm.startUp();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 /// <summary>
 /// Event handler for the opening a graph; constructs a tree
 /// </summary>
 /// <param name="sender">general object passed in</param>
 /// <param name="e">event object passed in</param>
 private void uxLoadGraph_Click(object sender, EventArgs e)
 {
     try
     {
         UndirectedGraph graph;
         MSTNode         node;
         TreeForm        tf;
         if (uxOpenDialog.ShowDialog() == DialogResult.OK)
         {
             graph = ReadGraph(uxOpenDialog.FileName);
             node  = graph.GetMinSpanningTree();
             tf    = new TreeForm(node, 100);
             tf.Show();
             uxTour.Text = node.Walk();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #6
0
        /// <summary>
        /// Handles the event when the search button is hit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxFindAnagrams_Click(object sender, EventArgs e)
        {
            uxListBox.Items.Clear();
            FoundAnagrams = new StringSet();
            uxString.Text = uxString.Text.ToLower();
            GetAnagrams(new ConsList<string>("", null), new StringBuilder(""), BuildQueue(uxString.Text.Trim()));
            FoundAnagrams.AddAll(uxListBox.Items);

            TreeForm form = new TreeForm(FoundAnagrams, 100);
            form.Text = uxString.Text;
            form.Show();

            uxAnagramCount.Text = "" + uxListBox.Items.Count;
        }