private void Application_Startup(object sender, StartupEventArgs e) { if (IsRunningOutOfBrowser) { Settings = UneneSettings.Load(); Settings.GetWindowPosition(Application.Current.MainWindow); } this.RootVisual = new MainPage(); }
public static UneneSettings Load() { UneneSettings settings = new UneneSettings(); try { var stream = OpenSettingFile(false); if (stream != null) { using (stream) { var dcs = new DataContractSerializer(typeof(UneneSettings)); XmlReader xd = XmlDictionaryReader.Create(stream); settings = (UneneSettings)dcs.ReadObject(xd, true); stream.Dispose(); stream.Close(); } } } catch (Exception e) { MessageBox.Show("設定の読み込み中にエラーが発生しました。\n" + e.Message); } return settings; }