Ignore:
Timestamp:
Aug 8, 2011, 6:57:56 PM (13 years ago)
Author:
bayral
Message:

Async image thumbail retriving

Location:
extensions/PiwigoLib/PiwigoWpf/Command
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdConnect.cs

    r11911 r11922  
    1010namespace Com.Piwigo.Wpf.Command
    1111{
    12     public sealed class PwgCmdConnect : PwgCmdBase
     12    public sealed class PwgCmdConnect : AsyncCommand
    1313    {
    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)
    1517        {
    1618            try {
    17                 IsRunning = true;
    1819                Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName);
    19 
     20                SendUiInfo("Setting up server...");
    2021                PwgServiceProvider.Instance.PwgSetupService.Setup(null, null, uriServer);
    2122                PwgSessionWPF sesWPF = PwgModelManager.Instance.Session;
    22                
     23                SendUiInfo("Connecting to server...");
    2324                PwgSession sess = null;
    2425                if (String.IsNullOrWhiteSpace(sesWPF.UserName) && String.IsNullOrWhiteSpace(sesWPF.Password))
     
    3233                }
    3334
     35                SendUiInfo("Retriving list of Category from server...");
    3436                PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF);
    3537
     
    3941                PwgCategoryListWPFHelper.ConvertPwgCategoryListToPwgCategoryListWPF(lstCat, ref lstCatWPF);
    4042
     43                SendUiInfo("Setting up cache data ...");
    4144                ImageCacheManager.Instance.SetCurrentServer(uriServer.AbsoluteUri);
     45           
    4246
    43                 IsRunning = false;
    4447            }
    4548            catch (PwgServiceException ex)
    4649            {
    47                 Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
    48                 Console.WriteLine(ex.Message);
     50                SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr);
    4951            }
    50 
     52           
    5153        }
    5254    }
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdDisconnect.cs

    r11911 r11922  
    1010namespace Com.Piwigo.Wpf.Command
    1111{
    12     public sealed class PwgCmdDisconnect : PwgCmdBase
     12    public sealed class PwgCmdDisconnect : AsyncCommand
    1313    {
    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)
    1517        {
    1618            try {
    17                 IsRunning = true;
    1819                PwgSessionWPF sesWPF = PwgModelManager.Instance.Session;
    1920               
     21                SendUiInfo("Logging out ...");
     22
    2023                PwgSession sess = null;
    2124                sess = PwgServiceProvider.Instance.PwgSessionService.Logout();
    2225
    2326                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
    2534                if (PwgModelManager.Instance.CategoryList != null)
    2635                {
     
    2837                }
    2938
     39                SendUiInfo("Unset cache data ...");
    3040                ImageCacheManager.Instance.UnsetCurrentServer();
    31 
    32                 IsRunning = false;
    3341            }
    3442            catch (PwgServiceException ex)
    3543            {
    36                 Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
    37                 Console.WriteLine(ex.Message);
     44                SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr);
    3845            }
    39 
    4046        }
    4147    }
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs

    r11911 r11922  
    1010namespace Com.Piwigo.Wpf.Command
    1111{
    12     public sealed class PwgCmdGetImageforCategory : PwgCmdBase
     12    public sealed class PwgCmdGetImageforCategory : AsyncCommand
    1313    {
    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)
    1517        {
    1618            PwgCategoryWPF catParam;
     
    1921            Int32 acount = 0;
    2022
    21             try {
     23            try
     24            {
    2225                Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName);
    2326                if (parameter is PwgCategoryWPF)
    2427                {
     28                    PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList;
     29                    SendUiInfo("Removing image...");
     30                    if (lstImgWPF != null)
     31                    {
     32                        lstImgWPF.Clear();
     33                    }
     34
    2535                    catParam = (PwgCategoryWPF)parameter;
     36                    SendUiInfo("Setting up cache data...");
    2637                    ImageCacheManager.Instance.SetCurrentCategory(catParam.Id.ToString());
    2738
     39                    SendUiInfo("Retriving images list from server...");
    2840                    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                   
    3142                    PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF);
    3243                }
    33              
    3444            }
    3545            catch (PwgServiceException ex)
    3646            {
    37                 Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
    38                 Console.WriteLine(ex.Message);
     47                SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr);
    3948            }
    40 
    4149        }
    4250    }
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdProvider.cs

    r11911 r11922  
    99    public static class PwgCmdProvider
    1010    {
    11         public static PwgCmdBase GetByType<T>()
     11        public static AsyncCommand GetByType<T>()
    1212        {
    13             PwgCmdBase objICom;
     13            AsyncCommand objICom;
    1414
    1515            switch (typeof(T).Name)
     
    3232        }
    3333
    34         public static PwgCmdBase _pwgCmdConnect;
    35         public static PwgCmdBase PwgCmdConnect
     34        public static AsyncCommand _pwgCmdConnect;
     35        public static AsyncCommand PwgCmdConnect
    3636        {
    3737            get
     
    4545        }
    4646
    47         public static PwgCmdBase _pwgCmdDisconnect;
    48         public static PwgCmdBase PwgCmdDisconnect
     47        public static AsyncCommand _pwgCmdDisconnect;
     48        public static AsyncCommand PwgCmdDisconnect
    4949        {
    5050            get
     
    5858        }
    5959
    60         public static PwgCmdBase _pwgCmdGetImageforCategory;
    61         public static PwgCmdBase PwgCmdGetImageforCategory
     60        public static AsyncCommand _pwgCmdGetImageforCategory;
     61        public static AsyncCommand PwgCmdGetImageforCategory
    6262        {
    6363            get
Note: See TracChangeset for help on using the changeset viewer.