Beispiel #1
0
        public void Refresh(int id_, string info_, bool checked_, Action <bool, int> clicked_)
        {
            this.m_item_id = id_;

            if (null != this.m_info_text)
            {
                for (int i = 0; i < this.m_info_text.Length; ++i)
                {
                    this.m_info_text[i].text = info_;
                    if (i > 0)
                    {
                        this.m_info_text[i].gameObject.SetActive(false);
                    }
                }

                ShowLable(checked_);
            }

            this.m_onItemIsClicked = clicked_;

            m_item_btn.Checked = checked_;

            if (null != m_icon_img)
            {
                m_icon_img.gameObject.SetActive(checked_);
            }
        }
        private bool ShowLevelUp(SafeAction act_, int delta_exp_)
        {
            Debug.Log("查看升级");

            int nextLevelExp    = Confetl.array.Find(conf => conf.level == GlobalInfo.MY_PLAYER_INFO.Level).exp;
            int currentDeltaExp = nextLevelExp - GlobalInfo.MY_PLAYER_INFO.UpgradeExp;

            Debug.Log(string.Format("查看升级 当前经验{0} 增加{1} 最终{2} 升级需要{3}", currentDeltaExp, delta_exp_, currentDeltaExp + delta_exp_, nextLevelExp));

            if (currentDeltaExp + delta_exp_ >= nextLevelExp)
            //if (Old_lvl < this.GetPlayerInfo(GlobalInfo.MY_PLAYER_ID).Level)
            {
                Debug.Log("升级确实提升");
                if (m_level_ups.Count > 0)
                {
                    DoShowLevelUp(act_);

                    return(true);
                }
                else
                {
                    StartWatchLevelUp();
                }
            }

            return(false);
        }
Beispiel #3
0
        public GameStudioPreviewService(SessionViewModel session)
        {
            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }
            this.session         = session;
            Dispatcher           = session.Dispatcher;
            AssetBuilderService  = session.ServiceProvider.Get <GameStudioBuilderService>();
            gameSettingsProvider = session.ServiceProvider.Get <GameSettingsProviderService>();

            Logger          = GlobalLogger.GetLogger("Preview");
            loggerDebugPage = EditorDebugTools.CreateLogDebugPage(Logger, "Preview");

            previewGameSettings = GameSettingsFactory.Create();
            previewGameSettings.GetOrCreate <RenderingSettings>().DefaultGraphicsProfile = GraphicsProfile.Level_11_0;
            UpdateGameSettings(gameSettingsProvider.CurrentGameSettings);
            previewCompileContext.SetGameSettingsAsset(previewGameSettings);
            previewCompileContext.CompilationContext = typeof(PreviewCompilationContext);

            previewGameThread = new Thread(SafeAction.Wrap(StrideUIThread))
            {
                IsBackground = true, Name = "PreviewGame Thread"
            };
            previewGameThread.SetApartmentState(ApartmentState.STA);
            previewGameThread.Start();

            // Wait for the window handle to be generated on the proper thread
            initializationSignal.WaitOne();
            host = new GameEngineHost(windowHandle);

            session.AssetPropertiesChanged           += OnAssetPropertyChanged;
            gameSettingsProvider.GameSettingsChanged += OnGameSettingsChanged;
        }
 private void InitializeInternal()
 {
     watcherCheckThread = new Thread(SafeAction.Wrap(RunCheckWatcher))
     {
         IsBackground = true, Name = "RunCheckWatcher thread"
     };
     watcherCheckThread.Start();
 }
        private TaskWrapper PrepareAndSend(string deviceId, string jsonData)
        {
            var msg = PrepareMessage(jsonData);

            var sh = new SafeAction <Message>(m => deviceClients[deviceId].SendEventAsync(msg), Logger);

            return(TaskWrapper.Run(() => sh.SafeInvoke(msg)));
        }
 public void Refresh(int idx_, string icon_name_, object info_, bool checked_, Action <bool, long> clicked_, Action <bool, long> pressed_)
 {
     Info                   = info_;
     this.m_item_idx        = idx_;
     this.m_icon_img.Sprite = icon_name_;
     m_item_btn.Checked     = false;
     this.m_onItemIsClicked = clicked_;
     m_item_btn.Checked     = checked_;
 }
Beispiel #7
0
        private TaskWrapper PrepareAndSend(string jsonData)
        {
            Message msg = PrepareMessage(jsonData);
            // send to the cloud asynchronously, but wait for completetion
            // this is actually serializing access to the SenderLink type

            var sh = new SafeAction <Message>(m => SendAmqpMessage(m), Logger);

            return(TaskWrapper.Run(() => sh.SafeInvoke(msg)));
        }
        public void Start( SensorEndpoint endpoint, int messagesToSend )
        {
            _messagesToSend = messagesToSend;
            _endpoint = endpoint;
            _doWorkSwitch = true;

            var sh = new SafeAction<int>( e => RunSocketAsClient( e ), _logger );

            TaskWrapper.Run( ( ) => sh.SafeInvoke( CONNECTION_RETRIES ) );
        }
        public void Start(SensorEndpoint endpoint, int messagesToSend)
        {
            _messagesToSend = messagesToSend;
            _endpoint       = endpoint;
            _doWorkSwitch   = true;

            var sh = new SafeAction <int>(e => RunSocketAsClient(e), _logger);

            TaskWrapper.Run(() => sh.SafeInvoke(CONNECTION_RETRIES));
        }
Beispiel #10
0
        public void Refresh(string icon_, string txt_, string ui_name_, Action <string> act_ = null)
        {
            m_icon.Sprite  = icon_;
            m_text.Text    = LocalizeModule.Instance.GetString(txt_);
            m_link_ui_name = ui_name_;

            if (null != act_)
            {
                m_act = act_;
            }
        }
Beispiel #11
0
 public void Refresh(long id_, string icon_, bool checked_, Action <bool, long> OnCheckd)
 {
     m_on_toggle_checked = OnCheckd;
     m_id        = id_;
     m_icon_name = icon_;
     //m_checked = checked_;
     if (checked_)
     {
         OnToggleChecked(true);
     }
 }
Beispiel #12
0
        public override bool Start(Func <string, int> enqueue)
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            var sh = new SafeAction(() => Listen(PORT, BAUD_RATE), _logger);

            TaskWrapper.Run(sh.SafeInvoke);

            return(true);
        }
        public override bool Start(Func <string, int> enqueue)
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            var sh = new SafeAction <int>((t) => RunForSerial(t), _logger);

            TaskWrapper.Run(() => sh.SafeInvoke(SLEEP_TIME_BETWEEN_SCAN));

            return(true);
        }
        public override bool Start(Func <string, int> enqueue)
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            var sh = new SafeAction <int>((t) => RunForSocket(t), _logger);

            TaskWrapper.Run(() => sh.SafeInvoke(CONNECTION_RETRIES));

            return(true);
        }
        public override bool Start( Func<string, int> enqueue )
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            var sh = new SafeAction( ( ) => Listen( PORT, BAUD_RATE ), _logger );

            TaskWrapper.Run( sh.SafeInvoke );

            return true;
        }
        public override bool Start( Func<string, int> enqueue )
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            var sh = new SafeAction<int>( ( t ) => RunForSerial( t ), _logger );

            TaskWrapper.Run( ( ) => sh.SafeInvoke( SLEEP_TIME_BETWEEN_SCAN ) );

            return true;
        }
Beispiel #17
0
        private void SendOutcome(Message message, Outcome outcome, object state)
        {
            int sent = Interlocked.Increment(ref _sentMessages);

            string messageToLog = Encoding.UTF8.GetString(message.Encode( ).Buffer);

            int jsonBracketIndex = messageToLog.IndexOf("{", System.StringComparison.Ordinal);

            if (jsonBracketIndex > 0)
            {
                messageToLog = messageToLog.Substring(jsonBracketIndex);
            }

            jsonBracketIndex = messageToLog.LastIndexOf("}", System.StringComparison.Ordinal);
            if (jsonBracketIndex > 0)
            {
                messageToLog = messageToLog.Substring(0, jsonBracketIndex + 1);
            }

            if (outcome is Accepted)
            {
#if DEBUG_LOG
                Logger.LogInfo("Message is accepted");
#endif

                if (sent == 1)
                {
                    _start = DateTime.Now;
                }

                if (Interlocked.CompareExchange(ref _sentMessages, 0, Constants.MessagesLoggingThreshold) == Constants.MessagesLoggingThreshold)
                {
                    DateTime now = DateTime.Now;

                    TimeSpan elapsed = (now - _start);

                    _start = now;

                    var sh = new SafeAction <String>(s => Logger.LogInfo(s), Logger);

                    TaskWrapper.Run(() => sh.SafeInvoke(
                                        String.Format("GatewayService sent {0} events to Event Hub succesfully in {1} ms ",
                                                      Constants.MessagesLoggingThreshold, elapsed.TotalMilliseconds.ToString( ))));
                }
            }
            else
            {
#if DEBUG_LOG
                Logger.LogInfo("Message is rejected: " + messageToLog);
#endif
            }
        }
Beispiel #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DynamicBuilder"/> class.
 /// </summary>
 /// <param name="name">The name of this instance. Used to name the created thread.</param>
 /// <param name="builder">The builder to use.</param>
 /// <param name="buildStepProvider">The build step provider to use.</param>
 public DynamicBuilder(Builder builder, IBuildStepProvider buildStepProvider, string name = null)
 {
     this.builder     = builder;
     dynamicBuildStep = new DynamicBuildStep(buildStepProvider, builder.ThreadCount);
     builderThread    = new Thread(SafeAction.Wrap(BuilderThread))
     {
         IsBackground = true
     };
     if (!string.IsNullOrEmpty(name))
     {
         builderThread.Name = name;
     }
 }
        public override bool Start( Func<string, int> enqueue )
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            //var sh = new SafeAction<int>( ( t ) => RunSocketAsClient( t ), _logger );
            var sh = new SafeAction( ( ) => RunSocketServer( ), _logger );

            TaskWrapper.Run( ( ) => sh.SafeInvoke( ) );

            return true;
        }
        public override bool Start(Func <string, int> enqueue)
        {
            _enqueue = enqueue;

            _doWorkSwitch = true;

            //var sh = new SafeAction<int>( ( t ) => RunSocketAsClient( t ), _logger );
            var sh = new SafeAction(() => RunSocketServer( ), _logger);

            TaskWrapper.Run(() => sh.SafeInvoke( ));

            return(true);
        }
        private void DoShowLevelUp(SafeAction act_)
        {
            LevelUpData data = new LevelUpData()
            {
                msg         = m_level_ups.Dequeue(),
                m_click_act = act_,
            };

            FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_LEVEL_UP);
            param.Param = data;

            EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
        }
Beispiel #22
0
        private FileVersionManager()
        {
            // Environment.SpecialFolder.ApplicationData
            asyncRequestAvailable = new AutoResetEvent(false);
            asyncRequests         = new ConcurrentQueue <AsyncRequest>();

            // Loads the file version cache
            tracker     = FileVersionTracker.GetDefault();
            asyncRunner = new Thread(SafeAction.Wrap(ComputeFileHashAsyncRunner))
            {
                Name = "File Version Manager", IsBackground = true
            };
            asyncRunner.Start();
        }
Beispiel #23
0
        public async Task StartClient(IPAddress address, int port)
        {
            var clientDone = new TaskCompletionSource <bool>();

            // note: we wrap in a thread because we use Connect (not async) and then MessageLoop is sync.
            // we should switch to ConnectAsync, and start thread only if MessageLoop is reached
            new Thread(() =>
            {
                SafeAction.Wrap(() => ClientThread(address, port).Wait())();
                clientDone.TrySetResult(true);
            }).Start();

            await clientDone.Task;
        }
 public void QueueChatResponseAction(string fromCharacter, SafeAction action)
 {
     Queue<SafeAction> queue;
     var loweredCharacterName = fromCharacter.ToLower();
     if (this._chatRecievedResponseQueue.TryGetValue(loweredCharacterName, out queue))
     {
         queue.Enqueue(action);
     }
     else
     {
         queue = new Queue<SafeAction>();
         this._chatRecievedResponseQueue.Add(loweredCharacterName, queue);
         queue.Enqueue(action);
     }
 }
        public void Start()
        {
            startTime = DateTime.Now;
            running   = true;

            monitorThread = new Thread(SafeAction.Wrap(() =>
            {
                if (TryConnectMonitor())
                {
                    buildMonitorRemote.StartBuild(builderId, startTime);
                }

                int delay = 300;
                while (running)
                {
                    Thread.Sleep(delay);
                    delay = SendThreadUpdate() ? 300 : 1000;
                }
                SendThreadUpdate();

                if (TryConnectMonitor())
                {
                    buildMonitorRemote.EndBuild(builderId, DateTime.Now);
                }

                try
                {
                    // ReSharper disable SuspiciousTypeConversion.Global
                    var communicationObj = buildMonitorRemote as ICommunicationObject;
                    // ReSharper restore SuspiciousTypeConversion.Global
                    if (communicationObj != null)
                    {
                        communicationObj.Close();
                    }
                }
                // We don't know the layer to close under the client channel so it might throw potentially any exception.
                // Let's ignore them all because at this step we're just cleaning up things.
                // ReSharper disable EmptyGeneralCatchClause
                catch
                // ReSharper restore EmptyGeneralCatchClause
                { }
            }))
            {
                IsBackground = true, Name = "Monitor Thread"
            };

            monitorThread.Start();
        }
Beispiel #26
0
        /// <summary>
        /// Create an empty register.
        /// </summary>
        public FontManager(IDatabaseFileProviderService fileProviderService)
        {
            contentManager = new ContentManager(fileProviderService);

            // Preload proper freetype native library (depending on CPU type)
            NativeLibraryHelper.Load("freetype.dll", typeof(FontManager));

            // create a freetype library used to generate the bitmaps
            freetypeLibrary = new Library();

            // launch the thumbnail builder thread
            bitmapBuilderThread = new Thread(SafeAction.Wrap(BuildBitmapThread))
            {
                IsBackground = true, Name = "Bitmap Builder thread"
            };
            bitmapBuilderThread.Start();
        }
        protected virtual void DataInQueue(QueuedItem data)
        {
            DataInQueueEventHandler newData = OnDataInQueue;

            if (newData != null)
            {
                var sh = new SafeAction <QueuedItem>(d => newData(d), Logger);

                TaskWrapper.Run(() => sh.SafeInvoke(data));
            }

            //
            // NO logging on production code, enable for diagnostic purposes for debugging
            //
#if DEBUG_LOG
            LogMessageReceived( );
#endif
        }
Beispiel #28
0
        public void Refresh(int id_, string icon_name_, string info_, bool checked_, Action <bool, int> clicked_, Action <bool, int> pressed_)
        {
            this.m_item_id         = id_;
            this.m_icon_img.Sprite = icon_name_;

            this.m_onItemIsClicked = clicked_;

            this.m_onItemIsLongPressed = pressed_;

            if (checked_)
            {
                m_selected_icon.Visible = true;
                m_onItemIsClicked.SafeInvoke(checked_, this.m_item_id);
            }
            else
            {
                m_selected_icon.Visible = false;
            }
        }
Beispiel #29
0
 public void Refresh(BindPromoptData data_)
 {
     if (data_.m_icon_name.Contains("http") || data_.m_icon_name.Contains("https"))
     {
         m_http_icon.TextureName = data_.m_icon_name;
         m_http_icon.Visible     = true;
         m_icon.Visible          = false;
     }
     else
     {
         m_icon.Sprite       = data_.m_icon_name;
         m_icon.Visible      = true;
         m_http_icon.Visible = false;
     }
     m_name_txt.Text    = data_.m_name;
     m_user_id_txt.Text = data_.m_user_id.ToString();
     m_lvl_txt.Text     = data_.m_lvl.ToString();
     m_OnOK             = data_.m_OnOK;
 }
        public void Refresh(OfficerInfo info, Action <long> OnSelected_, ENUM_SEARCH_MODE mode_)
        {
            m_info        = info;
            m_on_selected = OnSelected_;

            ConfOfficer officer_data = ConfOfficer.Get(info.OfficerId);

            m_tex.TextureName = officer_data.portrait;
            m_name_txt.Text   = LocalizeModule.Instance.GetString(officer_data.name);
            m_name_txt.color  = PoliceUILogicAssist.GetPoliceQualityColor(officer_data.quality);


            if (ENUM_SEARCH_MODE.E_SEARCH_ROOM == mode_)
            {
                m_skill_root.Visible   = true;
                m_keyword_root.Visible = false;

                m_lvl_icon.Sprite = PoliceUILogicAssist.GetPoliceRankIcon(info.Level);
                string icon, desc;
                if (SkillUtil.GetCurLevelSkillIconAndDesc(info.OfficerId, info.Level, out icon, out desc))
                {
                    m_skill_lvl_txt.Text  = info.Level.ToString();
                    m_skill_icon.Sprite   = icon;
                    m_skill_desc_txt.Text = desc;
                }
            }
            else if (ENUM_SEARCH_MODE.E_EVENTGAME == mode_)
            {
                m_skill_root.Visible   = false;
                m_keyword_root.Visible = true;
                m_lvl_icon.Sprite      = PoliceUILogicAssist.GetPoliceRankIcon(info.Level);
                List <long> keywords_id = EventGameUIAssist.GetPoliceKeyWordByOfficerID(info.OfficerId);
                m_keyword_grid.EnsureSize <EventGameKeywordItemView>(keywords_id.Count);

                for (int i = 0; i < m_keyword_grid.ChildCount; ++i)
                {
                    m_keyword_grid.GetChild <EventGameKeywordItemView>(i).Refresh(i, keywords_id[i]);
                    m_keyword_grid.GetChild <EventGameKeywordItemView>(i).Visible = true;
                }
            }
        }
Beispiel #31
0
        //--//

        public TaskWrapper SendMessage(T data)
        {
            Action <T> send = (d) =>
            {
                lock ( _sentMessages )
                {
                    if (_sentMessages.ContainsKey(d))
                    {
                        _sentMessages[d]++;
                    }
                    else
                    {
                        _sentMessages.Add(d, 1);
                    }
                }
            };

            var sh = new SafeAction <T>((d) => send(d), null);

            return(TaskWrapper.Run(() => sh.SafeInvoke(data)));
        }
Beispiel #32
0
        /// <summary>
        /// Create an empty register.
        /// </summary>
        public FontManager()
        {
            assetManager = new AssetManager();

            // Preload proper freetype native library (depending on CPU type)
            Core.NativeLibrary.PreloadLibrary("freetype.dll");

            // create a freetype library used to generate the bitmaps
            freetypeLibrary = new Library();

#if SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME
            Windows.System.Threading.ThreadPool.RunAsync(operation => SafeAction.Wrap(BuildBitmapThread)());
#else
            // launch the thumbnail builder thread
            bitmapBuilderThread = new Thread(SafeAction.Wrap(BuildBitmapThread))
            {
                IsBackground = true, Name = "Bitmap Builder thread"
            };
            bitmapBuilderThread.Start();
#endif
        }
Beispiel #33
0
        /// <summary>
        /// Create an empty register.
        /// </summary>
        public FontManager(IDatabaseFileProviderService fileProviderService)
        {
            contentManager = new ContentManager(fileProviderService);

            // Preload proper freetype native library (depending on CPU type)
            Core.NativeLibrary.PreloadLibrary("freetype.dll", typeof(FontManager));

            // create a freetype library used to generate the bitmaps
            freetypeLibrary = new Library();

#if XENKO_PLATFORM_UWP
            Windows.System.Threading.ThreadPool.RunAsync(operation => SafeAction.Wrap(BuildBitmapThread)());
#else
            // launch the thumbnail builder thread
            bitmapBuilderThread = new Thread(SafeAction.Wrap(BuildBitmapThread))
            {
                IsBackground = true, Name = "Bitmap Builder thread"
            };
            bitmapBuilderThread.Start();
#endif
        }
        private void LogMessageReceived( )
        {
            int sent = Interlocked.Increment(ref _receivedMessages);

            if (sent == 1)
            {
                _start = DateTime.Now;
            }

            if (Interlocked.CompareExchange(ref _receivedMessages, 0, Constants.MessagesLoggingThreshold) == Constants.MessagesLoggingThreshold)
            {
                DateTime now = DateTime.Now;

                TimeSpan elapsed = (now - _start);

                _start = now;

                var sh = new SafeAction <String>(s => Logger.LogInfo(s), Logger);

                TaskWrapper.Run(() => sh.SafeInvoke(
                                    String.Format("GatewayService received {0} events succesfully in {1} ms ", Constants.MessagesLoggingThreshold, elapsed.TotalMilliseconds.ToString( ))));
            }
        }
Beispiel #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorGameController{TEditorGame}"/> class.
        /// </summary>
        /// <param name="asset">The asset associated with this instance.</param>
        /// <param name="editor">The editor associated with this instance.</param>
        /// <param name="gameFactory">The factory to create the editor game.</param>
        protected EditorGameController([NotNull] AssetViewModel asset, [NotNull] GameEditorViewModel editor, [NotNull] EditorGameFactory <TEditorGame> gameFactory)
        {
            if (asset == null)
            {
                throw new ArgumentNullException(nameof(asset));
            }
            if (editor == null)
            {
                throw new ArgumentNullException(nameof(editor));
            }

            Asset  = asset;
            Editor = editor;
            GameSideNodeContainer = new SessionNodeContainer(asset.Session)
            {
                NodeBuilder = { NodeFactory = new AssetNodeFactory() }
            };

            //Logger = GlobalLogger.GetLogger("Scene");
            Logger    = new LoggerResult();
            debugPage = EditorDebugTools.CreateLogDebugPage(Logger, "Scene");

            // Create the game
            var builderService = asset.ServiceProvider.Get <GameStudioBuilderService>();

            Game = gameFactory(gameContentLoadedTaskSource, builderService.EffectCompiler, builderService.EffectLogPath);
            Game.PackageSettings = asset.ServiceProvider.Get <GameSettingsProviderService>();
            sceneGameThread      = new Thread(SafeAction.Wrap(SceneGameRunThread))
            {
                IsBackground = true, Name = $"EditorGameThread ({asset.Url})"
            };
            sceneGameThread.SetApartmentState(ApartmentState.STA);

            Debug  = new EditorGameDebugService();
            Loader = new EditorContentLoader(this, Logger, asset, Game);
        }
        private void LogMessageReceived( )
        {
            int sent = Interlocked.Increment( ref _receivedMessages );

            if( sent == 1 )
            {
                _start = DateTime.Now;
            }

            if( Interlocked.CompareExchange( ref _receivedMessages, 0, Constants.MessagesLoggingThreshold ) == Constants.MessagesLoggingThreshold )
            {
                DateTime now = DateTime.Now;

                TimeSpan elapsed = ( now - _start );

                _start = now;

                var sh = new SafeAction<String>( s => Logger.LogInfo( s ), Logger );

                TaskWrapper.Run( ( ) => sh.SafeInvoke(
                    String.Format( "GatewayService received {0} events succesfully in {1} ms ", Constants.MessagesLoggingThreshold, elapsed.TotalMilliseconds.ToString( ) ) ) );
            }
        }
Beispiel #37
0
 public void InvokeOperationSafely(SafeAction action)
 {
     try
     {
         action();
     }
     catch(DisplayToUserException e)
     {
         ExceptionUtilities.HandleDisplayToUserException(e);
     }
     catch (Exception e)
     {
         ExceptionUtilities.HandleUnexpectedException(e);
     }
 }
Beispiel #38
0
 void IPluginServices.InvokeOperationSafely(SafeAction action)
 {
     this.InvokeOperationSafely(action);
 }
 public void InvokeOperationSafely(SafeAction action)
 {
     try
     {
         action();
     }
     catch (Exception e)
     {
         this.Error.LogError(e);
     }
 }
 private static void CheckAndSetState(VTStateOptions desiredState, VTStateOptions checkState, SafeAction matchAction)
 {
     if ((desiredState & checkState) != 0)
     {
         matchAction();
     }
 }
        protected virtual void DataInQueue( QueuedItem data )
        {
            DataInQueueEventHandler newData = OnDataInQueue;

            if( newData != null )
            {
                var sh = new SafeAction<QueuedItem>( d => newData( d ), Logger );

                TaskWrapper.Run( ( ) => sh.SafeInvoke( data ) );
            }

            //
            // NO logging on production code, enable for diagnostic purposes for debugging 
            //
#if DEBUG_LOG
            LogMessageReceived( );
#endif
        }
        public void Start( SensorEndpoint endpoint )
        {
            var sh = new SafeAction<SensorEndpoint>( e => RunSocketServer( e ), _logger );

            TaskWrapper.Run( ( ) => sh.SafeInvoke( endpoint ) );
        }