Пример #1
0
 /// <summary>
 /// Change Invoke method of an Object in Path
 /// </summary>
 /// <param name="comboBox1"></param>
 /// <param name="listView1"></param>
 /// <returns></returns>
 public bool ChangeInvoke(ComboBox comboBox1, ListView listView1)
 {
     if (comboBox1.SelectedIndex != -1)
     {
         if (comboBox1.SelectedItem.ToString() != "Select Item" && comboBox1.SelectedItem.ToString() != "Set Text")
         {
             foreach (ListViewItem item in listView1.SelectedItems)
             {
                 if (comboBox1.SelectedItem.ToString() != null)
                 {
                     item.SubItems[0].Text = item.Text;
                     item.SubItems[1].Text = comboBox1.SelectedItem.ToString();
                 }
             }
         }
         else
         {
             //popup Box
             string itemToSelect = FunctionsLibrary.ShowDialog("What is the text for the item?", "Item Text");
             foreach (ListViewItem item in listView1.SelectedItems)
             {
                 if (comboBox1.SelectedItem.ToString() != null)
                 {
                     item.SubItems[0].Text = item.Text;
                     item.SubItems[1].Text = comboBox1.SelectedItem.ToString() + ":" + itemToSelect;
                 }
             }
         }
         return(true);
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// Create A Project
        /// </summary>
        /// <param name="guiGoodLog"></param>
        /// <param name="treeView1"></param>
        /// <returns></returns>
        public Tuple <string, string> CreateProject(RichTextBox guiGoodLog, TreeView treeView1, string ProjectName)
        {
            string ProjectPath = "";

            //Create a new Project
            ProjectName = FunctionsLibrary.ShowDialog("Please enter the name of the Project:", "New Project");
            if (ProjectName == null || ProjectName == "")
            {
                return(null);
            }
            if (Directory.Exists(ProjectName) == false && File.Exists(ProjectName) == false)
            {
                DirectoryInfo path = Directory.CreateDirectory(ProjectName);
                ProjectPath = Environment.CurrentDirectory.ToString() + "\\" + path.ToString();
            }
            else
            {
                FunctionsLibrary.AppendText(guiGoodLog, "That project name already exists. \n", Color.Red);
                MessageBox.Show("That name already exists.");
            }
            treeView1.Nodes.Clear();
            TreeNode rootNode = new TreeNode("Project Suite '" + ProjectName + "' (0 Script(s))");

            rootNode.ImageIndex = 0;
            treeView1.Nodes.Add(rootNode);
            treeView1.ExpandAll();
            FunctionsLibrary.AppendText(guiGoodLog, "Project created. \n", Color.Blue);
            return(new Tuple <string, string>(ProjectName, ProjectPath));
        }
Пример #3
0
 /// <summary>
 /// Add functions to script Path
 /// </summary>
 /// <param name="comboBox3"></param>
 /// <param name="listView1"></param>
 /// <returns></returns>
 public bool AddFunctionsToPath(ComboBox comboBox3, ListView listView1)
 {
     if (comboBox3.SelectedIndex != -1)
     {
         if (comboBox3.SelectedItem.ToString() == "Write Memory Mapped File")
         {
             string       info  = FunctionsLibrary.ShowDialog("Enter the name of the memory mapped file", "MMF");
             string       info2 = FunctionsLibrary.ShowDialog("Enter the information stored in the MMF:", "MMF");
             ListViewItem item1 = new ListViewItem("Function");
             item1.SubItems.Add(comboBox3.SelectedItem.ToString());
             item1.SubItems.Add(info + ":" + info2);
             listView1.Items.Add(item1);
         }
         else
         if (comboBox3.SelectedItem.ToString() == "Close Memory Mapped File")
         {
             string       info  = FunctionsLibrary.ShowDialog("Enter the name of the memory mapped file", "MMF");
             ListViewItem item1 = new ListViewItem("Function");
             item1.SubItems.Add(comboBox3.SelectedItem.ToString());
             item1.SubItems.Add(info);
             listView1.Items.Add(item1);
         }
         else
         if (comboBox3.SelectedItem.ToString() == "Send Message")
         {
             string       info  = FunctionsLibrary.ShowDialog("Enter the information stored in the variable:", "Variable Info");
             ListViewItem item1 = new ListViewItem("Function");
             item1.SubItems.Add(comboBox3.SelectedItem.ToString());
             item1.SubItems.Add(info);
             listView1.Items.Add(item1);
         }
         else
         if (comboBox3.SelectedItem.ToString() == "Sleep")
         {
             string       info  = FunctionsLibrary.ShowDialog("Enter the time to sleep for:", "Sleep Info");
             ListViewItem item1 = new ListViewItem("Function");
             item1.SubItems.Add(comboBox3.SelectedItem.ToString());
             item1.SubItems.Add(info);
             listView1.Items.Add(item1);
         }
         else
         if (comboBox3.SelectedItem.ToString() == "END")
         {
             ListViewItem item1 = new ListViewItem("Function");
             item1.SubItems.Add(comboBox3.SelectedItem.ToString());
             item1.SubItems.Add("END");
             listView1.Items.Add(item1);
         }
     }
     return(true);
 }