private void btnCheckReport_Click(object sender, EventArgs e)
        {
            GlobalVariables gv = new GlobalVariables();
            string          settingsFilePath = gv.directoryName + gv.settingsFile;

            //if the settings file does NOT exist then force initial settings
            //tell with MessageBox and open a ConfigurationForm
            if (!File.Exists(settingsFilePath))
            {
                MessageBox.Show("Looks like this is your first time using the" +
                                "program since I can't find your settings.  Fill out the " +
                                "settings form once and you should be good to go!");


                //open configuration form and initialize Vocab files
                //to users network drive
                ConfigurationForm cf = new ConfigurationForm();
                cf.ShowDialog();

                FileClerk.CreateDirectory();
                FileClerk.InitializeVocabularyFiles(gv.sourceFilesDirectory);
            }
            else  //if the settings file exists then go ahead with report check
            {
                //code for checking report
            }
        }
 private void btnSaveSettings_Click(object sender, EventArgs e)
 {
     //data 'validation'..must add more eventually. this only
     //checks for empty fields
     if (txtBody.Text != "" & txtComparison.Text != ""
         & txtImpression.Text != "" & txtTechnique.Text != "")
     {
         //save to config file
         FileClerk.SaveToConfigurationFile(txtTechnique.Text,
                                           txtComparison.Text, txtBody.Text, txtImpression.Text);
         this.Close();
     }
     else
     {
         MessageBox.Show("At least one field is blank.  Please fill it in");
     }
 }
        private void ConfigurationFrom_Load(object sender, EventArgs e)
        {
            //if settings file exists then prepopulate text fields in for form

            if (FileClerk.CheckIFSettingsFileExist())
            {
                //read text from file and put in known fields
                //indexes are the known order
                //alternative in future: could use key/value settings
                //so order won't matter
                string[] settings = FileClerk.ReadConfigurationFile();
                txtTechnique.Text  = settings[0];
                txtComparison.Text = settings[1];
                txtBody.Text       = settings[2];
                txtImpression.Text = settings[3];
            }
        }
Esempio n. 4
0
        static public void SaveToConfigurationFile(
            string technique, string comparison, string body,
            string impression)

        //Saves info from ConfigurationForm to file
        {
            string directoryName = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
                                   @"\REdit Files";
            string fileName = @"\REdit_Settings.txt";
            string pathname = directoryName + fileName;

            string[] keywords = { technique, comparison, body, impression };

            if (Directory.Exists(directoryName))
            {
                File.WriteAllLines(pathname, keywords);
            }
            else //if the directory does NOT exist, make the directory and
            //save info to a new settings file
            {
                FileClerk.CreateDirectory();
                File.WriteAllLines(pathname, keywords);
            }
        }