Changeset 11922 for extensions/PiwigoLib/PiwigoWpf/Command
- Timestamp:
- Aug 8, 2011, 6:57:56 PM (13 years ago)
- Location:
- extensions/PiwigoLib/PiwigoWpf/Command
- Files:
-
- 1 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdConnect.cs
r11911 r11922 10 10 namespace Com.Piwigo.Wpf.Command 11 11 { 12 public sealed class PwgCmdConnect : PwgCmdBase12 public sealed class PwgCmdConnect : AsyncCommand 13 13 { 14 public override void Execute(object parameter) 14 public override string Text { get { return "Connect to server"; } } 15 16 protected override void OnExecute(object parameter) 15 17 { 16 18 try { 17 IsRunning = true;18 19 Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName); 19 20 SendUiInfo("Setting up server..."); 20 21 PwgServiceProvider.Instance.PwgSetupService.Setup(null, null, uriServer); 21 22 PwgSessionWPF sesWPF = PwgModelManager.Instance.Session; 22 23 SendUiInfo("Connecting to server..."); 23 24 PwgSession sess = null; 24 25 if (String.IsNullOrWhiteSpace(sesWPF.UserName) && String.IsNullOrWhiteSpace(sesWPF.Password)) … … 32 33 } 33 34 35 SendUiInfo("Retriving list of Category from server..."); 34 36 PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF); 35 37 … … 39 41 PwgCategoryListWPFHelper.ConvertPwgCategoryListToPwgCategoryListWPF(lstCat, ref lstCatWPF); 40 42 43 SendUiInfo("Setting up cache data ..."); 41 44 ImageCacheManager.Instance.SetCurrentServer(uriServer.AbsoluteUri); 45 42 46 43 IsRunning = false;44 47 } 45 48 catch (PwgServiceException ex) 46 49 { 47 Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr); 48 Console.WriteLine(ex.Message); 50 SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr); 49 51 } 50 52 51 53 } 52 54 } -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdDisconnect.cs
r11911 r11922 10 10 namespace Com.Piwigo.Wpf.Command 11 11 { 12 public sealed class PwgCmdDisconnect : PwgCmdBase12 public sealed class PwgCmdDisconnect : AsyncCommand 13 13 { 14 public override void Execute(object parameter) 14 public override string Text { get { return "Disconnect from server"; } } 15 16 protected override void OnExecute(object parameter) 15 17 { 16 18 try { 17 IsRunning = true;18 19 PwgSessionWPF sesWPF = PwgModelManager.Instance.Session; 19 20 21 SendUiInfo("Logging out ..."); 22 20 23 PwgSession sess = null; 21 24 sess = PwgServiceProvider.Instance.PwgSessionService.Logout(); 22 25 23 26 PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF); 24 27 28 SendUiInfo("Removing Image and Category ..."); 29 if (PwgModelManager.Instance.ImageList != null) 30 { 31 PwgModelManager.Instance.ImageList.Clear(); 32 } 33 25 34 if (PwgModelManager.Instance.CategoryList != null) 26 35 { … … 28 37 } 29 38 39 SendUiInfo("Unset cache data ..."); 30 40 ImageCacheManager.Instance.UnsetCurrentServer(); 31 32 IsRunning = false;33 41 } 34 42 catch (PwgServiceException ex) 35 43 { 36 Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr); 37 Console.WriteLine(ex.Message); 44 SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr); 38 45 } 39 40 46 } 41 47 } -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs
r11911 r11922 10 10 namespace Com.Piwigo.Wpf.Command 11 11 { 12 public sealed class PwgCmdGetImageforCategory : PwgCmdBase12 public sealed class PwgCmdGetImageforCategory : AsyncCommand 13 13 { 14 public override void Execute(object parameter) 14 public override string Text { get { return "Get images for a category"; } } 15 16 protected override void OnExecute(object parameter) 15 17 { 16 18 PwgCategoryWPF catParam; … … 19 21 Int32 acount = 0; 20 22 21 try { 23 try 24 { 22 25 Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName); 23 26 if (parameter is PwgCategoryWPF) 24 27 { 28 PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; 29 SendUiInfo("Removing image..."); 30 if (lstImgWPF != null) 31 { 32 lstImgWPF.Clear(); 33 } 34 25 35 catParam = (PwgCategoryWPF)parameter; 36 SendUiInfo("Setting up cache data..."); 26 37 ImageCacheManager.Instance.SetCurrentCategory(catParam.Id.ToString()); 27 38 39 SendUiInfo("Retriving images list from server..."); 28 40 List<PwgImage> lstImg = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfImagesFormCategory(catParam.Id, false, null, null, null, null, null, null, null, null, null, null, null, null, null, true, ref aPage, ref aPerPage, ref acount); 29 PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; 30 41 31 42 PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF); 32 43 } 33 34 44 } 35 45 catch (PwgServiceException ex) 36 46 { 37 Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr); 38 Console.WriteLine(ex.Message); 47 SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr); 39 48 } 40 41 49 } 42 50 } -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdProvider.cs
r11911 r11922 9 9 public static class PwgCmdProvider 10 10 { 11 public static PwgCmdBaseGetByType<T>()11 public static AsyncCommand GetByType<T>() 12 12 { 13 PwgCmdBaseobjICom;13 AsyncCommand objICom; 14 14 15 15 switch (typeof(T).Name) … … 32 32 } 33 33 34 public static PwgCmdBase_pwgCmdConnect;35 public static PwgCmdBasePwgCmdConnect34 public static AsyncCommand _pwgCmdConnect; 35 public static AsyncCommand PwgCmdConnect 36 36 { 37 37 get … … 45 45 } 46 46 47 public static PwgCmdBase_pwgCmdDisconnect;48 public static PwgCmdBasePwgCmdDisconnect47 public static AsyncCommand _pwgCmdDisconnect; 48 public static AsyncCommand PwgCmdDisconnect 49 49 { 50 50 get … … 58 58 } 59 59 60 public static PwgCmdBase_pwgCmdGetImageforCategory;61 public static PwgCmdBasePwgCmdGetImageforCategory60 public static AsyncCommand _pwgCmdGetImageforCategory; 61 public static AsyncCommand PwgCmdGetImageforCategory 62 62 { 63 63 get
Note: See TracChangeset
for help on using the changeset viewer.