예제 #1
0
파일: App.xaml.cs 프로젝트: gaeeyo/Unene
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     if (IsRunningOutOfBrowser)
     {
         Settings = UneneSettings.Load();
         Settings.GetWindowPosition(Application.Current.MainWindow);
     }
     this.RootVisual = new MainPage();
 }
예제 #2
0
파일: AppSettings.cs 프로젝트: gaeeyo/Unene
        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;
        }