Example #1
0
        public MainWindow()
        {
            CurrentInstance = this;
            InitializeComponent();
            tvdbhandler = new TVDB("517C3F261F6A0C96");

            XdataProvider = (XmlDataProvider)FindResource("Xmldata");
            _watchHandler = new WatchHandler();

            InitControls();
        }
Example #2
0
        public static IntPtr CreateWatch(int fd, WatchEventKind events, 
            WatchHandler handler, object source_id)
        {
            IntPtr channel = g_io_channel_unix_new(fd);
            IntPtr source = g_io_create_watch(channel, (int)MapEventsN(events));
            g_io_channel_unref(channel);

            object[] args = new object[2];
            args[0] = handler;
            args[1] = source_id;

            IntPtr data = (IntPtr)GCHandle.Alloc(args);
            DestroyNotify notify = DestroyHelper.NotifyHandler;
            g_source_set_callback(source, IOHandler, data, notify);

            return source;
        }
Example #3
0
        public override object AddWatch(OSHandle handle, WatchEventKind events, 
            WatchHandler handler)
        {
            object[] closure = new object[2];

            closure[0] = new EPollSourceID((uint)(int)(IntPtr)handle);
            closure[1] = handler;

            poll.AddWatch(handle, events);
            poll_handlers[(IntPtr)handle] = closure;

            Console.WriteLine("{0} = {1}", (IntPtr)handle, closure.GetHashCode());

            return closure[0];
        }
Example #4
0
 public static void RemoveWatchHandler(WatchHandler h)
 {
     handlerManager.handlers.Remove(h);
 }
Example #5
0
 public static void AddWatchHandler(WatchHandler h)
 {
     handlerManager.handlers.Add(h);
 }
Example #6
0
        public virtual object AddWatch(OSHandle handle, WatchEventKind events, WatchHandler handler)
        {
            if(handle.HandleKind != HandleKind.FD)
                throw new ArgumentException(String.Format("Handle of type \"{0}\" not supported by {1}", handle.HandleKind, GetType()));

            SourceID id_object = null;
            IntPtr source = GIOChannel.CreateWatch((int)((IntPtr)handle),
                events, handler, id_object);

            uint id = g_source_attach(source, Context);
            g_source_unref(source);

            id_object = new SourceID(id);

            return (object)id_object;
        }
Example #7
0
 public static void RemoveWatchHandler(WatchHandler h)
 {
     handlerManager.handlers.Remove(h);
 }
Example #8
0
 public static void AddWatchHandler(WatchHandler h)
 {
     handlerManager.handlers.Add(h);
 }
Example #9
0
 public static object AddWatch(OSHandle handle, WatchEventKind events, 
     WatchHandler handler)
 {
     return Native.Factory.GetLoop().AddWatch(handle, events, handler);
 }