source: extensions/PiwigoLib/PiwigoWpf/App.xaml.cs @ 12336

Last change on this file since 12336 was 12336, checked in by bayral, 13 years ago

rename category to Albums

File size: 2.5 KB
Line 
1using System.Windows;
2using System.Windows.Data;
3using Com.Piwigo.Lib.IService;
4using Com.Piwigo.Wpf.DTO;
5using Com.Piwigo.Wpf.DTO.Helper;
6
7namespace Com.Piwigo.Wpf
8{
9    /// <summary>
10    /// Interaction logic for App.xaml
11    /// </summary>
12    public partial class App : Application
13    {
14
15         void onAppStartup(object sender, StartupEventArgs args)
16        {
17
18            PwgModelManager.WPF_SynchronizationContext = System.Threading.SynchronizationContext.Current;
19
20            PwgServiceProvider.Instance.PwgSetupService.Setup( "Com.Piwigo.Wpf.PiwigoWPF", null, null);
21
22             // Model object was created in the app.xaml, so we have to link to them
23            PwgModelManager.Instance.Session = (PwgSessionWPF)(this.Resources["Session"] as ObjectDataProvider).Data;
24            PwgModelManager.Instance.AlbumList = (PwgRootAlbumListWPF)(this.Resources["Albums"] as ObjectDataProvider).Data;
25            PwgModelManager.Instance.ImageList = (PwgImageListWPF)(this.Resources["Images"] as ObjectDataProvider).Data;
26            PwgModelManager.Instance.TagsList = (PwgTagListWPF)(this.Resources["Tags"] as ObjectDataProvider).Data;
27
28            PwgModelManager.Instance.Session.ServeurName = global::Com.Piwigo.Wpf.Properties.Settings.Default.ServerNameData;
29            PwgModelManager.Instance.Session.UserName = global::Com.Piwigo.Wpf.Properties.Settings.Default.UserNameData;
30            PwgModelManager.Instance.Session.Password = global::Com.Piwigo.Wpf.Properties.Settings.Default.PwdData;
31            PwgModelManager.Instance.Session.SaveSetting = global::Com.Piwigo.Wpf.Properties.Settings.Default.SaveSettingData;
32
33            MainWindow  mainWindow = new MainWindow();
34            mainWindow.Show();
35        }
36
37         private void onAppExit(object sender, ExitEventArgs e)
38         {
39             PwgSessionWPF sess = (PwgSessionWPF)(this.Resources["Session"] as ObjectDataProvider).Data;
40
41             if (sess.SaveSetting)
42             {
43                 global::Com.Piwigo.Wpf.Properties.Settings.Default.ServerNameData = sess.ServeurName;
44                 global::Com.Piwigo.Wpf.Properties.Settings.Default.UserNameData = sess.UserName;
45                 global::Com.Piwigo.Wpf.Properties.Settings.Default.PwdData = sess.Password;
46                 global::Com.Piwigo.Wpf.Properties.Settings.Default.SaveSettingData = sess.SaveSetting;
47
48
49                 global::Com.Piwigo.Wpf.Properties.Settings.Default.Save();
50             }
51         }
52
53    }
54}
Note: See TracBrowser for help on using the repository browser.