コード例 #1
0
        private void SeedRequestCompleteHandler(CapsClient client, OSD result, Exception error)
        {
            if (result != null && result.Type == OSDType.Map)
            {
                OSDMap respTable = (OSDMap)result;

                foreach (string cap in respTable.Keys)
                {
                    _Caps[cap] = respTable[cap].AsUri();
                }

                if (_Caps.ContainsKey("EventQueueGet"))
                {
                    Logger.DebugLog("Starting event queue for " + Simulator.ToString(), Simulator.Client);

                    _EventQueueCap              = new EventQueueClient(_Caps["EventQueueGet"]);
                    _EventQueueCap.OnConnected += EventQueueConnectedHandler;
                    _EventQueueCap.OnEvent     += EventQueueEventHandler;
                    _EventQueueCap.Start();
                }
            }
            else
            {
                // The initial CAPS connection failed, try again
                MakeSeedRequest();
            }
        }
コード例 #2
0
ファイル: Caps.cs プロジェクト: chrbayer84/SLAgentCSServer
        private void SeedRequestCompleteHandler(CapsClient client, LLSD result, Exception error)
        {
            if (result != null && result.Type == LLSDType.Map)
            {
                LLSDMap respTable = (LLSDMap)result;

                StringBuilder capsList = new StringBuilder();

                foreach (string cap in respTable.Keys)
                {
                    capsList.Append(cap);
                    capsList.Append(' ');

                    _Caps[cap] = respTable[cap].AsUri();
                }

                Logger.DebugLog("Got capabilities: " + capsList.ToString(), Simulator.Client);

                if (_Caps.ContainsKey("EventQueueGet"))
                {
                    Logger.DebugLog("Starting event queue for " + Simulator.ToString(), Simulator.Client);

                    _EventQueueCap              = new EventQueueClient(_Caps["EventQueueGet"]);
                    _EventQueueCap.OnConnected += new EventQueueClient.ConnectedCallback(EventQueueConnectedHandler);
                    _EventQueueCap.OnEvent     += new EventQueueClient.EventCallback(EventQueueEventHandler);
                    _EventQueueCap.Start();
                }
            }
            else
            {
                // The initial CAPS connection failed, try again
                MakeSeedRequest();
            }
        }
コード例 #3
0
        private void SeedRequestCompleteHandler(CapsClient client, OSD result, Exception error)
        {
            if (result != null && result.Type == OSDType.Map)
            {
                OSDMap respTable = (OSDMap)result;

                foreach (string cap in respTable.Keys)
                {
                    _Caps[cap] = respTable[cap].AsUri();
                }

                if (_Caps.ContainsKey("EventQueueGet"))
                {
                    Logger.DebugLog("Starting event queue for " + Simulator, Simulator.Client);

                    _EventQueueCap              = new EventQueueClient(_Caps["EventQueueGet"]);
                    _EventQueueCap.OnConnected += EventQueueConnectedHandler;
                    _EventQueueCap.OnEvent     += EventQueueEventHandler;
                    _EventQueueCap.Start();
                }

                OnCapabilitiesReceived(Simulator);
            }
            else if (
                error != null &&
                error is WebException exception &&
                exception.Response != null &&
                ((HttpWebResponse)exception.Response).StatusCode == HttpStatusCode.NotFound)
            {
                // 404 error
                Logger.Log("Seed capability returned a 404, capability system is aborting",
                           Helpers.LogLevel.Error);
            }
コード例 #4
0
        public void Start(Object swapChainPanel, int Width, int Height, EventManager events = null)
        {
            if (events == null)
            {
                m_Events = new EventManager(m_path);
            }
            else
            {
                m_Events = events;
            }

            EventQueueClient.Enqueue(new StartEvent());

            m_Events.Start(swapChainPanel, Width, Height);
        }
コード例 #5
0
ファイル: Caps.cs プロジェクト: RavenB/gridsearch
        private void SeedRequestCompleteHandler(CapsClient client, LLSD result, Exception error)
        {
            if (result != null && result.Type == LLSDType.Map)
            {
                LLSDMap respTable = (LLSDMap)result;

                StringBuilder capsList = new StringBuilder();

                foreach (string cap in respTable.Keys)
                {
                    capsList.Append(cap);
                    capsList.Append(' ');

                    _Caps[cap] = respTable[cap].AsUri();
                }

                Logger.DebugLog("Got capabilities: " + capsList.ToString(), Simulator.Client);

                if (_Caps.ContainsKey("EventQueueGet"))
                {
                    Logger.DebugLog("Starting event queue for " + Simulator.ToString(), Simulator.Client);

                    _EventQueueCap = new EventQueueClient(_Caps["EventQueueGet"]);
                    _EventQueueCap.OnConnected += new EventQueueClient.ConnectedCallback(EventQueueConnectedHandler);
                    _EventQueueCap.OnEvent += new EventQueueClient.EventCallback(EventQueueEventHandler);
                    _EventQueueCap.Start();
                }
            }
            else
            {
                // The initial CAPS connection failed, try again
                MakeSeedRequest();
            }
        }
コード例 #6
0
        public override Boolean Loop(Genie.Yuk.Event _event)
        {
            WinUtility        win   = Service.Resolve <WinUtility>();
            GameGraphics      gg    = Service.Resolve <GameGraphics>();
            CancellationToken token = Service.Resolve <CancellationToken>();

            if (_event != null)
            {
                if (_event.GetType() == typeof(StartEvent))
                {
                    Action myAction0 = (Action)(() =>
                    {
                        gg.Start();
                    });

                    Task taskA = Task.Run(myAction0);
                    taskA.Wait();

                    Action myAction1 = (Action)(() =>
                    {
                        while (!token.IsCancellationRequested)
                        {
                            gg.AlwaysRun();
                        }
                    });

                    win.OnUiThread(myAction1);

                    EventQueueClient.Enqueue(new GraphicsEvent());
                }
                else if (_event.GetType() == typeof(GraphicsEvent))
                {
                    lock (WriteServer.balanceLock)
                    {
                        ComponentManager.Update();
                        gg.Run(token);

                        System.Console.WriteLine("Draw Client");
                    }

                    EventQueueClient.Enqueue(new GraphicsEvent());
                }
                else if (_event.GetType() == typeof(JobEvent))
                {
                    JobEvent job = (JobEvent)_event;

                    Boolean doLoop = true;

                    while (doLoop)
                    {
                        try
                        {
                            Genie.Yuk.Event tmpEvent = job.Dequeue();
                            Loop(tmpEvent);
                        }
                        catch (InvalidOperationException e)
                        {
                            doLoop = false;
                        }
                    }
                }
                else if (_event.GetType() == typeof(StopEvent))
                {
                    System.Console.WriteLine("Stop");
                    return(false);
                }
            }

            return(true);
        }