Ejemplo n.º 1
0
        /// <summary>
        /// Save, checking if the user changed the directory, and warning if it is the case.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSave_Click(object sender, EventArgs e)
        {
            // Save Update Checking preference
            Properties.Settings.Default["checkForUpdates"] = chkUpdates.Checked;

            // Save Double-Page Reader preference
            Properties.Settings.Default["doublePageReader"] = chkDblReader.Checked;

            // Save language preference
            Properties.Settings.Default["languageCode"] = cmboLang.SelectedItem.ToString().Substring(0, 2);

            // Check if the home directory was changed
            if (!(new DirectoryInfo(txtDirectory.Text).ToString().Equals(new DirectoryInfo((string)Properties.Settings.Default["homeDirectory"]).ToString())))
            {
                DialogResult result = MessageBox.Show("Changing the save directory will require a restart. Continue?", "MikuReader", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    Properties.Settings.Default["homeDirectory"] = txtDirectory.Text;
                    Properties.Settings.Default.Save();
                    Application.Restart();
                }
                else
                {
                    txtDirectory.Text = (string)Properties.Settings.Default["homeDirectory"];
                }
            }
            Properties.Settings.Default.Save();
            MessageBox.Show("Requested changes were saved", "MikuReader");
            startPage.RefreshContents();
        }
 /// <summary>
 /// Save tracking information when the user closes the window
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmReader_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (File.Exists(root.FullName + "\\tracker"))
     {
         File.WriteAllText(root.FullName + "\\tracker", String.Empty);
         File.WriteAllText(root.FullName + "\\tracker", cmboChapter.SelectedItem.ToString() + "|" + cmboPage.SelectedItem.ToString());
     }
     startPage.RefreshContents();
 }