예제 #1
0
        public void RemoveProcess(ProcessButton button)
        {
            var butInList = isButtonInList(button);

            if (butInList != null)
            {
                runningProcs.Remove(butInList);
            }
        }
예제 #2
0
 private Tuple <Process, ProcessButton> isButtonInList(ProcessButton button) //returns null if not found
 {
     foreach (var rBut in runningProcs.ToList())
     {
         if (rBut.Item2 == button)
         {
             return(rBut);
         }
     }
     return(null);
 }
예제 #3
0
파일: Form1.cs 프로젝트: mdoss/MultiLaunch
 public Form1()
 {
     InitializeComponent();
     if (Properties.Settings.Default.btnStringList == null)
     {
         Properties.Settings.Default.btnStringList = new System.Collections.Specialized.StringCollection();
     }
     LoadSavedButtons();
     timerCheckRunning.Start();
     this.Controls.Add(new ProcessButton());
     SortButtons(ProcessButton.GetAllButtons());
 }
예제 #4
0
 private void CreateProgramButton(ProcessButton button, string filePath)
 {
     if (IsAlreadyLoaded(filePath))
     {
         return;
     }
     button.SetProgram(filePath);
     button.Click    -= new EventHandler(AddProgramButton_Click);
     button.Click    += new EventHandler(RunProgramButton_Click);
     button.DragDrop -= NewButton_DragDrop;
     button.DragDrop += ChangeButton_DragDrop;
     CreateNewButton();
 }
예제 #5
0
파일: Form1.cs 프로젝트: mdoss/MultiLaunch
        private void LoadSavedButtons()
        {
            var btnStringList = Properties.Settings.Default.btnStringList.Cast <string>().ToList();

            Properties.Settings.Default.btnStringList = new System.Collections.Specialized.StringCollection();
            foreach (var filePath in btnStringList)
            {
                var button = new ProcessButton();
                button.LoadProgramButton(filePath);
                Controls.Add(button);
            }
            ProcessButton.CheckRunning();
        }
예제 #6
0
        private void AddProgramButton_Click(object sender, EventArgs e)
        {
            ProcessButton button = sender as ProcessButton;

            Debug.WriteLine(button.NameLabel);
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";
            openFileDialog.Filter           = "Executable Programs (*.exe) | *.exe";
            openFileDialog.FilterIndex      = 0;
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                CreateProgramButton(button, openFileDialog.FileName);
            }
        }
예제 #7
0
        private void ChangeButton_DragDrop(object sender, DragEventArgs e)
        {
            ProcessButton button = sender as ProcessButton;
            var           files  = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (files.Length > 1)
            {
                MessageBox.Show("Too many files selected");
                return;
            }
            if (Path.GetExtension(files[0]).Equals(".exe", StringComparison.InvariantCultureIgnoreCase))
            {
                this.SetProgram(Path.GetFullPath(files[0]));
            }
            else
            {
                MessageBox.Show("Not an executable");
            }
        }
예제 #8
0
 private void btnRunningProcs_Click(object sender, EventArgs e)
 {
     ProcessButton.OpenRunningProcesses();
 }
예제 #9
0
파일: Form1.cs 프로젝트: mdoss/MultiLaunch
 private void form_Resize(object sender, EventArgs e)
 {
     SortButtons(ProcessButton.GetAllButtons());
 }
예제 #10
0
파일: Form1.cs 프로젝트: mdoss/MultiLaunch
 public void RemoveProgramButton(ProcessButton button)
 {
     Controls.Remove(button);
     button.RemoveButton();
 }
예제 #11
0
파일: Form1.cs 프로젝트: mdoss/MultiLaunch
 private void btnCloseAll_Click(object sender, EventArgs e)
 {
     ProcessButton.CloseAll();
 }
예제 #12
0
파일: Form1.cs 프로젝트: mdoss/MultiLaunch
 private void timerCheckRunning_Tick(object sender, EventArgs e) //hooking a driver function to tell when a process launched seemed like too much work, though i hate this way of checking if the process is running
 {
     ProcessButton.CheckRunning();
 }
예제 #13
0
        public void StopProcess(ProcessButton button)
        {
            var toKill = isButtonInList(button);

            toKill.Item1.Kill();
        }