[Gtk-sharp-list] ParamethrizedThreadNotify class

Abramov Daniel ex at vingrad.ru
Fri Oct 26 19:24:30 EDT 2007


Hello! I've written kind of wrapper for ThreadNotify class, if you want to
pass a parameter(s) to the method being invoked.
Thought it might be useful for some, so I post it here. Hope you'll add it
to SVN/

using System;
using Gtk;

namespace Gtk
{
    public delegate void ParametherizedReadyEvent<T> (T param);

    public class ParametherizedThreadNotify<T>
    {
        private ThreadNotify te;
        private ParametherizedReadyEvent<T> pre;
        private T param;

        public ParametherizedThreadNotify (ParametherizedReadyEvent<T> pre)
        {
            this.pre = pre;
            this.te = new ThreadNotify (this.ReadyEvent);
        }

        private void ReadyEvent ()
        {
            this.pre (this.param);
        }

        public void WakeupMain (T param)
        {
            this.param = param;
            this.te.WakeupMain ();
        }
    }
}

It's just that simple so I just copied it from clipboard and did not upload
the file.
I've tested it, and that works.

-- 
Best regards,
Daniel Abramov aka Exception
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20071027/ede63477/attachment.html 


More information about the Gtk-sharp-list mailing list