public MainWindow() { IHighlightingDefinition definition; using (Stream stream = Resource.GetResource("E2.Syntax")) definition = HighlightingLoader.Load(XmlReader.Create(stream), HighlightingManager.Instance); HighlightingManager.Instance.RegisterHighlighting("Expression2", new[] {".txt"}, definition); CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close())); CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, Save)); CommandBindings.Add(new CommandBinding(ApplicationCommands.SaveAs, SaveAs)); CommandBindings.Add(new CommandBinding(ApplicationCommands.New, New)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Help, (s, e) => Resource.Export())); Closing += CheckSaveState; if (File.Exists("Settings.xml")) { using (Stream fs = new FileStream("Settings.xml", FileMode.Open)) { Settings = Settings.Load(fs); } } else { Settings = new Settings(); //new SettingsDialog(Settings).ShowDialog(); using (Stream fs = new FileStream("Settings.xml", FileMode.OpenOrCreate)) { Settings.Save(fs); } } if (String.IsNullOrEmpty(Settings.SteamPath)) { if (!FindSteamPath()) { Close(); return; } using (Stream fs = new FileStream("Settings.xml", FileMode.OpenOrCreate)) { Settings.Save(fs); } } if (!Settings.SteamPath.EndsWith(@"\")) Settings.SteamPath += @"\"; InitializeComponent(); UpdateFileList(Settings.SteamPath); }
// FIXME public SettingsDialog(Settings settings) { Settings = settings; InitializeComponent(); DataContext = settings; }