Exemple #1
0
        private void DoHeartBeat(object obj)
        {
            try
            {
                _heartbeatTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

                if (DateTime.Now.Subtract(SessionContext.LastSessionTime).TotalSeconds < 10)
                {
                    return;
                }

                Message msg = new Message(MessageType.HEARTBEAT);

                //SendMessage(msg,null);
                SendMessageNoSure(msg, null);
            }
            catch (Exception exp)
            {
                OnError(exp);
            }
            finally
            {
                if (!_stop)
                {
                    _heartbeatTimer.Change(SessionContext.HeadBeatInterVal, 0);
                }
            }
        }
Exemple #2
0
 private void OnBroadcastService(object state)
 {
     mBroadcastServiceTimer.Change(-1, -1);
     try
     {
         int count = mLocalServices.Count;
         if (count > 0)
         {
             Protocols.SyncServiceInfo services = new Protocols.SyncServiceInfo();
             services.RemoteNode = this.Node.ID;
             for (int i = 0; i < count; i++)
             {
                 services.Items.Add(mLocalServices[i].GetInfo());
             }
             string  receive = @".+@" + mSwitchName;
             Message msg     = new Message();
             msg.Data      = services;
             msg.Pulisher  = Name;
             msg.Consumers = receive;
             msg.Mode      = ReceiveMode.Regex;
             Publish(msg);
         }
     }
     catch (Exception e_)
     {
         Node.Loger.Process(LogType.ERROR, "bradcast service error {0}", e_.Message);
     }
     finally
     {
         mBroadcastServiceTimer.Change(1000, 1000);
     }
 }
 private void Start()
 {
     _isWorking = true;
     _windowMinimizer.MinimizeWindow();
     StartStopButtonContent = LocalizedStrings.MainWindowStopCaption;
     _sendTimer.Change(2000, SettingsViewModel.CheckInterval * 1000);
 }
Exemple #4
0
 private static void OnVerifyClients(object state)
 {
     try
     {
         lock (lockObject)
         {
             mDetectionTimer.Change(-1, -1);
             try
             {
                 if (removeLoggerConllection.TryDequeue(out var key))
                 {
                     loggerCollection.TryRemove(key, out _);
                 }
             }
             catch
             {
                 // ignored
             }
             finally
             {
                 mDetectionTimer.Change(1000 * 60 * 10, 1000 * 60 * 10);
             }
         }
     }
     catch (Exception)
     {
         //ignore
     }
 }
Exemple #5
0
 public void StartRinging()
 {
     if (wavFileExists)
     {
         timer.Change(0, 2500);
     }
 }
        /// <summary>
        /// 发时心跳
        /// </summary>
        private void sendHeartbeat(System.Threading.CancellationToken token)
        {
            if (timerSendHeartbeat == null)
            {
                timerSendHeartbeat = new System.Threading.Timer(f =>
                {
                    if (!this._isConnect)
                    {
                        timerSendHeartbeat.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                    }
                    else
                    {
                        Log(LogType.Info, "发送心跳请求");
                        var wsm = new WebSocketMessage
                        {
                            AppKey  = _appKey,
                            Type    = WebSocketMessageType.HEARTBEAT,
                            PubTime = AlibabaSDK.Utility.DateTimeHelper.GetCurrentTimestamp(),
                        };
                        wsm.Sign = sign(wsm, _clientSecret);
                        send(wsm, token);
                    }
                }, null,
                                                                System.Threading.Timeout.Infinite,
                                                                System.Threading.Timeout.Infinite
                                                                );
            }

            var FETCH_PERIOD = 20;

            timerSendHeartbeat.Change(FETCH_PERIOD * 1000L, FETCH_PERIOD * 1000L);
        }
Exemple #7
0
 void pollTimer_Tick(object state)
 {
     if (joyReady)
     {
         joyReady = gamePoller.Poll();
         if (!joyReady)
         {
             SetNotifierState(joyReady);
             pollTimer.Change(500, 500);
             if (WindowState == FormWindowState.Minimized)
             {
                 notifyIcon1.ShowBalloonTip(3000, Text, "One of the controllers was disconnected", ToolTipIcon.None);
             }
         }
     }
     else if (gamePoller.ValidateDeviceExistance())
     {
         pollTimer.Change(0, 10);
         joyReady = true;
         SetNotifierState(joyReady);
         if (WindowState != FormWindowState.Minimized)
         {
             WindowState = FormWindowState.Minimized;
         }
         else
         {
             notifyIcon1.ShowBalloonTip(3000, Text, "Controllers back on-line", ToolTipIcon.None);
         }
     }
 }
 private void OnTrackUpdate(object state)
 {
     mTimer.Change(-1, -1);
     foreach (Configuration item in mManagers.Values)
     {
         try
         {
             string config = item.ConfigLoader.Load();
             if (Configuration.MD5Encoding(config) != item.ConfigMD5)
             {
                 item.LoadConfig(config);
                 if (ConfigurationUpdated != null)
                 {
                     ConfigurationUpdated(this, new ConfigurationUpdateArgs {
                         Configuration = item
                     });
                 }
             }
         }
         catch (Exception e_)
         {
         }
     }
     mTimer.Change(10000, 10000);
 }
Exemple #9
0
        public LyncClient()
        {
            _listeners = new List <ILyncListener>();

            _updateTimer = new System.Threading.Timer((Object _) =>
            {
                Status_Changed(null, null);
            }, null, System.Threading.Timeout.Infinite, STATUS_CHECK_TIMEOUT);

            _clientCheckTimer = new System.Threading.Timer((Object _) =>
            {
                try
                {
                    var client = Microsoft.Lync.Model.LyncClient.GetClient();

                    if (client.State == ClientState.SignedIn)
                    {
                        _clientCheckTimer.Change(System.Threading.Timeout.Infinite, SIGNIN_CHECK_TIMEOUT);
                        _updateTimer.Change(0, STATUS_CHECK_TIMEOUT);

                        client.StateChanged += SignInChanged;
                        client.Self.Contact.ContactInformationChanged += Status_Changed;
                    }
                }
                catch
                {
                }
            }, null, 0, SIGNIN_CHECK_TIMEOUT);
        }
        public async void Start()
        {
            var boxes = await _boxRepo.GetAll();

            // On start up call AssetConfigurationLock is not needed.
            _assetConfiguration = boxes.ToArray();

            // Start Primary Subscriber. Uses BestBidAsk Model
            _primarySubscriber = CreateSubscriber <BestBidAsk>(_settings.PricesSettingsBoxOptions.PrimaryFeed,
                                                               PrimaryMessageReceived_BestBidAsk);

            LogInfo("Start", $"AssetQuoteSubscriber Primary Feed [{_settings.PricesSettingsBoxOptions.PrimaryFeed.RabbitMqConnectionString}]");
            if (_settings.PricesSettingsBoxOptions.SecondaryFeed != null)
            {
                // Start Secondary Subscriber. Uses Asset quote model
                _secondarySubscriber = CreateSubscriber <AssetQuote>(
                    _settings.PricesSettingsBoxOptions.SecondaryFeed,
                    SecondaryMessageReceived_AssetQuote);
                if (_secondarySubscriber != null)
                {
                    LogInfo("Start", $"AssetQuoteSubscriber Secondary Feed [{_settings.PricesSettingsBoxOptions.SecondaryFeed.RabbitMqConnectionString}]");
                }
            }

            // Start Timer to check incoming dataconnection
            int CheckInterval = _settings.PricesSettingsBoxOptions.NoFeedSlackReportInSeconds;

            _checkConnectionTimer.Change(CheckInterval * 1000, -1);
        }
 void OnChangeTimer(object t)
 {
     bFirstRun = true;
     if (IsDisabled)
     {
         StopGenerator();
         return;
     }
     if (Gen_Config_PropertyUpdateInterval > 0)
     {
         if (m_Timer == null)
         {
             m_Timer = new System.Threading.Timer(GenerateStressThingData, this, 5000, System.Threading.Timeout.Infinite); // Wait 5 s to give receivers time to initialize.
         }
         else
         {
             m_Timer.Change(Gen_Config_PropertyUpdateInterval, System.Threading.Timeout.Infinite);
         }
         if (!g_sw.IsRunning)
         {
             g_sw.Start();
         }
         IsStarted = true;
         MyBaseThing.StatusLevel = 1;
         MyBaseThing.LastMessage = "Generator started";
     }
     else
     {
         StopGenerator();
     }
 }
        private void btnBegin_Click(object sender, RoutedEventArgs e)
        {
            int                  pointsCount   = Convert.ToInt32(((ComboBoxItem)cbxPointCount.SelectedItem).Content);
            LayerOverlay         pointsOverlay = (LayerOverlay)mapView.Overlays["PointsOverlay"];
            InMemoryFeatureLayer pointsLayer   = (InMemoryFeatureLayer)pointsOverlay.Layers["PointsLayer"];

            pointsLayer.InternalFeatures.Clear();
            for (int i = 0; i < pointsCount; i++)
            {
                PointShape pointShape = GetRandomPoint(pointsBoundary);
                string     id         = GetRandomDirection().ToString();
                Feature    feature    = new Feature(pointShape.X, pointShape.Y, id);
                pointsLayer.InternalFeatures.Add(feature);
            }

            pointsOverlay.Refresh();

            // Starts the move points timer
            movePointsTimer.Change(0, Convert.ToInt32(((ComboBoxItem)cbxRedrawInterval.SelectedItem).Content));

            // Starts the color changing timer
            changeColorTimer.Change(0, Convert.ToInt32(((ComboBoxItem)cbxChangeColorInterval.SelectedItem).Content));

            btnBegin.IsEnabled = false;
            btnStop.IsEnabled  = true;
        }
Exemple #13
0
        private void OnTime(object state)
        {
            mTimer.Change(-1, -1);
            try
            {
                if (mCurrentTest != null)
                {
                    Loger.Process(LogType.DEBUG, mCurrentTest.StatisticalInfo.ToString());
                    Network.StatisticalReport resport = new Network.StatisticalReport();
                    resport.UnitTest = Name;
                    resport.Info     = mCurrentTest.StatisticalInfo;
                    mClient.Send(resport);

                    Network.ReportDelayTimes reporttimes = new ReportDelayTimes();
                    reporttimes.UnitTest = this.Name;
                    reporttimes.Times    = mCurrentTest.GetDelayTimes();
                    mClient.Send(reporttimes);

                    Network.ReportErrors reportErrors = new ReportErrors();
                    reportErrors.UnitTest = this.Name;
                    reportErrors.Errors   = mCurrentTest.GetErrors();
                    mClient.Send(reportErrors);
                }
            }
            catch (Exception e_)
            {
            }
            finally
            {
                mTimer.Change(1000, 1000);
            }
        }
Exemple #14
0
        //Evento de quando um Controle é arrastado
        private void Draggable_Hold(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                //Define o Parent do Controle como a Form o "puxa" para frente e define sua posição
                //para o mouse.
                DragBox.DragLabel dragLabel = sender as DragBox.DragLabel;
                if (dragLabel.Parent.GetType().ToString().Equals("DragBox.DragBox"))
                {
                    ((DragBox.DragBox)dragLabel.Parent).Empty = true;
                }
                dragLabel.AutoSize = true;
                dragLabel.Linked   = false;
                dragLabel.Parent   = this;
                dragLabel.BringToFront();
                dragLabel.Location = this.PointToClient(Cursor.Position);

                //Inicia o método Mouse_Up com delay de 0.1s caso o mesmo seja nulo, ou reseta o timer
                //caso já exista.
                if (mouseUpTimer == null)
                {
                    mouseUpTimer = new System.Threading.Timer(obj => { Mouse_Up(dragLabel); }, null, 100, System.Threading.Timeout.Infinite);
                }
                else
                {
                    mouseUpTimer.Change(100, System.Threading.Timeout.Infinite);
                }
            }
        }
Exemple #15
0
 private void OnDetectionHandler(object state)
 {
     mDetectionTimer.Change(-1, -1);
     try
     {
         List <ISession> sessions = new List <ISession>();
         double          time     = GetRunTime();
         foreach (var item in GetOnlines())
         {
             if (item.TimeOut < time)
             {
                 sessions.Add(item);
             }
         }
         if (sessions.Count > 0)
         {
             OnSessionTimeout(sessions);
         }
         if (EnableLog(LogType.Info))
         {
             Log(LogType.Info, null, "detection sessions completed");
         }
     }
     catch (Exception e_)
     {
         Error(e_, null, "detection sessions error");
     }
     finally
     {
         mDetectionTimer.Change(mTimeOutCheckTime, mTimeOutCheckTime);
     }
 }
Exemple #16
0
        public void EnableTopMost(bool bEnable)
        {
            if (this.InvokeRequired)
            {
                while (!this.IsHandleCreated)
                {
                    if (this == null || this.IsDisposed)
                    {
                        return;
                    }
                }
                EnableTopMostDel cs = new EnableTopMostDel(EnableTopMost);
                this.Invoke(cs, new object[] { bEnable });
                return;
            }

            if (_instance != null && !_instance.IsDisposed)
            {
                _instance.TopMost = bEnable;
                if (bEnable)
                {
                    _topmostTimer.Change(300, 20000);
                }
                else
                {
                    _topmostTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                }
            }
        }
Exemple #17
0
 /// <summary>
 /// Stops the task manager from executing tasks.
 /// </summary>
 public static void Stop()
 {
     if (_timer != null)
     {
         _timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
     }
 }
Exemple #18
0
        internal NodeGroup(RelayNodeGroupDefinition groupDefinition, RelayNodeConfig nodeConfig, ForwardingConfig forwardingConfig)
        {
            GroupDefinition   = groupDefinition;
            Activated         = groupDefinition.Activated;
            _clusterByRange   = groupDefinition.UseIdRanges;
            _forwardingConfig = forwardingConfig;

            RelayNodeClusterDefinition myClusterDefinition = NodeManager.Instance.GetMyNodeClusterDefinition();

            foreach (RelayNodeClusterDefinition clusterDefintion in groupDefinition.RelayNodeClusters)
            {
                NodeCluster nodeCluster = new NodeCluster(clusterDefintion, nodeConfig, this, forwardingConfig);
                if (clusterDefintion == myClusterDefinition)
                {
                    MyCluster = nodeCluster;
                }
                Clusters.Add(nodeCluster);
            }

            _nodeReselectTimerCallback = new System.Threading.TimerCallback(NodeReselectTimer_Elapsed);
            if (_nodeReselectTimer == null)
            {
                _nodeReselectTimer = new System.Threading.Timer(_nodeReselectTimerCallback);
            }
            _nodeReselectTimer.Change(NodeReselectIntervalMilliseconds, NodeReselectIntervalMilliseconds);

            QueueTimerCallback = new System.Threading.TimerCallback(QueueTimer_Elapsed);
            if (QueueTimer == null)
            {
                QueueTimer = new System.Threading.Timer(QueueTimerCallback);
            }
            QueueTimer.Change(DequeueIntervalMilliseconds, DequeueIntervalMilliseconds);
        }
Exemple #19
0
 private void OnTimeOut(object state)
 {
     mTimer.Change(-1, -1);
     try
     {
         for (int i = 0; i < awaiterManager.AwaiterTables.Count; i++)
         {
             var items = awaiterManager.AwaiterTables[i].TimeOut(TimeWatch.GetElapsedMilliseconds());
             if (items.Count > 0)
             {
                 for (int k = 0; k < items.Count; k++)
                 {
                     ThrowBlockException(items[k].ID, $"{items[k].ID} process timeout!");
                 }
             }
         }
     }
     catch (Exception e_)
     {
         OnError(null, TIMEOUT_PROCESS_ERROR, "TimeOut handler error", e_);
     }
     finally
     {
         mTimer.Change(1000, 1000);
     }
 }
Exemple #20
0
        public async Task UpdateLifeTotalAsync(int i)
        {
            await Task.Run(() =>
            {
                lock (this)
                {
                    if (!CanGoNegative && (LifeTotal + i < 0))
                    {
                        return;
                    }

                    LifeTotal += i;

                    LifeChangedAmmount += i;
                    if (LifeChangedAmmountTimer == null)
                    {
                        LifeChangedAmmountTimer = new System.Threading.Timer(LifeChangedAmmountTimerCallback, null, 3000, -1);
                    }
                    else
                    {
                        LifeChangedAmmountTimer.Change(1000, -1);
                    }

                    //string leftTxt, rightTxt;
                    //LifeTotalToText(out leftTxt, out rightTxt);

                    UpdateLifeTextBox(LifeTotal.ToString());
                    LifeChanged?.Invoke(this, new LifeChangedEventArgs(i));
                    LifeChangeHistory?.Invoke(this, new LifeChangedEventArgs(LifeChangedAmmount));
                }
            });
        }
        public void Start(int NumberOfHandlerThreads, int HandlerThreadsSleep)
        {
            Trace.TraceInformation("Enter.");

            _HandlerThreadsSleep = HandlerThreadsSleep;

            for (int i = 0; i < NumberOfHandlerThreads; i++)
            {
                _Handlers.Add(new System.Threading.Thread(_Handler));
            }

            Trace.TraceInformation("Total Handlers: " + _Handlers.Count.ToString());

            int counter = 0;

            foreach (System.Threading.Thread thr in _Handlers)
            {
                thr.Name = "handler_thread_" + counter.ToString();


                if (!_thrStats.ContainsKey(thr.Name))
                {
                    _thrStats.Add(thr.Name, false);
                }

                counter++;
                thr.Start();
                System.Threading.Thread.Sleep(250);
            }

            _tmrMonitorHandlers.Change(INTERVALMONITORHANDLERS, INTERVALMONITORHANDLERS);

            Trace.TraceInformation("Exit.");
        }
        private async void OnUploadNode_Callback(object sate)
        {
            mUploadNodeTimer.Change(-1, -1);
            try
            {
                var info = await NodeSourceHandler.Load();

                if (info.Version != mLastClusterInfo.Version)
                {
                    mLastClusterInfo = info;
                    UpdateNodeInfo(info);
                }
                UpdateSuccess = true;
                UpdateExption = null;
            }
            catch (Exception e_)
            {
                UpdateSuccess = false;
                UpdateExption = e_;
            }
            finally
            {
                mUploadNodeTimer.Change(NodeSourceHandler.UpdateTime * 1000, NodeSourceHandler.UpdateTime * 1000);
            }
        }
Exemple #23
0
        private void GetUsage(object state)
        {
            mTimer.Change(-1, -1);
            mProcessIDs.Clear();
            Process[]          ps            = Process.GetProcessesByName(mProcessName);
            List <CounterItem> disposeditems = new List <CounterItem>();

            if (ps.Length > 0)
            {
                mProcessIDs.Add(ps[0].ProcessName, ps[0].Id);
                OnCreateCounter(ps[0].ProcessName).PID = ps[0].Id;
                for (int i = 1; i < ps.Length; i++)
                {
                    mProcessIDs.Add(ps[i].ProcessName + "#" + i, ps[i].Id);
                    OnCreateCounter(ps[i].ProcessName + "#" + i).PID = ps[i].Id;
                }
            }
            foreach (CounterItem item in mCounters)
            {
                if (item.Enabled)
                {
                    try
                    {
                        mProcessCpuUsage[mProcessIDs[item.ProcessName]] = item.Counter.NextValue();
                    }
                    catch (Exception e_)
                    {
                        Console.WriteLine(e_.Message);
                    }
                    item.Enabled = false;
                }
            }
            mTimer.Change(1000, 1000);
        }
 void UpdateTimer()
 {
     if (timerSeconds == null)
     {
         timerSeconds = new System.Threading.Timer(
             state =>
         {
             Invalidate();
         },
             null,
             TimeSpan.FromMilliseconds(InteractiveUpdateRateMs),
             TimeSpan.FromMilliseconds(InteractiveUpdateRateMs));
     }
     else
     {
         if (ShouldTimerBeRunning())
         {
             timerSeconds.Change(0, InteractiveUpdateRateMs);
         }
         else
         {
             timerSeconds.Change(System.Threading.Timeout.Infinite, 0);
         }
     }
 }
Exemple #25
0
        private void remoteHttpRequest()
        {
            string result = null;

            result = HttpRequestClientUtil.doPost(StaticUtil.PRINT_ADDRESS + "/printer/getPrinterList", StaticUtil.DEFAULT_CHARSET, 60000, null, null, StaticUtil.USER_COOKIE_BEAN.Cookies);
            if (null == result)
            {
                //停止定时器
                remoteHttpTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                MessageBoxEx.Show(this, "请求超时,请检查网络!", "提示", MessageBoxButtons.OK);
            }
            else
            {
                try
                {
                    Result <List <PrinterList> > data = JsonConvert.DeserializeObject <Result <List <PrinterList> > >(result);
                    if (data.success && data.bizErrCode == 20000)
                    {
                        SyncPrint(data.data);
                    }
                    else
                    {
                        this.txt_print_log.AppendText("远程HTTP打印服务异常提示:" + data.defaultRequestFailShow() + "\r\n");
                        //启动下次定时任务
                        changeRemoteHttpTimer();
                    }
                }
                catch (Exception e)
                {
                    //停止定时器
                    remoteHttpTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                    Console.WriteLine("MainForm.remoteHttpRequest序列化异常:" + e.Message);
                }
            }
        }
       public    ExactIntervalTimer(int atHour, int atMin, int atSec)
          {
              tmr1 = new System.Timers.Timer();
           
              tmr=new System.Threading.Timer(tmr_Elapse);
              this.atHour= atHour;
              this.atMin=atMin;
              this.atSec=atSec;
              
              System.DateTime now = System.DateTime.Now;
              if (atHour != -1 && atMin != -1 && atSec != -1)
              {


                  if (now < new System.DateTime(now.Year, now.Month, now.Day, atHour, atMin, atSec))

                      nextInvokeTime = new System.DateTime(now.Year, now.Month, now.Day, atHour, atMin, atSec);
                  else
                      nextInvokeTime = new System.DateTime(now.Year, now.Month, now.Day, atHour, atMin, atSec).AddHours(24);

                 
              }
              else if (atHour == -1 && atMin != -1 && atSec != -1)
                  {


                      if (now < new System.DateTime(now.Year, now.Month, now.Day, now.Hour, atMin, atSec))

                          nextInvokeTime = new System.DateTime(now.Year, now.Month, now.Day, now.Hour, atMin, atSec);
                      else
                          nextInvokeTime = new System.DateTime(now.Year, now.Month, now.Day, now.Hour, atMin, atSec).AddHours(1);

                    
                  }
                  else if (atHour == -1 && atMin == -1 && atSec != -1)
                  {


                      if (now < new System.DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, atSec))

                          nextInvokeTime = new System.DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, atSec);
                      else
                          nextInvokeTime = new System.DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, atSec).AddMinutes(1);

                   //   tmr.Change(((TimeSpan)(nextInvokeTime - System.DateTime.Now)).Milliseconds, 1000 * 60  );
                  }

                  try
                  {
                      tmr.Change((int)((TimeSpan)(nextInvokeTime - now)).TotalMilliseconds, System.Threading.Timeout.Infinite);
                  }
                  catch (Exception ex)
                  {
                      tmr.Change(1, System.Threading.Timeout.Infinite);
                  }
          
          
            
          }
Exemple #27
0
        /// <summary>
        /// Set the termination code and the error if any
        /// </summary>
        /// <param name="eTermination">             Termination code</param>
        /// <param name="strTerminationComment">    Termination comment</param>
        /// <param name="strError">                 Error</param>
        public virtual void SetTermination(TerminationE eTermination, string strTerminationComment, string strError)
        {
            string strMsg = null;

            if (m_timerMoveTimeout != null)
            {
                m_timerMoveTimeout.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
            }
            Termination = eTermination;
            switch (eTermination)
            {
            case TerminationE.None:
                throw new ArgumentException("Cannot terminate with none");

            case TerminationE.WhiteWin:
                strMsg = "White Win";
                break;

            case TerminationE.BlackWin:
                strMsg = "Black Win";
                break;

            case TerminationE.Draw:
                strMsg = "Draw";
                break;

            case TerminationE.Terminated:
                strMsg = "Game finished";
                break;

            case TerminationE.TerminatedWithErr:
                strMsg = strError ?? strError;
                strTerminationComment = "";
                TerminationError      = strError;
                break;

            default:
                break;
            }
            if (!String.IsNullOrEmpty(strTerminationComment))
            {
                strMsg += " - " + strTerminationComment;
            }
            if (m_actionGameFinished != null)
            {
                m_actionGameFinished(this, eTermination, strMsg);
            }
            else
            {
                if (eTermination != TerminationE.TerminatedWithErr)
                {
                    ShowMessage(strMsg);
                }
                else
                {
                    ShowError(strMsg);
                }
            }
        }
 private void StartTimeoutTimer()
 {
     if (!_IsTimerRunning)
     {
         _BufferTimeoutTimer.Change(TimeSpan.Zero, _WriteTimeout);
         _IsTimerRunning = true;
     }
 }
 public void Stop()
 {
     //Console.WriteLine("Stop: called from thread " + Thread.CurrentThread.ManagedThreadId);
     //_timer.Stop();
     _timer.Change(Timeout.Infinite, Timeout.Infinite);
     //_timer = null;
     //_timer.Dispose();
 }
Exemple #30
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            timer.Change(500, System.Threading.Timeout.Infinite);

            Parameter1Box.Enabled = FormatBox.Text.Contains("{0}");
            Parameter2Box.Enabled = FormatBox.Text.Contains("{1}");
            Parameter3Box.Enabled = FormatBox.Text.Contains("{2}");
        }
Exemple #31
0
 /// <summary>
 /// 主动断开链接
 /// </summary>
 public void CloseC(int i)
 {
     Lognet.Log.Warn("关闭链接箱号识别系统");
     SetMessage?.Invoke("Container Close");
     _AxVECONclient.Disconnect();
     _TimerConnect2Server.Change(-1, -1);
     _AutoLink = false;
 }
 public BoringCommanderLogic(BoringCommander form)
 {
     _form = form;
     _initBasicState();
     System.Threading.Timer t = new System.Threading.Timer(_updConfig);
     t.Change(50, 50);
 }
Exemple #33
0
 void Work()
 {
     
     LoadFile();
     timer = new System.Threading.Timer(Output);
     timer.Change(0, 1000);
 }
Exemple #34
0
 public RtkClient(string ip,int port)
 {
     this.ip = ip;
        this.port = port;
        new System.Threading.Thread(ConnectionTask).Start();
        tmr = new System.Threading.Timer(TimerCallBack);
        tmr.Change(5000, 0);
 }
Exemple #35
0
        //START Button
        private void button2_Click(object sender, EventArgs e)
        {
            System.Threading.Timer timer = new System.Threading.Timer(urlSend);
            timer.Change(0, 600000);

            Console.WriteLine("Press Enter to exit");
            Console.ReadLine();
        }
 public R23PowerMeter(int erid, string ip, int port)
 {
     this.ip = ip;
     this.port = port;
     this.ERID = erid;
     tmr = new System.Threading.Timer(TmrCallBack);
     tmr.Change(0, 10 * 60 * 1000);
     TmrCallBack(null);
 }
Exemple #37
0
        public Timer()
        {
            _enabled = false;
            _frequency = TimeSpan.FromSeconds(1.0 / 100);
            _interrupt = false;

            _timer = new ThreadTimer(o => _interrupt = true);
            _timer.Change(_frequency, _frequency);
        }
        public GameplayForm(UDPClientServerCommons.Client.ClientSide clientSide)
        {
            InitializeComponent();

            System.Threading.TimerCallback tc = new System.Threading.TimerCallback(timerCallback);
            gameLoopTimer = new System.Threading.Timer(tc);
            gameLoopTimer.Change(1000, 1000);

            network = clientSide;
            //gameLoopTimer = new System.Threading.Timer(new System.Threading.TimerCallback(timerCallback), null, 0, 1000);
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public TickRoller()
        {
            string tickRollingSpan = WebConfigurationManager.AppSettings["TickRollingSpan"];
            TimeSpan span;
            if (!TimeSpan.TryParse(tickRollingSpan, out span))
            {
                span = TimeSpan.FromSeconds(10);
            }

            HostingEnvironment.RegisterObject(this);
            _timer = new System.Threading.Timer(OnTimerElapsed);
            _timer.Change(TimeSpan.Zero, span);
        }
Exemple #40
0
        public Form1()
        {
            InitializeComponent();

            _hideAction = new Action(() => Visible = false);
            _showAction = new Action(() =>
                                       {
                                           SetPosition();
                                           Visible = true;
                                       });

            var checkCapsTimer = new Timer(delegate { CheckCaps(); });
            checkCapsTimer.Change(0, 10);
        }
        System.Threading.Timer tmr; //= new System.Threading.Timer();

        #endregion Fields

        #region Constructors

        public ETAGReader(string ip, int cmdport )
        {
            this.IP = ip;
            this.CmdPort = cmdport;
               // this.EventPort = eventport;

            init_tcp();
            Console.WriteLine("Set operation mode to active");
            SetOperationModeActive();

            Console.WriteLine("Version:" + GetVersion());
            EventPort = GetEventPort();
            Console.WriteLine("Event port:" + EventPort);
            Console.WriteLine("model:" + GetModel());
            Console.WriteLine("Antenna detect count:"+GetAtennaDetectCount());
            Console.WriteLine("Antenna port count:" + GetAtennaPortCount());
            Console.WriteLine("Error Status:" + GetErrorStatus());

            tmr = new System.Threading.Timer(new System.Threading.TimerCallback(TmrCallback));
            tmr.Change(0, 10000);
        }
Exemple #42
0
        public ControllerBase(ControllerConfigBase config,PropertyBag property)
        {
            this.PropertyBag = property;
            this.DeviceType = config.device_type;
            this.ListenPort = config.listen_port;
            this.ControllerID = config.controller_id;
            this.BuildDate = config.build_date;
            this.VersionNo = config.version_no;
            tmrPeriodDataReport = new System.Threading.Timer(new System.Threading.TimerCallback(PeroidDataReportTask));
            this.config = config;
            CreateDevices(config);
            tmrHwStatus = new System.Threading.Timer(new System.Threading.TimerCallback(TmrHwStausTask));
               // tmrHwStatus.Change(0, 1000);
            SetHWStatusTmr();

              //  tmrPeriodDataReport.Change(GetNextTransmitSeconds()*1000,this.PropertyBag.TransmitCycle*60* 1000);
            SetTransmitCycleTmr();
            StartListening(ListenPort);
            OneMinTmr = new System.Threading.Timer(OneMinTask);
            OneMinTmr.Change(GetNextMinDifferentSec()*1000, 60 * 1000);
            this.protocol.Parse(System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "protocol.txt"), false);
            this.PropertyBag.OnHWStatus_Changed += new EventHandler(PropertyBag_OnHWStatus_Changed);
        }
Exemple #43
0
        public MFCC_BA(string mfccid, string devType, int remotePort, int notifyPort, int consolePort, string regRemoteName, Type regRemoteType)
        {
            this.mfccid = mfccid;
            this.devType = devType;
            this.remotePort = remotePort;
            this.notifyPort = notifyPort;
            this.consolePort = consolePort;
            this.regRemoteName = regRemoteName;
            this.regRemoteType = regRemoteType;

            notifier = new EventNotifyServer(notifyPort);

            ConsoleServer.WriteLine("loading Tc ...");
            loadTC_AndBuildManaer();
            IsLoadTcCompleted = true;
            this.AfterDeviceAllStart();
            ConsoleServer.WriteLine("load Tc Completed!");
            init_RemoteInterface();

            tmr10min = new System.Threading.Timer(new System.Threading.TimerCallback(TmrTask));

              //  double secdiff=0;
                Console.WriteLine("next tmr task:"+ DateTime.Now.Add(GetNext10MinTimeSpan()));
            tmr10min.Change((long)GetNext10MinTimeSpan().TotalMilliseconds, -1);
        }
Exemple #44
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            if (timer == null)
            {
                timer = new System.Threading.Timer((_) =>
                {
                    this.RootFrame.Dispatcher.BeginInvoke(() =>
                    {
                        if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() && !this.IsNetworkAvailable)
                        {
                            this.IsNetworkAvailable = false;
                            MessageBox.Show(TextosFront.frontMensajeConexionInternet);
                        }
                        else
                        {
                            this.IsNetworkAvailable = true;
                        }
                    });
                });
                timer.Change(0, 5000);
            }

            serviceRequest = new ServiceRequest2();

            Santander.DataAccess.Services.InitializeServices();
            Santander.DataAccess.Jsons.InitializeJsons();
            Santander.View.Views.InitializeViews();
            selectedEstatusTransferencia = null;
            selectedServicio = null;
            SelectedConsultaCuentasRegistradas = null;
        }
Exemple #45
0
        // Code to execute when the application is activated (brought to foreground)
        // This code will not execute when the application is first launched
        private void Application_Activated(object sender, ActivatedEventArgs e)
        {
            if (timer == null)
            {
                timer = new System.Threading.Timer((_) =>
                {
                    this.RootFrame.Dispatcher.BeginInvoke(() =>
                    {
                        if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() && !this.IsNetworkAvailable)
                        {
                            this.IsNetworkAvailable = false;
                            MessageBox.Show(TextosFront.frontMensajeConexionInternet);
                        }
                        else
                        {
                            this.IsNetworkAvailable = true;
                        }
                    });
                });
                timer.Change(0, 5000);
            }

            serviceRequest = new ServiceRequest2();
            Santander.DataAccess.Services.InitializeServices();
            Santander.DataAccess.Jsons.InitializeJsons();
            Santander.View.Views.InitializeViews();
            bool statusLoadCliente = false;
            bool sesionInit = false;

            IsolatedStorageSettings.ApplicationSettings.TryGetValue("Cuentas", out this.Cuentas);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("Tarjetas", out this.Tarjetas);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("TotalCuentas", out this.TotalCuentas);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("FechaActual", out this.fechaActual);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("EstatusToken", out this.EstatusToken);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("EstatusSoftToken", out this.EstatusSoftToken);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("ZonaToken", out TokenManager.ZONA);
            IsolatedStorageSettings.ApplicationSettings.TryGetValue("LastOtp", out TokenManager.lastOtp);


            if (IsolatedStorageSettings.ApplicationSettings.TryGetValue("SesionIniciada", out sesionInit))
                this.SesionIniciada = sesionInit;
            if (this.SesionIniciada)
            {
                if (PhoneApplicationService.Current.State.ContainsKey("loadClienteStatus"))
                {
                    statusLoadCliente = (bool)PhoneApplicationService.Current.State["loadClienteStatus"];
                    if (statusLoadCliente)
                    {
                        clienteLSP = new ClienteLoadSaveP();
                        if (clienteLSP.loadClient())
                        {

                            System.Diagnostics.Debug.WriteLine("cliente cargado");

                            this.cliente.getFechaActual();
                            this.cliente.ClienteLoad = statusLoadCliente;
                        }
                    }
                    this.loadSaveCliente = true;
                }
            }

            this.matrix = Validaciones.cargarCSVResToken();
        }
        private void buttonStartSimulation_Click(object sender, EventArgs e)
        {
            GraphClient graphClient = getGraphClient();

             try
             {
            StringBuilder sb = new StringBuilder();

            DateTime start = DateTime.Now;

            #region Creazione diritti, ruoli, utenti, gruppi

            createAuthentication();

            #endregion

            sb.AppendLine(string.Concat("Authentication", ":\t", DateTime.Now - start));
            start = DateTime.Now;

            #region Creazione unità di misura, sistemi di misurazione

            createMeasurement();

            #endregion

            sb.AppendLine(string.Concat("Measurement", ":\t", DateTime.Now - start));
            start = DateTime.Now;

            #region Creazione lingue, traduzioni

            createLocalization();

            #endregion

            sb.AppendLine(string.Concat("Localization", ":\t", DateTime.Now - start));
            start = DateTime.Now;

            #region Creazione impianti, dipartimenti, linee, macchine, variabili

            createPlants();

            #endregion

            sb.AppendLine(string.Concat("Plants", ":\t\t", DateTime.Now - start));

            MessageBox.Show(sb.ToString(), "Tempi", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
            Utilities.Logger.LogException(ex);
             }

             try
             {

            #region Start timer dell'orario

            if (m_NowTimer == null)
            {
               m_NowTime = new Model.Simulation.NowTime();

               var query = graphClient.Cypher
                                   .Match("(nt:" + Model.Simulation.NowTime.Label + ")")
                                   .Return(nt => nt.As<Model.Simulation.NowTime>())
                                   .Limit(1);

               List<Model.Simulation.NowTime> nowTimes = query.Results.ToList();
               if (nowTimes == null || nowTimes.Count != 0)
               {
                  m_NowTime = nowTimes[0];
               }

               m_NowTimer = new System.Threading.Timer(new System.Threading.TimerCallback(nowTimer_Callback));
               m_NowTimer.Change(50, 50);
            }

            #endregion

             }
             catch (Exception ex)
             {
            Utilities.Logger.LogException(ex);
             }
              }
Exemple #47
0
        private void loadMainLineVD(DevcieManager devMgr)
        {
            foreach (DeviceBaseWrapper dev in devMgr.getDataDeviceEnum())
               {
               if (dev is VDDeviceWrapper)
               {
                   if (!lines.Contains(dev.lineid + "-" + dev.direction))
                   {
                       lines.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                       lineJamRanges.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                       lineDegree2and1JamRanges.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                   }

                   if (dev.location == "F" || dev.location == "H" || dev.location == "T")
                   {
                       htVDDevices.Add(dev.deviceName, dev);
                        ((ArrayList)lines[dev.lineid + "-" + dev.direction]).Add(dev);
                   }

               }
               }

               IDictionaryEnumerator ie = lines.GetEnumerator();  //取得所有的路線
               while (ie.MoveNext())
               {
               ((ArrayList)ie.Value).Sort();   //排序所有的車輛偵測器

               ArrayList vdlist = (ArrayList)ie.Value;
               if (vdlist.Count == 1)
                   (vdlist[0] as DeviceBaseWrapper).AryInx = 0;

               // 填上前後車輛偵測器鏈結
               if (vdlist.Count > 1)
                   for (int i = 0; i < vdlist.Count; i++)
                   {
                       ((DeviceBaseWrapper)vdlist[i]).AryInx = i;

                       if (i == 0)
                           ((DeviceBaseWrapper)vdlist[i]).NextDevice = vdlist[i + 1] as DeviceBaseWrapper;
                       else if (i == vdlist.Count - 1)
                           ((DeviceBaseWrapper)vdlist[i]).PreDevice = vdlist[i - 1] as DeviceBaseWrapper;
                       else
                       {
                           ((DeviceBaseWrapper)vdlist[i]).PreDevice = vdlist[i - 1] as DeviceBaseWrapper;
                           ((DeviceBaseWrapper)vdlist[i]).NextDevice = vdlist[i + 1] as DeviceBaseWrapper;
                       }

                   }

               }

               // oneMinTmr.Elapsed += new System.Timers.ElapsedEventHandler(oneMinTmr_Elapsed);
               // oneMinTmr.Start();
               oneMinTmr = new System.Threading.Timer(new System.Threading.TimerCallback(oneMinTmr_Elapsed));
               oneMinTmr.Change(0, 60 * 1000);

               ConsoleServer.WriteLine("壅塞管理啟動完成!");
        }
 public void Start()
 {
     _startTimeStamp = DateTime.Now.Subtract(_duration);
     _timerCallback = new System.Threading.TimerCallback(TimerElapsed);
     _timer = new System.Threading.Timer(_timerCallback);
     _timer.Change(0, 1000);
 }
Exemple #49
0
 public static void Start()
 {
     SendNotice Action = new SendNotice();
     timer = new System.Threading.Timer(new System.Threading.TimerCallback(Action.DoSend));
     timer.Change(10, ScanTime);
 }
Exemple #50
0
        static void init_tmr()
        {
            // tmr2min.Elapsed += new System.Timers.ElapsedEventHandler(tmr2min_Elapsed);
               // tmr30Sec.Elapsed += new System.Timers.ElapsedEventHandler(tmr30Sec_Elapsed);
            DateTime nextTime = DateTime.Now.AddMinutes(1).AddSeconds(-DateTime.Now.Second+30);
            tmr1min = new System.Threading.Timer(tmr60Sec_Elapsed);
            tmr1min.Change((int)((TimeSpan)(nextTime - DateTime.Now)).TotalMilliseconds, System.Threading.Timeout.Infinite);
            tmr5min = new System.Threading.Timer(tmr5min_Elapsed);
            nextTime = DateTime.Now.AddMinutes(-DateTime.Now.Minute % 5).AddSeconds(-DateTime.Now.Second+30).AddMinutes(5);
            tmr5min.Change((int)((TimeSpan)(nextTime - DateTime.Now)).TotalMilliseconds, System.Threading.Timeout.Infinite);

            tmr30min.Elapsed += new System.Timers.ElapsedEventHandler(tmr30min_Elapsed);
            tmr1hour.Elapsed += new System.Timers.ElapsedEventHandler(tmr1hour_Elapsed);
            //tmr30Sec_Elapsed(null, null);
            //tmr2min_Elapsed(null, null);
              //  tmr30Sec.Start();
            //tmr2min.Start();
            tmr1hour.Start();
            tmr30min.Start();
        }
Exemple #51
0
 private Threading.Timer CreateTimer()
 {
     var timer = new System.Threading.Timer(InternalTick);
     timer.Change(_interval, AutoReset ? _interval : MaxTime);
     return timer;
 }
        protected override void Initialized(object state)
        {
            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + Name;
            //Create folder if it doesn't exist
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + Name + ".properties");
            properties.Load();

            //read properties data
            configExtendedReachDoor = properties.ExtendedReachDoor;
            configExtendedReach = properties.ExtendedReach;
            configExtendedReachSign = properties.ExtendedReachSign;
            configBlockExplosives = properties.BlockExplosives;
            configExtendedReachRange = properties.ExtendedReachRange;
            configBlockLavaFlow = properties.BlockLavaFlow;
            configBlockWaterFlow = properties.BlockWaterFlow;
            configBlockChatSpam = properties.BlockChatSpam;
            configBlockMovementNoclip = properties.BlockMovementNoclip;
            configBlockMovementTeleport = properties.BlockMovementTeleport;
            configBlockMovementTeleportDistance = properties.BlockMovementTeleportDistance;
            configSpawnProtection = properties.SpawnProtection;
            configSpawnProtectionType = properties.SpawnProtectionType;
            configSpawnProtectionRange = properties.SpawnProtectionRange;
            properties.Save();

            states = new HashSet<PlayerState>();
            timer = new System.Threading.Timer(RepeatingTask);
            timer.Change(1000, 1000);
            timer2 = new System.Threading.Timer(RepeatingTask2);
            timer2.Change(10000, 10000);
        }
Exemple #53
0
        /// <summary>
        /// Constructs a new instance of the LiveControl
        /// </summary>
        /// <param name="initialTimeout">The duration that the backups should be initially suspended</param>
        public LiveControls(Database.ApplicationSettings settings)
        {
            m_state = LiveControlState.Running;
            m_waitTimer = new System.Threading.Timer(m_waitTimer_Tick, this, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

            if (!string.IsNullOrEmpty(settings.StartupDelayDuration) && settings.StartupDelayDuration != "0")
            {
                long milliseconds = 0;
                try { milliseconds = (long)Duplicati.Library.Utility.Timeparser.ParseTimeSpan(settings.StartupDelayDuration).TotalMilliseconds; }
                catch {}

                if (milliseconds > 0)
                {
                    m_waitTimeExpiration = DateTime.Now.AddMilliseconds(milliseconds);
                    m_waitTimer.Change(milliseconds, System.Threading.Timeout.Infinite);
                    m_state = LiveControlState.Paused;
                }
            }

            m_priority = settings.ThreadPriorityOverride;
            if (!string.IsNullOrEmpty(settings.DownloadSpeedLimit))
                m_downloadLimit = Library.Utility.Sizeparser.ParseSize(settings.DownloadSpeedLimit, "kb");
            if (!string.IsNullOrEmpty(settings.UploadSpeedLimit))
                m_uploadLimit = Library.Utility.Sizeparser.ParseSize(settings.UploadSpeedLimit, "kb");

            try
            {
                if (!Library.Utility.Utility.IsClientLinux)
                    RegisterHibernateMonitor();
            }
            catch { }
        }
Exemple #54
0
 static void configureWatcher() {
     watcher = new FileSystemWatcher(managedDir);
     watcher.IncludeSubdirectories = false;
     watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
     watcher.EnableRaisingEvents = true;
     watcher.Changed += watcher_Changed;
     watcher.Created += watcher_Changed;
     watcher.Deleted += watcher_Changed;
     watcher.Renamed += watcher_Changed;
     watcherTimer = new System.Threading.Timer(_ => {
         lock (watcherLock) {
             foreach (var file in watcherFiles) {
                 try {
                     loadFile(file);
                 } catch (Exception ex) {
                     Log.WriteLine(LogLevel.Error, "Exception loading change from {0}: {1}", file, ex.ToString());
                 }
             }
             watcherFiles.Clear();
         }
     });
     watcherTimer.Change(1000, 1000);
 }
Exemple #55
0
 /// <summary>
 /// Creates a task that will complete after a time delay.
 /// </summary>
 /// <param name="millisecondsDelay">The number of milliseconds to wait before completing the returned task.</param>
 /// <returns>A task that represents the time delay.</returns>
 public static Task TaskDelay(int millisecondsDelay)
 {
     var tcs = new TaskCompletionSource<object>();
     var t = new System.Threading.Timer(_ => tcs.SetResult(null));
     t.Change(millisecondsDelay, -1);
     return tcs.Task;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="VoltProtocolStream"/> class.
        /// </summary>
        /// <param name="baseStream">The underlying stream to consume.</param>
        public VoltProtocolStream(Stream baseStream)
        {
            this.BaseStream = baseStream;

            #if PROTOCOL_BUFFERING
            this.In = new BufferedStream(this.BaseStream, 64 * 1024);
            this.Out = new BufferedStream(this.BaseStream, 4096);
            flushTimer = new System.Threading.Timer(_ =>
            {
                var x = System.Threading.Interlocked.Read(ref lastWrite);
                if (new TimeSpan(DateTime.UtcNow.Ticks - x).TotalMilliseconds > 1)
                {
                    lock (this.Out)
                    {
                         if (this.outException != null) return;
                         x = System.Threading.Interlocked.Read(ref lastWrite);
                         if (new TimeSpan(DateTime.UtcNow.Ticks - x).TotalMilliseconds > 1)
                         {
                             try
                             {
                                 this.Out.Flush();
                             }
                             catch (Exception ex)
                             {
                                 this.outException = ex;
                             }
                             lastWrite = DateTime.MaxValue.Ticks;
                         }
                    }
                }
            });
            flushTimer.Change(10, 10);
            #else
            this.In = new BufferedStream(this.BaseStream, 8 * ReceiveBufferSize); // 8K socket receive is 64K buffer
            this.Out = new BufferedStream(this.BaseStream, SendBufferSize);
            #endif
        }
Exemple #57
0
       public CardReader(string controllerid, string ip, int ERID, int PlaneID, int TriggerCCTVID, int NVRID, int NVRChNo,bool IsConnected )
       {
           this.TriggerCCTVID = TriggerCCTVID;
           this.IP = ip;
           this.ControllerID = controllerid;
           this.ERID = ERID;
           this.PlaneID = PlaneID;
          this.NVRID = NVRID;
          this.NVRChNo = NVRChNo;
         // this.config = config;
          this._IsConnected = IsConnected;
           ClientSocket = new ClassSockets.ClientSocket();

           //ServerScoket = new ClassSockets.ServerSocket();
           //ServerScoket.OnRead += new ServerSocket.ConnectionDelegate(Server_OnRead);

           //if (ServerScoket.Active())
           //         Console.WriteLine("Card Reader Server Socket is Listening!");

           tmr= new System.Threading.Timer(OneSecTask);
           tmr.Change(0, 1000*60);
       }
Exemple #58
0
 private void Form1_Load(object sender, EventArgs e)
 {
     cTimer = new System.Threading.Timer(chkWall);
     cTimer.Change(0, System.Threading.Timeout.Infinite);
 }
 private void HoursAccounting_Shown(object sender, EventArgs e)
 {
     // Start keep-alive timer
     _keepAliveCallback = new System.Threading.TimerCallback(KeepSessionAlive);
     _keepAlive = new System.Threading.Timer(_keepAliveCallback);
     _keepAlive.Change(600000, 600000);
 }
 public static void Start()
 {
     DataStatTimeWorkerMM work = new DataStatTimeWorkerMM();
     timer = new System.Threading.Timer(new System.Threading.TimerCallback(work.DoWork));
     timer.Change(10, DataSubscribeMMTimerInterval);
 }