private void Run_Button_Click(object sender, RoutedEventArgs e)
 {
     if (switchBox.IsChecked == true)
     {
         Switchturn switchturn = new Switchturn();
         switchturn.Show();
     }
     else
     {
         Proc.RunNewProcess(runTextBox.Text);
         runTextBox.Clear();
     }
 }
 private void Save_Button_Click(object sender, RoutedEventArgs e)
 {
     if (switchBox.IsChecked == true)
     {
         Switchturn switchturn2 = new Switchturn();
         switchturn2.Show();
     }
     else
     {
         DataManager.Serial(currentProcessList.LocalAll);
         Serialized win3 = new Serialized();
         win3.Show();
     }
 }
 private void ListItem_Button_Click(object sender, RoutedEventArgs e)
 {
     if (!switchBox.IsChecked == true)
     {
         indexOfListItem = listBox.SelectedIndex;
         window2 win2 = new window2();
         win2.Show();
     }
     else
     {
         Switchturn switchturn2 = new Switchturn();
         switchturn2.Show();
     }
 }
 private void runTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (switchBox.IsChecked == true)
     {
         Switchturn switchturn = new Switchturn();
         switchturn.Show();
     }
     else
     {
         if (e.Key == Key.Return)
         {
             Proc.RunNewProcess(runTextBox.Text);
             runTextBox.Clear();
         }
     }
 }
 private void Load_Button_Click(object sender, RoutedEventArgs e)
 {
     if (!switchBox.IsChecked == true)
     {
         onlineStaus        = false;
         currentProcessList = new Processes();
         int longestId   = -1;
         int longestName = -1;
         DataManager.DeSerial(currentProcessList);
         listBox.Items.Clear();
         foreach (var process in currentProcessList.LocalAll)
         {
             if (Convert.ToString(process.Id).Length > longestId)
             {
                 longestId = Convert.ToString(process.Id).Length;
             }
         }
         foreach (var process in currentProcessList.LocalAll)
         {
             if (process.Name.Length > longestName)
             {
                 longestName = process.Name.Length;
             }
         }
         foreach (var process in currentProcessList.LocalAll)
         {
             if (!string.IsNullOrEmpty(process.Comment))
             {
                 listBox.Items.Add("PID:".PadRight(6) + Convert.ToString(process.Id).PadRight(15 - Convert.ToString(process.Id).Length) +
                                   "Name:".PadRight(7) + Convert.ToString(process.Name) + "    Comment:   " + Convert.ToString(process.Comment));
             }
             else
             {
                 listBox.Items.Add("PID:".PadRight(6) + Convert.ToString(process.Id).PadRight(15 - Convert.ToString(process.Id).Length) + "Name:".PadRight(7) + Convert.ToString(process.Name));
             }
         }
     }
     else
     {
         Switchturn switchwindow = new Switchturn();
         switchwindow.Show();
     }
 }