using System; using System.Collections.Generic; using System.Linq; using System.Text; using Com.Piwigo.Lib.IService; using Com.Piwigo.Lib.DTO; using Com.Piwigo.Uploader.DTO; using Com.Piwigo.Uploader.Helper; namespace Com.Piwigo.Uploader.Service { public class Connect: IService { public void runService() { PwgServiceProvider.Instance.PwgSetupService.Setup("UploadToPiwigo", null, ModelManager.Instance.serveurName); System.Diagnostics.Debug.WriteLine(ModelManager.Instance.serveurName.AbsoluteUri); try { List lstPCat = null; ModelManager.Instance.sess = PwgServiceProvider.Instance.PwgSessionService.Login( ModelManager.Instance.userName, ModelManager.Instance.password); ModelManager.Instance.isConnected = true; System.Diagnostics.Debug.WriteLine("user : " + ModelManager.Instance.sess.UserName + " " + ModelManager.Instance.sess.Status); lstPCat = PwgServiceProvider.Instance.PwgAlbumsService.GetListOfAlbum(PwgAlbum.RootAlbumId, true,null); ModelManager.Instance.resetLstCat(); foreach (PwgAlbum item in lstPCat) { ModelManager.Instance.lstCat.Add(new SelectedAlbumListItem() { ShowedValue = (String.IsNullOrWhiteSpace(item.Name) ? "album " + item.Id : item.Name), Id = item.Id, Data = item, isSelected = false }); } } catch (PwgServiceException ex) { System.Diagnostics.Debug.WriteLine(ex.Message); throw new ApplicationException ("Erreur " + ex.NumeroErr + " " + ex.MessageErr); } } } }