source: extensions/PiwigoLib/TestPiwigoLib/Form1.cs @ 7149

Last change on this file since 7149 was 7149, checked in by bayral, 14 years ago

Piwigolib is now modify for mask the implementation of proxy.
Add start version of piwigo WPF

File size: 3.4 KB
Line 
1using System;
2using System.Windows.Forms;
3
4using Com.Piwigo.Lib.IService;
5using Com.Piwigo.Lib.DTO;
6
7
8namespace TestPiwigoLib
9{
10    public partial class Form1 : Form
11    {
12        public Form1()
13        {
14            InitializeComponent();
15        }
16
17        private void Form1_Load(object sender, EventArgs e)
18        {
19        }
20
21        private void button1_Click(object sender, EventArgs e)
22        {
23            UriBuilder urib = new UriBuilder();
24            urib.Host = tbServer.Text;
25            urib.Path = "phpwebgallery/ws.php";
26            urib.Scheme = "http://";
27
28            PwgServiceProvider.Instance.PwgSetupService.Setup("TestPiwigoLib", null, urib.Uri);
29
30
31            Console.WriteLine(urib.Uri.AbsoluteUri);
32
33            try
34            {
35                PwgSession sess = null;
36                sess = PwgServiceProvider.Instance.PwgSessionService.GetPwgSession();
37                Console.WriteLine("user : " + sess.UserName + " " + sess.Status);
38
39                sess = PwgServiceProvider.Instance.PwgSessionService.Login(tbUser.Text, tbPassword.Text);
40                Console.WriteLine("user : " + sess.UserName + " " + sess.Status);
41
42                //Boolean rc = PwgServiceProvider.Instance.PwgTagsService.AddTag("Loic");
43
44                //List<PwgTag> lstTag = PwgServiceProvider.Instance.PwgTagsService.GetAdminListOfTag();
45
46                //Int32 Page = 0;
47                //Int32 PerPage = 0;
48                //Int32 Count = 0;
49
50                //List<PwgImage> lstImg = PwgServiceProvider.Instance.PwgTagsService.GetListOfImagesFormTags(new List<Int32>() { 1, 7 },
51                //    null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
52                //    ref Page, ref PerPage, ref Count);
53
54                //List<PwgImage> lstImg = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfImagesFormCategory(1,
55                //    null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
56                //    ref Page, ref PerPage, ref Count);
57
58                //Console.WriteLine("lstImg : Page " + Page.ToString() + " PerPage " + PerPage);
59
60                //List<PwgCategory> lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetAdminListOfCategory();
61
62                //Int32 newid = 0;
63                //String msg = String.Empty;
64                //Boolean rc = PwgServiceProvider.Instance.PwgCategoriesService.AddCategory("test_cat", 1, ref  newid, ref msg);
65                //Console.WriteLine(String.Format("newid : {0} message : {1}", newid,msg));
66                //rc = PwgServiceProvider.Instance.PwgCategoriesService.UpdateCategoryInfo(newid, "test2", "rename cat");
67
68                PwgImageRate imgRate = PwgServiceProvider.Instance.PwgImagesService.RateImage(1, 5);
69
70                sess = PwgServiceProvider.Instance.PwgSessionService.Logout();
71                Console.WriteLine("user : " + sess.UserName + " " + sess.Status);
72            }
73            catch (PwgServiceException ex)
74            {
75                Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
76                Console.WriteLine(ex.Message);
77            }
78        }
79
80        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
81        {
82            global::TestPiwigoLib.Properties.Settings.Default.Save();
83        }
84    }
85}
Note: See TracBrowser for help on using the repository browser.