Exemplo n.º 1
0
        private void updateFilePathListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormLoad formLoad = new FormLoad();

            this.Close();
            formLoad.Show();
        }
Exemplo n.º 2
0
 private void SearchPath(string lookingFile)
 {
     try
     {
         string[] readText = new string[File.ReadAllLines(Directory.GetCurrentDirectory() + @"\dirs.txt").Length];
         readText = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\dirs.txt");
         bool findIt = false;
         for (int i = 0; i < readText.Length && findIt == false; i++)
         {
             if (readText[i].Contains(lookingFile))
             {
                 findIt = true;
                 Process.Start(readText[i]);
             }
         }
         if (!findIt)
         {
             DialogResult warningDialogResult;
             warningDialogResult = MessageBox.Show("The file you wanted doesn't exist or David's file path list needs to be updated." +
                                                   "If you haven't specified the file path, you can do it by saying 'add a file' to David." +
                                                   " Do you want to update the whole file path list?", "Warning",
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (warningDialogResult == DialogResult.Yes)
             {
                 FormLoad formLoad = new FormLoad();
                 this.Close();
                 formLoad.Show();
             }
         }
     }
     catch
     {
         MessageBox.Show("There is an error accoured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        // When FormSplashScreen loaded, this method, implements its code block
        private void FormSplashScreen_Load(object sender, EventArgs e)
        {
            // Initializes backgroundWorkerSplashScreen.RunWorkerAsync() for hiding FormSplashScreen
            backgroundWorkerSplashScreen.RunWorkerAsync();

            // Checks out if dirs.txt is exist or empty
            // If its not exist than loads FormLoad and it creates "dirs.txt" by StreamWriter writer object which is in FormLoad already
            // If its exist but empty, loads FormLoad and it will overwrite to dirs.txt
            // If its exist and ok, loads FormMain directly
            if (new FileInfo("dirs.txt").Exists == false)
            {
                FormLoad formLoad = new FormLoad();
                formLoad.Show();
            }
            else if (new FileInfo("dirs.txt").Length == 0)
            {
                FormLoad formLoad = new FormLoad();
                formLoad.Show();
            }
            else
            {
                FormMain formMain = new FormMain();
                formMain.Show();
            }
        }
Exemplo n.º 4
0
        // This method is tha main method that updates all saved paths in dirs.txt
        private void Update_File_PathList()
        {
            // Information window for user, if user accepts, than updating file paths
            DialogResult updateDialogResult;

            updateDialogResult = MessageBox.Show("If you accept this message, David is going to update his path list." +
                                                 " This may take some time. Do you want to update?", "Want to update?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (updateDialogResult == DialogResult.Yes)
            {
                speechSynthesizer.Speak("Updating path list, I'm restarting");
                FormLoad formLoad = new FormLoad();
                formLoad.Show();
                this.Hide();
            }
        }
 private void FormSplashScreen_Load(object sender, EventArgs e)
 {
     backgroundWorkerSplashScreen.RunWorkerAsync();
     if (new FileInfo("dirs.txt").Exists == false)
     {
         FormLoad formLoad = new FormLoad();
         formLoad.Show();
     }
     else if (new FileInfo("dirs.txt").Length == 0)
     {
         FormLoad formLoad = new FormLoad();
         formLoad.Show();
     }
     else
     {
         FormMain formMain = new FormMain();
         formMain.Show();
     }
 }
Exemplo n.º 6
0
        // For searching wanted application path from David's application memory which is dirs.txt
        private void SearchPath(string lookingFile)
        {
            try
            {
                // Opens dirs.txt file, counts all line numbers and add all line numbers as element count to string[] readText
                string[] readText = new string[File.ReadAllLines(Directory.GetCurrentDirectory() + @"\dirs.txt").Length];
                // Opens dirs.txt file again and this thime adds all saved paths to readText string[] variable
                readText = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\dirs.txt");
                // We need this one for if it finds more than one same name it runs first one and cancels searching
                bool findIt = false;
                for (int i = 0; i < readText.Length && findIt == false; i++)
                {
                    if (readText[i].Contains(lookingFile))
                    {
                        findIt = true;
                        Process.Start(readText[i]);
                    }
                }
                // If it can't find anything than this dialog informs user about it and asks him for an update to all path list which is in dirs.txt
                if (!findIt)
                {
                    DialogResult warningDialogResult;
                    warningDialogResult = MessageBox.Show("The file you wanted doesn't exist or David's file path list needs to be updated." +
                                                          "If you haven't specified the file path, you can do it by saying 'add a file' to David." +
                                                          " Do you want to update the whole file path list?", "Warning",
                                                          MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    // If user accepts update than the FormLoad will be loaded and unupdated FormMain will be closed. Than FormLoad code blocks starting to update dirs.txt
                    if (warningDialogResult == DialogResult.Yes)
                    {
                        FormLoad formLoad = new FormLoad();
                        this.Hide();
                        formLoad.Show();
                    }
                }
            }
            catch { MessageBox.Show("There is an error accoured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }