Source

Resharper Spell Checker / ReSpeller / Settings / ReSpellerSettingsControl.xaml.cs

using System.Windows;
using System.Windows.Controls.Primitives;
using JetBrains.Application;
using JetBrains.DataFlow;
using JetBrains.UI.CrossFramework;
using JetBrains.UI.Options;
using JetBrains.UI.Options.OptionPages;
using JetBrains.Application.Settings;
using ReSpeller.SpellEngine;
using Xceed.Wpf.Toolkit;

namespace ReSpeller.Settings
{
  /// <summary>
  /// Interaction logic for ReSpellerSettingsControl.xaml
  /// </summary>
  [OptionsPage("ReSpellerSettings", "ReSpeller", typeof(ImgThemedIcons.Icon), ParentId = EnvironmentPage.Pid, Sequence = 100)]
  public partial class ReSpellerSettingsControl : IOptionsPage
  {
    private readonly OptionsSettingsSmartContext myStore;

    public ReSpellerSettingsControl(Lifetime lifetime, OptionsSettingsSmartContext store)
    {
      myStore = store;
      myStore.GetKey<ReSpellerSettings>(SettingsOptimization.DoMeSlowly);
      InitializeComponent();
      store.SetBinding(lifetime, (ReSpellerSettings s) => (bool?)s.SplitInPairs, SplitInPairsCheckBox, ToggleButton.IsCheckedProperty);
      store.SetBinding(lifetime, (ReSpellerSettings s) => (int?)s.MinWordLength, MinWordLengthUpDown, IntegerUpDown.ValueProperty);
      InstallPathBox.Text = Constants.PluginPath;
      DictionaryPathBox.Text = Constants.MainDictDir;
      UserDictionaryPathBox.Text = Constants.UserDictDir;
    }

    public bool OnOk()
    {
      var spellChecker = Shell.Instance.GetComponent<ISpellChecker>();
      spellChecker.UpdateConfig();
      return true;
    }

    public bool ValidatePage()
    {
      return true;
    }

    public EitherControl Control { get { return this; }  }
    public string Id { get { return "ReSpellerSettings"; } }
  }
}