summaryrefslogtreecommitdiffstats
path: root/tools/EventClients/examples/c#/XBMCDemoClient1.cs
blob: df74dea41fc1494631f8931546cc0c103a0ce084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using XBMC;

namespace XBMCEventClientDemo
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            EventClient eventClient = new EventClient();
            eventClient.Connect("127.0.0.1", 9777);

            string iconFile = @"../../icons/icon.png";
            IconType iconType = IconType.ICON_PNG;

            if !File.Exists(iconFile) {
                iconFile = @"/usr/share/xbmc/media/icon.png";
                if !File.Exists(iconFile) {
                    iconType = IconType.ICON_NONE;
                }
            }

            eventClient.SendHelo("XBMC Client Demo", iconType, iconFile);
            System.Threading.Thread.Sleep(1000);
            eventClient.SendNotification("XBMC Client Demo", "Notification Message", iconType, iconFile);
            System.Threading.Thread.Sleep(1000);
            eventClient.SendButton("dpadup", "XG", ButtonFlagsType.BTN_DOWN | ButtonFlagsType.BTN_NO_REPEAT, 0);
            System.Threading.Thread.Sleep(1000);
            eventClient.SendPing();
            System.Threading.Thread.Sleep(1000);
            eventClient.SendMouse(32768, 32768);
            System.Threading.Thread.Sleep(1000);
            eventClient.SendLog(LogTypeEnum.LOGERROR, "Example error log message from XBMC Client Demo");
            System.Threading.Thread.Sleep(1000);
            eventClient.SendAction("Mute");
            System.Threading.Thread.Sleep(1000);
            eventClient.SendBye();
        }
    }
}