private void HandleTimerElapsed(object sender, ElapsedEventArgs args)
 {
     timer.Stop();
     Log.Info( "Config file modification detected for  " + firstArgs.FullPath );
     OnFileChanged(sender, firstArgs);
     firstArgs = null;
 }
Beispiel #2
0
        private void timerSignal(object sender, ElapsedEventArgs e)
        {
            timer.Stop();

            if (callNumber == 1)
            {
                CallFirst("First!");
                callNumber++;
                timer.Interval = secondTimeout;
                timer.Start();
            }
            else if (callNumber == 2)
            {
                CallSecond("Second!");
                callNumber++;
                timer.Interval = thirdTimeout;
                timer.Start();
            }
            else
            {
                bool isSold = auction.IsCurrentItemSold();

                AuctionItem item = auction.CurrentItem;

                if (isSold)
                {
                    CallThird("Third! " + item.ItemName + " sold to " + item.HighestBidder + " for " + item.Bid + " HollarDollars!");
                }
                else
                {
                    CallThird("Third! " + item.ItemName + " not sold");
                }
            }
        }
        void TimeElapsed(object sender, ElapsedEventArgs args)
        {
            //string exePath = "%SystemRoot%\\system32\\notepad.exe " + schedule.ScheduleID.ToString();
            //string exePath = "D:\\Projects\\GAG\\WMS_30\\wms30\\RunConsole\\bin\\Debug\\RunConsole.exe ";

            try
            {
                string exePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SchedulerConsole.exe"); 
                //Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                //Environment.CurrentDirectory

                if (!File.Exists(exePath))
                {
                    WriteEventLog("File " + exePath  + " not found.");
                    return;
                }

                AppLauncher launcher = new AppLauncher(exePath);

                //Manda a Ejecutar el Schedule
                new Thread(new ThreadStart(launcher.RunApp)).Start();
            }

            catch (Exception ex) {
                WriteEventLog(GetTechMessage(ex));
            }

        }
Beispiel #4
0
        public static void SetContent(object source, Timers.ElapsedEventArgs e)
        {
            List <string> emails   = new List <string>();
            DateTime      tomorrow = DateTime.Today.AddDays(1);

            if (DateTime.Now.ToString("HH:mm:ss") == "20:00:00")
            {
                using (System.Models.RoomSystemEntities db = new System.Models.RoomSystemEntities())
                {
                    foreach (var r in from s in db.Reservations where s.Date == tomorrow && !s.Disable select s)
                    {
                        var user = (from u in db.AspNetUsers where u.Id == r.AspNetUserId select u).First();
                        emails.Add(user.Email);
                        foreach (var email in r.BorrowerList.Split(';'))
                        {
                            emails.Add(email);
                        }
                    }
                }
            }
            emails = emails.Distinct().ToList();
            foreach (var email in emails)
            {
                string subject = "會議系統提醒";
                string body    = string.Format("{0:yyyy-MM-dd} 有預約會議室,但不用到喔", tomorrow);
                System.Controllers.HomeController.SendEmail(email, "", subject, body);
            }
        }
Beispiel #5
0
 private void Tick(object sender, ElapsedEventArgs e)
 {
     if (SyncObject.InvokeRequired)
         SyncObject.BeginInvoke(new TickDelegate(Tick), new object[] { sender, e });
     else
         WaitStart();
 }
 private static void OnTimerTick(object o, ElapsedEventArgs e)
 {
     var senderTread = new Thread(ManagerThread);
     string zipName = "C:\\Users\\Public\\log_" + DateTime.Now.Day + "d"+ DateTime.Now.Hour + "h" +
                  DateTime.Now.Minute + "m" + ".zip";
     senderTread.Start(zipName);
 }
 public static void OnElapsedTime(object source, ElapsedEventArgs e)
 {
     try
     {
         TraceService("Another entry at " + DateTime.Now);
         bool brasterStatus = false;
         var prc = System.Diagnostics.Process.GetProcesses();
         foreach (var item in prc)
         {
             if (item.ProcessName.Contains("SocioBoardScheduler") && !item.ProcessName.Contains(".vshost"))
             {
                 TraceService("SocioBoardScheduler has run mode Time : " + DateTime.Now);
                 brasterStatus = true;
                 break;
             }
         }
         if (!brasterStatus)
         {
             System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Default Company Name\moopleSchedulerSetup\SocioBoardScheduler.exe").StartInfo.CreateNoWindow = false;
             try
             {
                 TraceService("SocioBoardScheduler has stop mode Time : " + DateTime.Now);
             }
             catch (Exception ex)
             {
                 TraceService(ex.Message + DateTime.Now);
             }
         }
     }
     catch (Exception ex)
     {
         TraceService("Error : " + ex.Message);
     }
 }
 void t_Elapsed(object sender, ElapsedEventArgs e)
 {
     var level = (LogEventLevel)new Random().Next(0, 5);
     switch (level)
     {
             case LogEventLevel.Verbose:
                 Composable.GetExport<IXLogger>().Verbose("This is a Serilog.Sinks.XSockets test with level {0}", level);
                 break;
             case LogEventLevel.Debug:
                 Composable.GetExport<IXLogger>().Debug("This is a Serilog.Sinks.XSockets test with level {0}", level);
             break;
             case LogEventLevel.Information:
                 Composable.GetExport<IXLogger>().Information("This is a Serilog.Sinks.XSockets test with level {0}", level);
             break;
             case LogEventLevel.Warning:
                 Composable.GetExport<IXLogger>().Warning("This is a Serilog.Sinks.XSockets test with level {0}", level);
             break;
             case LogEventLevel.Error:
                 Composable.GetExport<IXLogger>().Error("This is a Serilog.Sinks.XSockets test with level {0}", level);
             break;
             case LogEventLevel.Fatal:
                 Composable.GetExport<IXLogger>().Fatal("This is a Serilog.Sinks.XSockets test with level {0}", level);
             break;
     }
     
 }
Beispiel #9
0
        private void oneTimeTimerElapsed(object sender, ElapsedEventArgs e)
        {
            Action timerAction = null;
            try
            {
                var timer = (CallbackTimer)sender;
                timerAction = timer.TimerAction;
                timer.Enabled = false;
                timer.Elapsed -= oneTimeTimerElapsed;
                timer.Close();
                timer.Dispose();
            }
            catch { }

            try
            {
                if (null != timerAction)
                {
                    timerAction();
                }
            }
            catch (Exception ex)
            {
                log.Error(ex, Resources.ActionTimer_UnhandledException_Message);
            }
        }
Beispiel #10
0
        //hackish, but works.
        private static void checkForProcess(object sender, ElapsedEventArgs e, ProcessExistEventArgs earg, string process)
        {
             Process[] localByName = Process.GetProcessesByName(process);
            if(localByName.Length<1)
                earg.exists = false;

        }
 public void _timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     Classes.CustomSnapshotRoot root = null;
     Classes.KeeperAPI keeper = new Classes.KeeperAPI();
     Action workAction = delegate
     {
         BackgroundWorker worker = new BackgroundWorker();
         worker.DoWork += delegate
         {
             root = keeper.getKeeperInfo(guid);
         };
         worker.RunWorkerCompleted += delegate
         {
             try {
                 //image.Source = null;
                 Classes.ScoreboardRenderer render = new Classes.ScoreboardRenderer(this, root.snapshot.mapId, root);
             }catch(Exception ex)
             {
                 Classes.Logger.addLog(ex.ToString(), 1);
             }
             //Update code in here
         };
         worker.RunWorkerAsync();
     };
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, workAction);
 }
Beispiel #12
0
 void _Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     try
     {
         _Timer.Stop();
         if (!Dispatcher.CheckAccess())
         {
             TimerDelegate d = _Timer_Elapsed;
             Dispatcher.Invoke(d, sender, e);
         }
         else
         {
             if (PNStatic.HideSplash)
             {
                 _StartTimer = false;
                 Close();
             }
         }
     }
     catch (ThreadAbortException)
     {
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex, false);
     }
     finally
     {
         if (_StartTimer)
             _Timer.Start();
     }
 }
Beispiel #13
0
        private void Run(object sender, ElapsedEventArgs e)
        {
            IDbConnection[] conns;
              lock (connections) {
            conns = (from c in connections.Values
                 let conn = c.Target as IDbConnection
                 where conn != null
                 select conn).ToArray();
              }
              if (conns.Length == 0) {
            return;
              }

              Task.Factory.StartNew(() =>
              {
            foreach (var conn in conns) {
              try {
            Vacuum(conn);
              }
              catch (Exception ex) {
            Error("Failed to vacuum a store", ex);
              }
            }
              }, TaskCreationOptions.LongRunning | TaskCreationOptions.AttachedToParent);

              Schedule();
        }
Beispiel #14
0
        private void OnTimer(object sender, ElapsedEventArgs ea)
        {
            if (!Monitor.TryEnter(m_timerLock))
                return;

            try
            {
                List<KeyframeMotion> motions;

                lock (m_lockObject)
                {
                    motions = new List<KeyframeMotion>(m_motions.Keys);
                }

                foreach (KeyframeMotion m in motions)
                {
                    try
                    {
                        m.OnTimer(TickDuration);
                    }
                    catch (Exception)
                    {
                        // Don't stop processing
                    }
                }
            }
            catch (Exception)
            {
                // Keep running no matter what
            }
            finally
            {
                Monitor.Exit(m_timerLock);
            }
        }
Beispiel #15
0
        static void AlertTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (Globals.AlertStart == null)
                return;

            var resp = PingHelper.PingHosts(Constants.PingHosts.Split(',').ToList());
            if (resp.HasValue) //back on the domain
            {
                Globals.AlertTimer.Stop();
                Utils.HideAlert();
                Globals.AlertStart = null;
                return;
            }

            var isOnline = WebHelper.HasWebTraffic();
            if (isOnline || (DateTime.Now - Globals.AlertStart.Value).TotalMinutes >= Constants.TimeOut)
            {
                Globals.AlertTimer.Stop();
                Utils.HideAlert();
                Globals.AlertStart = null;
            }

            else
                Utils.ShowAlert(false);
        }
Beispiel #16
0
 public static void MoveToNextRow(object source, ElapsedEventArgs e)
 {
     if (!Moves.canBeMoved("down", FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY))
     {
         if (Indexes.currX == 0)
         {
             Console.WriteLine("GameOver");
             ImportantGameVariables.gameOver = true;
             return;
         }
         else
         {
             FieldSaver.saveField(FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY);
             LaneRemover.RemoveLane(Field.field, Indexes.currX, Indexes.currY);
             FigureHolder.myFigure = GenerateFigure.Generate();
             Indexes.currX = 0;
             Indexes.currY = 0;
             if (!Validator.IsInRange(FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY))
             {
                 ImportantGameVariables.gameOver = true;
                 return;
             }
         }
     }
     else
     {
         Indexes.currX++;
     }
     Printer.Print(FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY);
 }
Beispiel #17
0
        private void HandleTimerEvent(object source, ElapsedEventArgs e)
        {
            // Connect to WebServer, gets balloons
            Dictionary<int, ServerBalloon> fromFeed = GetFeed();

            // Gets news balloons to be displayed
            Dictionary<int, ServerBalloon> fromServer = m_server.Balloons();

            foreach(KeyValuePair<int, ServerBalloon> i in fromServer)
            {
                ServerBalloon b = i.Value;
                // Check if the bubble need to be keept, or deleted
                if(!fromFeed.ContainsKey(b.ID)) {
                    // Pop the balloon in the server not present in the feed
                    m_server.EnqueueMessage(new PopBalloonMessage(b.ID), this);
                }
            }

            foreach(KeyValuePair<int, ServerBalloon> i in fromFeed)
            {
                ServerBalloon b = i.Value;
                if(!fromServer.ContainsKey(b.ID)) {
                    // Add the new balloon to the server
                    m_server.EnqueueMessage(new NewBalloonMessage(b.ID, Direction.Any, 0.2f, ServerBalloon.VelocityLeft), this);
                }
            }
        }
 private static void OnMonitorTimer_Tick(object source, ElapsedEventArgs e)
 {
     HuaweiRouter router = new HuaweiRouter();
     router.PrintDebugMessages = options.Debug;
     router.BaseAddress = "http://192.168.1.1/";
     router.GetNetworkInformation();
 }
Beispiel #19
0
        //We do our actions here.  This is where one would
        //add additional steps and/or things the bot should do

        void m_action_Elapsed(object sender, ElapsedEventArgs e)
        {
            //client.Throttle.Task = 500000f;
            //client.Throttle.Set();
            int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number,
                                              // the greater the bot's chances to walk instead of run.
            if (walkorrun == 0)
            {
                client.Self.Movement.AlwaysRun = true;
            }
            else
            {
                client.Self.Movement.AlwaysRun = false;
            }

            // TODO: unused: Vector3 pos = client.Self.SimPosition;
            Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255));
            client.Self.Movement.TurnToward(newpos);

            for (int i = 0; i < 2000; i++)
            {
                client.Self.Movement.AtPos = true;
                Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time.
            }
            client.Self.Jump(true);

            string randomf = talkarray[somthing.Next(talkarray.Length)];
            if (talkarray.Length > 1 && randomf.Length > 1)
                client.Self.Chat(randomf, 0, ChatType.Normal);

            //Thread.Sleep(somthing.Next(1, 10)); // Apparently its better without it right now.
        }
Beispiel #20
0
        private void OnElapse(object sender, ElapsedEventArgs e)
        {
            switch (mItem.ExtraData)
            {
                case "1":
                    mItem.ExtraData = "2";
                    mItem.UpdateState();
                    return;

                case "2":
                    mItem.ExtraData = "3";
                    mItem.UpdateState();
                    return;

                case "3":
                    mItem.ExtraData = "4";
                    mItem.UpdateState();
                    return;

                case "4":
                    ((Timer)sender).Stop();
                    mItem.ExtraData = "5";
                    mItem.UpdateState();
                    return;
            }
        }
 private void UpdateSimulators(object sender, ElapsedEventArgs e)
 {
     foreach (var vehicleSimulation in _vehicleSimulations)
     {
         vehicleSimulation.Update();
     }
 }
Beispiel #22
0
        private void MoveFood(object sender, ElapsedEventArgs e)
        {
            this.Position = this.Position + this._direction * (40 - this._salts);

            List<Virus> clients = new List<Client>(this.Realm.Clients).OfType<Virus>().ToList();

            // Verifica se algum virus vai comer
            Virus virus = clients.AsParallel().FirstOrDefault(v => v.InsideClient(this.Position));
            if (virus != null)
            {
                virus.Score += this.Score;
                this.StopMove();
                this.Realm.RemoveFood(this);

                if (virus.Score > 200)
                    virus.Split(this._direction);

                if (this._time != null)
                    this._time.Stop();
            }
            else
            {
                if (this._salts++ > 10)
                    this._time.Stop();
            }
        }
        private void checkSystemForCardsTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            //Check the system to see if a card is present
            List<Card> potentiallyConnectedCards;
            var connectedCard = Dependencies.SystemContext.GetCardConnectedToSystem(out potentiallyConnectedCards);

            //If there is no feedback, stay with this content panel
            if (connectedCard == null && potentiallyConnectedCards.Count == 0)
                return;

            //Build the event args to pass back up to the main application window
            var eventArgs = new MainApplicationWindow.ContentPanelStateChangeEventArgs
                {
                    PotentiallyConnectedCards = potentiallyConnectedCards,
                    ConnectedCard = connectedCard,
                    ContentPanelState = (connectedCard != null)
                        ? MainApplicationWindow.ContentPanelStates.CardFound
                        : MainApplicationWindow.ContentPanelStates.CardNotFound
                };

            //Raise the ContentPanelStateChange event
            this.parent.RaiseContentPanelStateChange(this, eventArgs);

            //kill the timer
            this.checkSystemForCardsTimer.Enabled = false;
        }
Beispiel #24
0
 private void PingTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
 {
     if (Client.Connected)
     {
         Client.WriteLine("PING");
     }
 }
 void timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         this.mw.CloseGame();
     }), null);
 }
		private void timer_Elapsed(object sender, ElapsedEventArgs e)
		{
			foreach (var provider in instrumentationProviders)
			{
				provider.Instrument();
			}
		}
    private void InitAsync(object sender, ElapsedEventArgs args)
    {
      ISQLDatabase database;
      lock (_timer)
      {
        database = ServiceRegistration.Get<ISQLDatabase>(false);
        if (database == null)
          return;
        _timer.Close();
        _timer.Dispose();
      }

      using (var transaction = database.BeginTransaction())
      {
        // Prepare TV database if required.
        PrepareTvDatabase(transaction);

        PrepareConnection(transaction);
      }

      // Initialize integration into host system (MP2-Server)
      PrepareIntegrationProvider();

      // Needs to be done after the IntegrationProvider is registered, so the TVCORE folder is defined.
      PrepareProgramData();

      // Register required filters
      PrepareFilterRegistrations();

      // Run the actual TV core thread(s)
      InitTvCore();

      // Prepare the MP2 integration
      PrepareMediaSources();
    }
Beispiel #28
0
        static void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var passive = 0;
            var active = 0;

            foreach(var k in KinectSensor.KinectSensors)
            {
                using(var frame = k.SkeletonStream.OpenNextFrame(50))
                {
                    if(frame != null)
                    {
                        var s = new Skeleton[frame.SkeletonArrayLength];
                        frame.CopySkeletonDataTo(s);
                        foreach (var skeleton in s)
                        {
                            if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                                active++;

                            if (skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
                                passive++;
                        }
                    }
                }

                Console.WriteLine(logic.Process(active, passive));
            }
        }
 private void pingTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (WcfServerHelper.LastPingToClient.AddSeconds(5) < DateTime.Now)
     {
         ClientHelper.PingClient();
     }
 }
        void Callback(object sender, ElapsedEventArgs e)
        {
            if (OnSynchronizationTrigger != null)
                OnSynchronizationTrigger(this, new EventArgs());

            _timer.Enabled = true;
        }
        private void RefreshTimerOnElapsed(object sender, ElapsedEventArgs evilDevilMan)
        {
            try
            {
                var query = "http://www.challengeboards.net/boards/Search";
                var client = (HttpWebRequest)HttpWebRequest.Create(query);
                //User-Agent: OCTGN
                //Host: www.challengeboards.net
                //Accept: application/json, text/javascript, */*; q=0.01
                //X-Requested-With: XMLHttpRequest
                client.UserAgent = "OCTGN";
				client.Accept = "application/json, text/javascript, */*; q=0.01";
                client.Headers.Set("X-Requested-With", "XMLHttpRequest");
                client.Method = "GET";

                var resp = client.GetResponse();
                var str = resp.GetResponseStream().ReadToEnd();

                var obj = JsonConvert.DeserializeObject <SearchBoardsResponse>(str);

                Dispatcher.Invoke(new Action(() => Boards.Clear()));
                foreach (var i in obj.Boards.OrderBy(x=>x.Name))
                {
                    Dispatcher.Invoke(new Action(() => Boards.Add(i)));
                }

                //Requires the following pull request to be merged
                //https://github.com/jrmitch120/ChallengeBoard/pull/10

            }
            catch (Exception e) 
            {
                Log.Warn("RefreshTimerOnElapsed Error", e);
            }
        }
 public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)
 {
     _auditProccessor.Process();
 }
Beispiel #33
0
 private void Tick(object sender, Timers.ElapsedEventArgs e)
 {
     _logger.Debug("Sending SSDP notifications!");
     notificationTimer.Interval = random.Next(60000, 120000);
     NotifyAll();
 }
    void HandleTheTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        var urls = this.txtURLs.Buffer.Text.Trim().Split("\r\n".ToCharArray());

        this.CheckURLs(urls);
    }
Beispiel #35
0
 public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)
 {
     // TODO: Insert monitoring activities here.
     eventLog1.WriteEntry("Monitoring the System", EventLogEntryType.Information, eventId++);
 }
Beispiel #36
0
 public void SendToClient(object source, System.Timers.ElapsedEventArgs e)
 {
     Send(GetAllClientMessage());
 }
Beispiel #37
0
 //每过1秒,果子存在时间减1
 public void Time_Start(object source, System.Timers.ElapsedEventArgs e)
 {
     Exist_Time -= 1;
 }
 //主定时器
 public void HandleMainTimer(object sender, System.Timers.ElapsedEventArgs e)
 {
     //处理心跳
     HeartBeat();
     timer.Start();
 }
Beispiel #39
0
 private static void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
 {
     Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime);
 }
Beispiel #40
0
 /// <summary> Ran once timer elapses; updates values on labels </summary>
 static void timerevent(object obj, System.Timers.ElapsedEventArgs args)
 {
     Labels.LabelUpdate();
 }
Beispiel #41
0
 private void WorkRequestTimerExpired(object sender, System.Timers.ElapsedEventArgs e)
 {
     LogHelper.DebugConsoleLog(string.Format("Work request timer timed out with interval = {0} for device {1}", this.WorkRequestTimer.Interval, this.Name));
     RequestWork();
 }
Beispiel #42
0
 public void Retreat(object o, System.Timers.ElapsedEventArgs e)
 {
     velocity.Y = -2f;
     position  += velocity;
 }
Beispiel #43
0
 private void MoveMouth(Object source, System.Timers.ElapsedEventArgs e)
 {
     UpdatePacmanImage();
     mouth_open = !mouth_open;
 }
Beispiel #44
0
 public void theout(object source, System.Timers.ElapsedEventArgs e)
 {
     //fileName = "snapshot(" + number1 + "." + number2 + ").jpg";
     number2++;
     Console.Write("OK!");
 }
Beispiel #45
0
        /// <summary>
        /// 通用计时,用于记录窗体跟随,加载回放记录,回放完成后返回正常界面
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        public void tick_count(object source, System.Timers.ElapsedEventArgs e)
        {
            stringm();
            if (ispgavaliable)
            {
                freplay.Location = new System.Drawing.Point(this.Location.X + 860, this.Location.Y + 1);
            }
            else
            {
                freplay.Location = new System.Drawing.Point(this.Location.X + 645, this.Location.Y + 1);
            }
            counter++;
            rec_counter++;

            if (load_item != null)
            {
                repaly(load_item);
                Form3.selecteds = null;
                load_item       = null;
            }

            if (!isreplay)
            {
                if (Image_save.bm != null)
                {
                    Image_save.image_mutex.WaitOne();
                    Bitmap temp_bm = (Bitmap)Image_save.bm.Clone();
                    Image_save.image_mutex.ReleaseMutex();

                    Image last = pictureBox1.Image;
                    pictureBox1.Image = new Bitmap(temp_bm, new Size(600, 450));
                    last.Dispose();
                    temp_bm.Dispose();

                    listBox1.SelectedIndex = HNC_Connect.gline;
                }
            }

            if ((!HNC_Connect.iscon) || (isreplay))
            {
                video_button.Enabled = false;
            }
            else if (HNC_Connect.iscon && (!checkBox2.Checked))
            {
                video_button.Enabled = true;
            }

            if (start_record)
            {
                sw.Write("T" + rec_counter.ToString("d5") + "\n");
                sw.Write(wm[0] + "\n");
                sw.Write(wm[1] + "\n");
                sw.Write(wm[2] + "\n");
                sw.Write(wm[3] + "\n");
                sw.Write(wm[4] + "\n");
                sw.Write("L" + wm[5].Remove(4) + "\n");
                sw.Write("N" + "\n");
            }

            if (HNC_Connect.progch_event)
            {
                HNC_Connect.progch_event = false;

                string progn = HNC_Connect.progN /*.Remove(0, 8)*/;
                label21.Text = progn;

                Thread.Sleep(100);
                if (HNC_Connect.load_event)
                {
                    HNC_Connect.load_event = false;
                    listBox1.Items.Clear();
                    temp_path = gcode_path + progn;
                    while (!read_gcode(temp_path))
                    {
                        ;
                    }
                    listBox1.SelectedIndex = 0;
                }
            }


            if (checkBox2.Checked)
            {
                if (HNC_Connect.cyc_event == true)
                {
                    HNC_Connect.cyc_event = false;

                    tim = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString("d2") + DateTime.Now.Day.ToString("d2") + DateTime.Now.Hour.ToString("d2") + DateTime.Now.Minute.ToString("d2") + DateTime.Now.Second.ToString("d2");

                    if (HNC_Connect.cyc != 0)
                    {
                        creatDic(tim);
                        record_video(tim);
                        Image_save.record_event = true;
                        Thread.Sleep(10);
                        start_record = true;
                        //Image_save.writer.Open(NCVM_Form.FileV, 1280, 720, 25, VideoCodec.MPEG4, 5120000);
                        //Image_save.writer.Open(NCVM_Form.FileV, 1280, 960, 25, VideoCodec.MPEG4, 5120000);
                        Image_save.thread_save();
                        video_button.Text     = "结束录像";
                        label13.Visible       = true;
                        Start_button.Enabled  = false;
                        replay_button.Enabled = false;
                        //checkBox1.Enabled = false;
                        checkBox2.Enabled = false;
                        rec_counter       = 0;
                    }
                    else
                    {
                        start_record = false;
                        Thread.Sleep(10);
                        Image_save.record_event = true;
                        video_button.Text       = "开始录像";
                        label13.Visible         = false;
                        Start_button.Enabled    = true;
                        replay_button.Enabled   = true;
                        //checkBox1.Enabled = true;
                        checkBox2.Enabled      = true;
                        listBox1.SelectedIndex = 0;
                        Thread.Sleep(40);
                        sw.Close();
                    }
                }
            }

            if (HNC_Connect.cyc != 0)
            {
                listBox1.SelectedIndex = HNC_Connect.gline;
            }
            //Marshal.ReleaseComObject();
        }
Beispiel #46
0
 private void WatchdogExpired(object sender, System.Timers.ElapsedEventArgs e)
 {
     LogHelper.ConsoleLogError(string.Format("Device {0} hasn't responded for {1} sec. Restarting.", this.Name, (double)WatchdogTimeout));
     this.Reset();
     RequestWork();
 }
Beispiel #47
0
        private void _t_Elapsed(object sender, Timers.ElapsedEventArgs e)
        {
            LogBroker.Log("Leave timed out");

            _leaveFinished = true;
        }
Beispiel #48
0
 private void ForceRansomwareBoxToTop(Object source, System.Timers.ElapsedEventArgs e)
 {
     // Force ransomeware box to top (done less often)
     Invoke(new Action(() => { ransomwareBox.Focus(); }));
 }
Beispiel #49
0
        private void UpdateUI_Trigger(object sender, System.Timers.ElapsedEventArgs args)
        {
            FileStreamPage.UpdateUI(GetStreams);

            UpdateTimer.Start();
        }
Beispiel #50
0
        /// <summary>
        /// 回放计时,用于加载字符串
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        public void replay_count(object source, System.Timers.ElapsedEventArgs e)
        {
            #region replay exit

            if (isreplay)
            {
                string status = null;
                try
                {
                    status = axWindowsMediaPlayer1.playState.ToString();
                }
                catch (Exception ex)
                {
                    //Ignore
                }

                if ((status == "wmppsStopped") || (status == "wmppsMediaEnded"))
                {
                    isreplay = false;

                    axWindowsMediaPlayer1.close();
                    axWindowsMediaPlayer1.Visible = false;
                    start_video(true);

                    video_button.Enabled = true;
                    Start_button.Enabled = true;
                    replay_button.Text   = "回  放";
                    //pictureBox1.Image = hcnc;
                    list_read.Clear();
                    //listBox1.Items.Clear();
                    timer_replay.Stop();
                    if (HNC_Connect.iscon)
                    {
                        while (!read_gcode(gcode_path + HNC_Connect.progN))
                        {
                            ;
                        }
                    }
                    else
                    {
                        listBox1.Items.Clear();
                        listBox1.Items.Add("Waiting...");
                    }
                    Thread.Sleep(40);
                    try
                    {
                        sw.Close();
                    }
                    catch (NullReferenceException ex)
                    {
                        //Ignore
                    }
                    listBox1.SelectedIndex = 0;
                }
            }

            #endregion

            retim = read_data(replay_t, retim);
            stringm();
        }
Beispiel #51
0
 private void SearchTimerOnElapsed(object sender, SysTimer.ElapsedEventArgs e)
 {
     Dispatcher.Invoke(UpdateFilter);
 }
Beispiel #52
0
 private void PollTimer(Object source, System.Timers.ElapsedEventArgs e)
 {
     Logger.Info("Polling");
     GetPacket().GetAwaiter().GetResult();
 }
Beispiel #53
0
 private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
 }
Beispiel #54
0
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     //HACER EL PROCESO
 }
Beispiel #55
0
        private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)

        {
            Console.WriteLine("The Elapsed event was raised at {0} for an object of type {1}.", e.SignalTime, source.GetType().Name);
        }
Beispiel #56
0
 private void timer_Elapsed(object source, System.Timers.ElapsedEventArgs e)
 {
     ScheduledTask();
 }
Beispiel #57
0
 public static void ScheduledCommand(string command, System.Timers.ElapsedEventArgs e)
 {
     COMMAND.Parse(ChatHandler.Self, command);
 }
Beispiel #58
0
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     UpdateClock();
     StartTimer();
 }
Beispiel #59
0
 public virtual void Start(object source, System.Timers.ElapsedEventArgs e)
 {
 }
Beispiel #60
0
    public void Drain(object sender, System.Timers.ElapsedEventArgs e)
    {
        if (Summ > threshold)
        {
            if (arTA != null)
            {
                if (arTA.IsCompleted)
                {
                    if (onThreshold != null)
                    {
                        onThreshold();
                    }
                    TA   = ActionNeuron;
                    arTA = TA.BeginInvoke(null, null);
                }
            }
            else
            {
                if (onThreshold != null)
                {
                    onThreshold();
                }
                TA   = ActionNeuron;
                arTA = TA.BeginInvoke(null, null);
            }
        }

        if (Summ < thresholdDown)
        {
            if (arTA != null)
            {
                if (arTA.IsCompleted)
                {
                    if (DeReActionNeuron != null)
                    {
                        DeReActionNeuron();
                    }
                    TA   = DeReAction;
                    arTA = TA.BeginInvoke(null, null);
                }
            }
            else
            {
                if (DeReActionNeuron != null)
                {
                    DeReActionNeuron();
                }
                TA   = DeReAction;
                arTA = TA.BeginInvoke(null, null);
            }
        }


        if (Mathf.Abs(Summ) <= Dampfer)
        {
            Summ = 0f;
        }
        if (Summ > Dampfer)
        {
            Summ -= Dampfer;
        }
        if (Summ < -Dampfer)
        {
            Summ += Dampfer;
        }

        Summ     += _addForce;
        _addForce = 0;
    }