Exemplo n.º 1
0
 /*!
  * Override this function to handle Vixen events.
  * If a Vixen event handler has been registered OnVixen will be called.
  */
 protected virtual void OnVixen(VixenEventArgs e)
 {
     if (VixenEvent != null)
     {
         VixenEvent(this, e);
     }
 }
Exemplo n.º 2
0
 /*!
  * Events are moved from the Vixen SharedWorld to the C#
  * application through a shared event queue. Events
  * observed and handled by the Vixen SharedWorld object
  * are put into a queue. The Canvas3D class maintains a separate
  * thread which waits on this queue and converts any Vixen Events
  * it finds into C# Vixen.EventArgs and raises a .NET event
  * which can be handled in the C# application.
  */
 protected void EventLoop()
 {
     _stopevents = false;
     if ((_world == null) || (_scene == null))
     {
         return;
     }
     if ((_world.FileName != null) && SharedWorld.DoAsyncLoad)
     {
         _world.LoadAsync(_world.FileName, _scene);
     }
     while (!_stopevents)
     {
         try
         {
             Event ev = _world.NextEvent();
             if (ev == null)
             {
                 break;
             }
             string            name    = ev.GetName();
             EventArgs         args    = new VixenEventArgs(ev, RoutedVixenEvent);
             object[]          list    = { this, args };
             VixenEventHandler handler = new VixenEventHandler(PostVixenEvent);
             //SharedWorld.Trace("Canvas3D:Event " + name + "\n");
             Dispatcher.BeginInvoke(handler, list);
         }
         catch (Exception ex)
         {
             SharedWorld.LogError("exception in event loop " + ex.Message);
         }
     }
     _world.Stop();
 }
Exemplo n.º 3
0
        /*!
         * Events are moved from the Vixen SharedWorld to the C#
         * application through a shared event queue. Events
         * observed and handled by the Vixen SharedWorld object
         * are put into a queue. The Canvas3D class maintains a separate
         * thread which waits on this queue and converts any Vixen Events
         * it finds into C# Vixen.EventArgs and raises a .NET event
         * which can be handled in the C# application.
         */
        protected void EventLoop()
        {
            SharedWorld world = SharedWorld.Get();

            StopEvents = false;

            if (world.FileName != null)
            {
                world.LoadAsync(world.FileName, world.GetScene());
            }
            while (!StopEvents && (SharedWorld.Get() != null))
            {
                try
                {
                    Event ev = SharedWorld.Get().NextEvent();
                    if (ev == null)
                    {
                        break;
                    }
                    if (ev.GetType() == typeof(TrackEvent))
                    {
                        if (ev.Code != Event.TRACK)
                        {
                            Console.Write("ERROR: TrackEvent has bad opcode");
                        }
                    }
                    string            name    = ev.GetName();
                    EventArgs         args    = new VixenEventArgs(ev);
                    object[]          list    = { this, args };
                    VixenEventHandler handler = new VixenEventHandler(PostVixenEvent);
                    Trace("Canvas3D:Event " + name + "\n");
                    Invoke(handler, list);
                }
                catch (Exception ex)
                {
                    LogError("exception in event loop " + ex.Message);
                }
            }
            if (SharedWorld.Get() != null)
            {
                SharedWorld.Get().Stop();
            }
        }
Exemplo n.º 4
0
 protected void PostVixenEvent(object sender, VixenEventArgs args)
 {
     OnVixen(args);
     RaiseEvent(args);
     args.VixEvent.Code = 0;
 }