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

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

pwg.tags.getImages support

File size: 2.5 KB
Line 
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;
13using Com.Piwigo.Lib.Proxy.Response;
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        {
27        }
28
29        private void button1_Click(object sender, EventArgs e)
30        {
31            PwgConfigProxy.PwgUserAgent = "TestPiwigoLib";
32            PwgConfigProxy.PwgServeurUriBuilder.Host = tbServer.Text;
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();
42                Console.WriteLine("user : " + sess.UserName + " " + sess.Status);
43
44                sess = PwgSessionService.Login(tbUser.Text,tbPassword.Text);
45                Console.WriteLine("user : " + sess.UserName + " " + sess.Status);
46
47                //Boolean rc = PwgTagsService.AddTag("Loic");
48
49                //List<PwgTag> lstTag = PwgTagsService.GetAdminListOfTag();
50                Int32 Page = 0;
51                Int32 PerPage = 0; 
52                Int32 Count = 0;
53
54                List<PwgImage> lstImg = PwgTagsService.GetListOfImagesFormTags(new List<Int32>() { 1, 7 },
55                    null, null, 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                sess = PwgSessionService.Logout();
61                Console.WriteLine("user : " + sess.UserName + " " + sess.Status);
62            }
63            catch (PwgServiceException ex)
64            {
65                Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
66                Console.WriteLine(ex.Message);
67            }
68        }
69
70        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
71        {
72            global::TestPiwigoLib.Properties.Settings.Default.Save();
73        }
74    }
75}
Note: See TracBrowser for help on using the repository browser.