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

Last change on this file since 4159 was 3861, checked in by bayral, 15 years ago

support for pwg.images.rate

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