コード例 #1
0
 /// <summary>
 /// Saves the changes made to this view.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="ViewModeEventArgs"/> that contains the event data.</param>
 private void GroupEditorViewSave(object sender, ViewModeEventArgs e)
 {
     if (e != null && e.SourceView.Equals(ViewMode.Editor))
     {
         this.ViewModel.SaveToDisk(e.TargetPath);
     }
 }
コード例 #2
0
 /// <summary>
 /// Copy the current application state to the user's clipboard.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="ViewModeEventArgs"/> that contains the event data.</param>
 private void TextEditorViewCopyToClipboard(object sender, ViewModeEventArgs e)
 {
     if (e != null && e.SourceView.Equals(ViewMode.TextEditor))
     {
         Clipboard.SetData(DataFormats.Text, this.txtHostsFileContent.Text);
     }
 }
コード例 #3
0
 /// <summary>
 /// Saves the changes made to this view.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="ViewModeEventArgs"/> that contains the event data.</param>
 private void TextEditorViewSave(object sender, ViewModeEventArgs e)
 {
     if (e != null && e.SourceView.Equals(ViewMode.TextEditor))
     {
         this.SaveChanges(e.TargetPath);
     }
 }
コード例 #4
0
        /// <summary>
        /// Discard all changes and reload the current hosts file from disk.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="ViewModeEventArgs"/> that contains the event data.</param>
        private void GroupEditorViewReloadFromDisk(object sender, ViewModeEventArgs e)
        {
            if (e == null || e.SourceView.Equals(ViewMode.Editor) == false || this.ViewModel == null)
            {
                return;
            }

            this.ViewModel.ReloadFromDisk();
        }
コード例 #5
0
        /// <summary>
        /// Copy the current application state to the user's clipboard.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="ViewModeEventArgs"/> that contains the event data.</param>
        private void GroupEditorViewCopyToClipboard(object sender, ViewModeEventArgs e)
        {
            if (e == null || e.SourceView.Equals(ViewMode.Editor) == false)
            {
                return;
            }

            string text = this.ViewModel.GetText();

            Clipboard.SetData(DataFormats.Text, text);
        }
コード例 #6
0
        /// <summary>Discard all changes and reload the the current hosts file.</summary>
        /// <param name="currentView">The current view.</param>
        public void ReloadFromDisk(ViewMode currentView)
        {
            if (this.Reload == null)
            {
                return;
            }

            ViewModeEventArgs e = new ViewModeEventArgs(currentView, null);

            this.Reload(this, e);
        }
コード例 #7
0
        /// <summary>
        /// Copy the current application state to the user's clipboard.
        /// </summary>
        /// <param name="currentView">The current <see cref="ViewMode"/>.</param>
        public void CopyToClipboard(ViewMode currentView)
        {
            if (this.Copy == null)
            {
                return;
            }

            ViewModeEventArgs e = new ViewModeEventArgs(currentView, null);

            this.Copy(this, e);
        }
コード例 #8
0
        /// <summary>Save the changes to the view-model back to the disk.</summary>
        /// <param name="currentView">The current <see cref="ViewMode"/>.</param>
        /// <param name="targetPath">The target Path.</param>
        public void SaveChanges(ViewMode currentView, string targetPath)
        {
            if (this.Save == null)
            {
                return;
            }

            ViewModeEventArgs e = new ViewModeEventArgs(currentView, targetPath);

            this.Save(this, e);
        }