using System.Windows; using System.Windows.Data; using Com.Piwigo.Lib.IService; using Com.Piwigo.Wpf.DTO; namespace Com.Piwigo.Wpf { /// /// Interaction logic for App.xaml /// public partial class App : Application { void onAppStartup(object sender, StartupEventArgs args) { PwgServiceProvider.Instance.PwgSetupService.Setup( "Com.Piwigo.Wpf.PiwigoWPF", null, null); PwgModelManager.Instance.Session = (PwgSessionWPF)(this.Resources["Session"] as ObjectDataProvider).Data; PwgModelManager.Instance.CategoryList = (PwgCategoryListWPF)(this.Resources["Categories"] as ObjectDataProvider).Data; PwgModelManager.Instance.ImageList = (PwgImageListWPF)(this.Resources["Images"] as ObjectDataProvider).Data; PwgModelManager.Instance.Session.ServeurName = global::Com.Piwigo.Wpf.Properties.Settings.Default.ServerNameData; PwgModelManager.Instance.Session.UserName = global::Com.Piwigo.Wpf.Properties.Settings.Default.UserNameData; PwgModelManager.Instance.Session.Password = global::Com.Piwigo.Wpf.Properties.Settings.Default.PwdData; PwgModelManager.Instance.Session.SaveSetting = global::Com.Piwigo.Wpf.Properties.Settings.Default.SaveSettingData; MainWindow mainWindow = new MainWindow(); mainWindow.Show(); } private void onAppExit(object sender, ExitEventArgs e) { PwgSessionWPF sess = (PwgSessionWPF)(this.Resources["Session"] as ObjectDataProvider).Data; if (sess.SaveSetting) { global::Com.Piwigo.Wpf.Properties.Settings.Default.ServerNameData = sess.ServeurName; global::Com.Piwigo.Wpf.Properties.Settings.Default.UserNameData = sess.UserName; global::Com.Piwigo.Wpf.Properties.Settings.Default.PwdData = sess.Password; global::Com.Piwigo.Wpf.Properties.Settings.Default.SaveSettingData = sess.SaveSetting; global::Com.Piwigo.Wpf.Properties.Settings.Default.Save(); } } } }