示例#1
0
        private void removeSectionBtn_Click(Object sender, System.EventArgs e)
        {
            try
            {
                //-6,-6 is the magic number that allows the sections to not slowly move down when deleted..
                this.Size = new System.Drawing.Size(-6, -6);

                ProgramLauncher.CustomClasses.OtherExeContainer oEC = new ProgramLauncher.CustomClasses.OtherExeContainer();
                oEC.setExe(addNewParamTbx.Text);

                ConfigForm.deleteExeFromArray(oEC);

                this.Controls.Remove(addNewAppLabel);
                this.Controls.Remove(addNewAppTbx);

                this.Controls.Remove(addNewParamLabel);
                this.Controls.Remove(addNewParamTbx);

                this.Controls.Remove(browseNewAppBtn);
                this.Controls.Remove(removeSectionBtn);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong when deleting this program... \n\n" + ex.ToString());
            }
        }
示例#2
0
        public static List <OtherExeContainer> readArrayFromXML()
        {
            List <OtherExeContainer> exeArray = new List <OtherExeContainer>();

            //If the XML file is not empty...
            if (System.IO.File.ReadAllText(ConfigForm.getXmlLocation()).ToString() != "")
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(ConfigForm.getXmlLocation());
                XmlNodeList exeNodes = xmlDoc.SelectNodes("//Executables/OtherExes");

                foreach (XmlNode exeNode in exeNodes)
                {
                    if (exeNode.HasChildNodes)
                    {
                        OtherExeContainer oExeContainer = new OtherExeContainer();

                        oExeContainer.setExe(exeNode["OtherExe"].InnerText);
                        oExeContainer.setParam(exeNode["OtherExe"].Attributes["Params"].Value);

                        exeArray.Add(oExeContainer);
                    }
                }

                return(exeArray);
            }

            return(exeArray);
        }
示例#3
0
        private void browseNewAppBtn_Click(Object sender, System.EventArgs e)
        {
            OpenFileDialog newAppDialog = new OpenFileDialog();

            newAppDialog.Filter = "Exe files (*.exe)|*.exe|All files (*.*)|*.*";

            DialogResult result = newAppDialog.ShowDialog(); // Show the dialog.

            if (result == DialogResult.OK)                   // Test result.
            {
                ProgramLauncher.CustomClasses.OtherExeContainer oEC = new CustomClasses.OtherExeContainer();
                oEC.setExe(addNewAppTbx.Text);

                ConfigForm.deleteExeFromArray(oEC);
                string file = newAppDialog.FileName;
                try
                {
                    if (!file.ToLower().Equals(ConfigForm.EXE_PATH.ToLower()))
                    {
                        oEC.setExe(file);
                        oEC.setParam(addNewAppTbx.Text);
                        if (ConfigForm.setOtherExesArray(oEC))
                        {
                            addNewAppTbx.Text = file;
                        }
                    }
                    else
                    {
                        MessageBox.Show(ConfigForm.EXE_PATH + " is not a valid executable, please choose a different application.");
                    }
                }
                catch (IOException)
                {
                }
            }
        }