示例#1
0
文件: Form1.cs 项目: eier/sbc
        public Form1()
        {
            InitializeComponent();

            space = new XcoSpace(8000);

            // Example of builing a new XcoQueue with the SQueue wrapper.
            // To notifications are added, the first for debugging purpose, the second for keeping track of the occupancy.

            SQueue<Ei> unbemalteEier = new SQueue<Ei>(space, "UnbemalteEier");
            unbemalteEier.queue.AddNotificationForEntryEnqueued(this.unbemalteEierCB);
            unbemalteEier.count.AddNotificationForEntryEnqueued(this.unbemalteEierNotifyCB);

            SQueue<Ei> bemalteEier = new SQueue<Ei>(space, "BemalteEier");
            bemalteEier.queue.AddNotificationForEntryEnqueued(this.bemalteEierCB);
            bemalteEier.count.AddNotificationForEntryEnqueued(this.bemalteEierNotifyCB);

            SQueue<SchokoHase> schokoHasen = new SQueue<SchokoHase>(space, "SchokoHasen");
            schokoHasen.queue.AddNotificationForEntryEnqueued(this.schokoHasenCB);
            schokoHasen.count.AddNotificationForEntryEnqueued(this.schokoHasenNotifyCB);

            SQueue<Nest> nester = new SQueue<Nest>(space, "Nester");
            nester.queue.AddNotificationForEntryEnqueued(this.nesterCB);
            nester.count.AddNotificationForEntryEnqueued(this.nesterNotifyCB);

            SQueue<Nest> geliefert = new SQueue<Nest>(space, "Ausgeliefert");
            geliefert.queue.AddNotificationForEntryEnqueued(this.ausgeliefertCB);
            geliefert.count.AddNotificationForEntryEnqueued(this.ausgeliefertNotifyCB);

            space_uri = new Uri("xco://127.0.0.1:8000");
        }
示例#2
0
文件: Form1.cs 项目: eier/sbc
        public Form1()
        {
            InitializeComponent();

            space = new XcoSpace(8000);

            // Example of builing a new XcoQueue with the SQueue wrapper.
            // To notifications are added, the first for debugging purpose, the second for keeping track of the occupancy.

            SQueue<Ei> unbemalteEier = new SQueue<Ei>(space, "UnbemalteEier");
            unbemalteEier.queue.AddNotificationForEntryEnqueued(this.unbemalteEierCB);
            unbemalteEier.count.AddNotificationForEntryEnqueued(this.unbemalteEierNotifyCB);

            SQueue<Ei> bemalteEier = new SQueue<Ei>(space, "BemalteEier");
            bemalteEier.queue.AddNotificationForEntryEnqueued(this.bemalteEierCB);
            bemalteEier.count.AddNotificationForEntryEnqueued(this.bemalteEierNotifyCB);

            SQueue<SchokoHase> schokoHasen = new SQueue<SchokoHase>(space, "SchokoHasen");
            schokoHasen.queue.AddNotificationForEntryEnqueued(this.schokoHasenCB);
            schokoHasen.count.AddNotificationForEntryEnqueued(this.schokoHasenNotifyCB);

            SQueue<Nest> nester = new SQueue<Nest>(space, "Nester");
            nester.queue.AddNotificationForEntryEnqueued(this.nesterCB);
            nester.count.AddNotificationForEntryEnqueued(this.nesterNotifyCB);

            SQueue<Nest> geliefert = new SQueue<Nest>(space, "Ausgeliefert");
            geliefert.queue.AddNotificationForEntryEnqueued(this.ausgeliefertCB);
            geliefert.count.AddNotificationForEntryEnqueued(this.ausgeliefertNotifyCB);

            space_uri = new Uri("xco://127.0.0.1:8000");
        }
示例#3
0
 // Constructor to build a new XcoQueue in local space.
 public SQueue(XcoSpace space, string name)
 {
     this.space = space;
     this.queue = new XcoQueue <T>(1000);
     this.count = new XcoQueue <int>(1000);
     this.space.Add(this.queue, name);
     this.space.Add(this.count, name + "Notify");
 }
示例#4
0
 // work() is called by the main-function or thread.
 // Build space and dio real_work();
 // In early development phase, the cause of some exceptions couldn't be identified, so a while loop keeps things alive.
 public virtual void work()
 {
     using (this.space = new XcoSpace(0))
     {
         while (true)
         {
             try
             {
                 real_work();
                 return;
             }
             catch (Exception e)
             {
                 Console.WriteLine(e.ToString());
             }
         }
     }
 }
示例#5
0
 // Constructor using container discovery.
 public SQueue(XcoSpace space, string name, Uri remote_space_uri)
 {
     this.space = space;
     this.queue = space.Get <XcoQueue <T> >(name, remote_space_uri);
     this.count = space.Get <XcoQueue <int> >(name + "Notify", remote_space_uri);
 }