コード例 #1
0
        private void Settings_Click(object sender, RoutedEventArgs e)
        {
            var settingsWin = new SettingsWindow(this.hotkeys);

            // Disable hotkeys while the settings window is open
            this.DisableHotkeys();

            settingsWin.Topmost = this.Topmost;  // if this window is topmost, make settings topmost so it's not hidden.
            settingsWin.ShowDialog();

            // Enable hotkeys again
            if (this.Settings.hotkeysActive)
            {
                this.EnableHotkeys();
            }

            // Settings have been changed - refresh notes and connection
            if (this.CurrentNoteFile != null)
            {
                this.Notes = new Parsing.NoteManager(this.CurrentNoteFile, this.Settings);
            }

            this.Renderer = new Parsing.Templater(this.Settings);
            this.RenderNotes();
        }
コード例 #2
0
        /// <summary>
        /// Open a notefile annd set it as the new set of notes for the program.
        /// </summary>
        private void OpenNotes()
        {
            var openFileDialog = new OpenFileDialog
            {
                Filter = "Note Files (*.txt;*.md;*.html)|*.txt;*.md;*.html|All Files (*.*)|*.*"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                this.CurrentNoteFile = openFileDialog.FileName;
                this.Notes           = new Parsing.NoteManager(openFileDialog.FileName, this.Settings);
                this.SplitOffset     = 0; // reset the offset
                this.RenderNotes();
            }
        }