示例#1
0
        internal static void LoadDataSet()
        {
            string         path           = "";
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                path = openFileDialog.FileName;
            }
            else
            {
                ExceptionWindow exceptionWindow = new ExceptionWindow();
                exceptionWindow.ExceptionText.Text = "No file selected!";
                exceptionWindow.Show();
            }

            DataStorage.ProgramList.Clear();

            using (StreamReader streamReader = new StreamReader(path))
            {
                do
                {
                    string line = "";
                    line = streamReader.ReadLine();

                    if (line != "FILEVALID")
                    {
                        DataStorage.ProgramList.Add(line);
                    }
                } while (streamReader.Peek() != -1);
            };
        }
示例#2
0
 public AutoStart()
 {
     foreach (var item in DataStorage.ProgramList)
     {
         try
         {
             P.StartInfo.FileName = item;
             P.Start();
         }
         catch (Exception ex)
         {
             ExceptionWindow exceptionWindow = new ExceptionWindow();
             exceptionWindow.ExceptionText.Text = ex.Message.ToString();
             exceptionWindow.Show();
         }
     }
 }
示例#3
0
        private void StartSelectedProgram(object sender, RoutedEventArgs e)
        {
            string SelectedItem = DisplayProgramListForManualstart.SelectedItem.ToString();
            int    position     = DisplayProgramListForManualstart.Items.IndexOf(SelectedItem);

            try
            {
                P.StartInfo.FileName = DataStorage.ProgramList[position];
                P.Start();
            }
            catch (Exception ex)
            {
                if (Application.Current.Windows.OfType <ExceptionWindow>().FirstOrDefault() == null)
                {
                    ExceptionWindow exceptionWindow = new ExceptionWindow();
                    exceptionWindow.ExceptionText.Text = ex.Message.ToString();
                    exceptionWindow.Show();
                }
            }
        }
示例#4
0
        public static void AddProgramToList()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                if (DataStorage.ProgramList.Contains(openFileDialog.FileName))
                {
                    ExceptionWindow exceptionWindow = new ExceptionWindow();
                    exceptionWindow.ExceptionText.Text = "Dieses Programm ist bereits in der Liste !";
                    exceptionWindow.Show();
                }
                else
                {
                    DataStorage.ProgramList.Add(openFileDialog.FileName);
                }
            }
            else
            {
                ExceptionWindow exceptionWindow = new ExceptionWindow();
                exceptionWindow.ExceptionText.Text = "No file selected!";
                exceptionWindow.Show();
            }
        }