source: extensions/PiwigoLib/PiwigoUpload/Service/Connect.cs @ 12262

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

piwigo.upload retrieve data, and ready to upload

File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6using Com.Piwigo.Lib.IService;
7using Com.Piwigo.Lib.DTO;
8
9using Com.Piwigo.Uploader.DTO;
10using Com.Piwigo.Uploader.Helper;
11
12namespace Com.Piwigo.Uploader.Service
13{
14    public class Connect: IService
15    {         
16        public void runService()
17        {
18            PwgServiceProvider.Instance.PwgSetupService.Setup("UploadToPiwigo", null, ModelManager.Instance.serveurName);
19
20            System.Diagnostics.Debug.WriteLine(ModelManager.Instance.serveurName.AbsoluteUri);
21
22            try
23            {
24                List<PwgCategory> lstPCat  = null;
25                ModelManager.Instance.sess = PwgServiceProvider.Instance.PwgSessionService.Login( ModelManager.Instance.userName,  ModelManager.Instance.password);
26                ModelManager.Instance.isConnected = true;
27
28                System.Diagnostics.Debug.WriteLine("user : " + ModelManager.Instance.sess.UserName + " " + ModelManager.Instance.sess.Status);
29
30                lstPCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(PwgCategory.RootCategoryId, true,null);
31
32                ModelManager.Instance.resetLstCat();
33
34                foreach (PwgCategory item in lstPCat)
35                {
36                    ModelManager.Instance.lstCat.Add(new SelectedCategoryListItem() { ShowedValue = (String.IsNullOrWhiteSpace(item.Name) ? "album " + item.Id : item.Name), Id = item.Id, Data = item, isSelected = false });
37                }
38
39            }
40            catch (PwgServiceException ex)
41            {
42                System.Diagnostics.Debug.WriteLine(ex.Message);
43                throw new ApplicationException ("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
44            }
45        }
46    }
47}
Note: See TracBrowser for help on using the repository browser.