Stop() public method

public Stop ( ) : void
return void
        private void ExecuteWebRequest(string url, Action<string> callback, Action<Exception> error)
        {
            DispatcherTimer timer = new DispatcherTimer();

              // create a web client to fetch the URL results
              WebClient webClient = new WebClient();
              webClient.DownloadStringCompleted += (s, e) =>
              {
            timer.Stop();
            try
            {
              string result = e.Result;
              callback(result);
            }
            catch (Exception ex)
            {
              error(ex);
            }
              };

              // initiate the download
              webClient.DownloadStringAsync(new Uri(url));

              // create a timeout timer
              timer.Interval = TimeSpan.FromSeconds(5);
              timer.Start();
              timer.Tick += (s, e) =>
            {
              timer.Stop();
              webClient.CancelAsync();
              error(new TimeoutException());
            };
        }
Example #2
0
        private void timer_primerTick(object sender, EventArgs e)
        {
            string sec, min;

            sec_count++;
            if (sec_count > 59)
            {
                min_count++;
                sec_count = 0;
            }
            sec = sec_count > 9 ? sec_count.ToString() : "0" + sec_count;
            min = min_count > 9 ? min_count.ToString() : "0" + min_count;
            TimeLabel.Content = min + ":" + sec;
            if (checkBoxTimeSetting.IsChecked.Value)
            {
                if (min_count == time_user)
                {
                    timer_primer.Stop();
                    timer_primer = new System.Windows.Threading.DispatcherTimer();
                    U            = true_ovet - skip_otvet;
                    U            = U / (min_count * 60 + sec_count);
                    U            = U * 60;
                    GridGameFinish.Visibility = Visibility.Visible;
                    CountPrimerItog.Content   = String.Format("Вы решили примеров: {0}", true_ovet);
                    CountTimeItog.Content     = String.Format("За время: {0}:{1}", min, sec);
                    CountUItog.Content        = String.Format("Ваша скорость: {0:#.##}", U);
                    CountGameToday.Content    = String.Format("Попытка за сегодня: {0}", attempt.Attempt(@"Attempt.txt"));
                    stat.Statistic("ExStat.txt", String.Format("{0} \t {1}", U, DateTime.Now));
                    true_ovet = 0; false_otvet = 0;
                }
            }
        }
        void _Timer_For_Process__Tick(object sender, EventArgs e)
        {
            // Desabilitado Pelo Desenvolvedor
            if (_STATUS_API_ != STATUS_API.Online)
            {
                _Timer_For_Process_.Stop();
                return;
            }

            // GetProcess
            Process[] _Trove = Process.GetProcessesByName("Trove");
            if (_Trove.Length == 0)
            {
                LBL_STATUS.Content = "Waiting Trove . . .";
                _IsGameEnabled     = false;
                return;
            }
            // Jogo Disponivel
            _IsGameEnabled = true;
            // GetMD5 - Não Injetar em versão Não suportada :P1
            if (BaseTrove.BASE_TROVE_CORE_SOURCE._API_MD5_FILE_CORE_SOURCE_ != Hash_Codifica_Decodifica.Encrypt(CL_UTIL._Get_MD5_FROM_Trove_(_Trove[0].Modules[0].FileName)))
            {
                Console.WriteLine("MD5 File Not Support");
                LBL_STATUS.Content = "Outdated . . .";
                _IsGameEnabled     = false;
                _Timer_For_Process_.Stop();
                return;
            }
            else
            {
                Console.WriteLine(". . . . ");
                LBL_STATUS.Content = "Ready . . .";
            }
            _IsGameEnabled = true;
        }
Example #4
0
        private void dispatcherDeathTimer_Tick(object sender, EventArgs e)
        {
            if (i != 600)
            {
                gir.hunt(dir.x, dir.y, gir.x, gir.y, map);
                gh.bonusMode(1, 1);
                gir.randomdir();
                i++;

                gh.isChasing = false;
                gh.waypoints.Clear();
                if (meet(map, ref Game) == true)
                {
                    //scene.Children.Remove(ghost1);
                    gh.move(55, 55);
                    score += 50;

                    DeathTimer.Stop();
                    ghTimer.Start();
                    i = 0;
                }
            }
            else
            {
                DeathTimer.Stop();
                ghTimer.Start();
                i = 0;
            }
        }
Example #5
0
        private void timer_magicTick(object sender, EventArgs e)
        {
            string sec, min;

            sec_count++;
            if (sec_count > 59)
            {
                min_count++;
                sec_count = 0;
            }
            sec = sec_count > 9 ? sec_count.ToString() : "0" + sec_count;
            min = min_count > 9 ? min_count.ToString() : "0" + min_count;
            TimeLabel2.Content = min + ":" + sec;
            if (min_count == time_user_magic)
            {
                timer_magic.Stop();
                timer_magic = new System.Windows.Threading.DispatcherTimer();
                U           = magic_true_inLabel;
                U           = U / (min_count * 60 + sec_count);
                U           = U * 60;
                GridGameFinish.Visibility = Visibility.Visible;
                CountPrimerItog.Content   = String.Format("Вы решили квадратов: {0}", magic_true_inLabel);
                CountTimeItog.Content     = String.Format("За время: {0}:{1}", min, sec);
                CountUItog.Content        = String.Format("Ваша скорость: {0:#.##}", U);
                CountGameToday.Content    = String.Format("Попытка за сегодня: {0}", attempt.Attempt(@"MSAttempt.txt"));
                stat.Statistic("MagStat.txt", String.Format("{0} \t {1}", U, DateTime.Now));
                magic_false_inLabel = 0;
                magic_true_inLabel  = 0;
            }
        }
 public static void DispatcherPoll(Func<bool> condition, Action action, int waitLoops, int waitTime)
 {
     int i = 0;
     var timer = new DispatcherTimer()
     {
         Interval = new TimeSpan(waitTime),
         Tag = 0
     };
     timer.Tick += (sender, args) =>
     {
         if (i == waitLoops)
         {
             timer.Stop();
         }
         else
         {
             if (condition())
             {
                 timer.Stop();
                 action();
             }
             else
             {
                 ++i;
             }
         }
     };
     timer.Start();
 }
        void Countdown(int count, TimeSpan interval, Action <int> ts, bool start)
        {
            var dt = new System.Windows.Threading.DispatcherTimer();

            dt.Interval = interval;
            dt.Tick    += (_, a) =>
            {
                if (count-- == 0)
                {
                    dt.Stop();
                }
                else
                {
                    ts(count);
                }
            };
            ts(count);

            if (start == true)
            {
                dt.Start();
            }
            else if (start == false)
            {
                dt.Stop();
            }
        }
Example #8
0
        private void timer_tick(object sender, EventArgs e)
        {
            time_info.Text = "Time: " + time;
            score_box.Text = "Score: " + score;
            time++;
            score--;

            scope.Margin = new Thickness(GetMouse().X - 80, GetMouse().Y - 80, 0, 0);


            foreach (Enemy_box E in enemies)
            {
                E.X     += rnd.Next(Convert.ToInt32(-E.Speed), Convert.ToInt32(E.Speed));
                E.Y     += rnd.Next(Convert.ToInt32(-E.Speed), Convert.ToInt32(E.Speed));
                E.Margin = new Thickness(E.X, E.Y, 0, 0);
                if (IsShooted(scope.Margin, E.Margin))
                {
                    score += 10;

                    if (gun_check.IsChecked.Value)
                    {
                        E.Hp -= 10;
                    }
                    else if (shootgun_check.IsChecked.Value)
                    {
                        E.Hp -= 50;
                    }
                }

                if (E.Hp <= 0)
                {
                    score       += 100;
                    E.Visibility = Visibility.Hidden;
                    E.Hp         = 100000;
                    shooted++;
                }
            }

            if (shooted == 4)
            {
                gamestatus_text.Text       = "Victory\nScore: " + score + "\nTime: " + time;
                gamestatus_text.Visibility = Visibility.Visible;
                score_box.Visibility       = Visibility.Hidden;
                time_info.Visibility       = Visibility.Hidden;
                scope.Visibility           = Visibility.Hidden;
                timer.Stop();
            }

            if (time >= 100)
            {
                gamestatus_text.Text       = "Game Over\nScore: " + score + "\nTime: " + time;
                gamestatus_text.Visibility = Visibility.Visible;
                score_box.Visibility       = Visibility.Hidden;
                time_info.Visibility       = Visibility.Hidden;
                scope.Visibility           = Visibility.Hidden;
                timer.Stop();
            }
        }
Example #9
0
 public void StopRunning()
 {
     if (MainForm.leftKeyDown == false && MainForm.rightKeyDown == false)
     {
         _runTimer.Stop();
         pbDog.Tag = 0;
         _wagTimer.Start();
     }
 }
Example #10
0
 private void GameInstructionButton_Click(object sender, RoutedEventArgs e)
 {
     GameTimer.Stop();
     HideAllCanvases();
     MainGameCanvas.Visibility        = Visibility.Visible;
     GameInstructionCanvas.Visibility = Visibility.Visible;
     // InstructionTextBlock.Text = "Your task is to find couple of the same picture. Choose level of difficult and mode. If You want to check your place in ranking, press ''Ranking''.";
     GameInstructionTextBlock.Text = "Find the same picture. For shuffling cards, press ''shuffle'' button. For help, press ''hint'' button";
 }
        private void Animate_Click(object sender, RoutedEventArgs e)
        {
            string exceptionMessage = string.Empty;

            try
            {
                // Change the Content of the Animate button depending on whether it has been clicked.
                AnimateSunTimeButton.Content = AnimateSunTimeButton.IsChecked.Value ? "Stop Animation" : "Animate Light Position";

                if (_myDispatcherTimer == null)
                {
                    // Start a new Timer at 1 second intervals
                    _myDispatcherTimer          = new DispatcherTimer();
                    _myDispatcherTimer.Interval = TimeSpan.FromSeconds(1);


                    DateTime dt = utcBerlin;
                    AnimateSunTimeLabel.Content = utcBerlin;
                    int i = 0;
                    MySceneView.SetSunTime(dt);
                    _myDispatcherTimer.Tick += (s, p) =>
                    {
                        i++;
                        if (i <= 24)
                        {
                            dt = dt.AddHours(1);
                            MySceneView.SetSunTime(dt);
                            AnimateSunTimeLabel.Content = dt;
                        }
                        else
                        {
                            i = 1;
                        }
                    };
                    _myDispatcherTimer.Start();
                }
                else
                {
                    _myDispatcherTimer.Stop();
                    _myDispatcherTimer = null;
                }
            }
            catch (Exception ex)
            {
                exceptionMessage = ex.Message;
                if (_myDispatcherTimer != null)
                {
                    _myDispatcherTimer.Stop();
                }
                _myDispatcherTimer = null;
            }

            if (!string.IsNullOrEmpty(exceptionMessage))
            {
                MessageBox.Show(exceptionMessage, "Sample Error");
            }
        }
Example #12
0
        //add end

        public void StopMono()
        {
            _dTimer.Stop();
            btnStop.Command.Execute(null);
            //AgilentDll.Sensor.Close();
            //_viewmodel = null;
            this.DataContext = null;
            //GC.Collect();
        }
Example #13
0
 private void Button_STOP(object sender, RoutedEventArgs e)
 {
     BASSlike.stop();
     timer.Stop();
     Prog.Value         = 0;
     label1.Content     = "00:00:00";
     PlayButton.Content = "Play";
     i = 2;
 }
Example #14
0
        /// <summary>
        ///   定时刷新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dtimer_Tick(object sender, EventArgs e)
        {
            dtimer.Stop();
            adtimer.Stop();
            stadtimer.Stop();
            MainWindow mv = new MainWindow();

            mv.Show();
            this.Close();
        }
Example #15
0
        private void FrameTick(object sender, EventArgs e)
        {
            time             = time.Add(timerInterval);
            TimeValue.Header =
                (time.Hours < 10 ? "0" + time.Hours.ToString() : time.Hours.ToString())
                + ":" + (time.Minutes < 10 ? "0" + time.Minutes.ToString() : time.Minutes.ToString())
                + ":" + (time.Seconds < 10 ? "0" + time.Seconds.ToString() : time.Seconds.ToString())
                + "." + (time.Milliseconds / 100).ToString();

            snake.Move(distance, new Size(GameArea.X, GameArea.Y), snake.HeadSprite.FrameSize);

            Game.CheckSnakeCollisions(snake, out _endOfGame);

            if (apple.GetType() != typeof(SpoiledApple) && Game.IsSnakeAteApple(snake, apple, ref _score, _appleScoreCost))
            {
                // Set new apple
                Game.MakeNewApple(snake, GameArea.X, GameArea.Y, ref apple);
                ScoreValue.Header = _score.ToString();
                // Add snake segment
                snake.AddBodyPointToEnd();
            }
            else if (apple.GetType() == typeof(SpoiledApple) && Game.IsSnakeAteApple(snake, apple, ref _score, _appleScoreCost))
            {
                Game.MakeNewApple(snake, GameArea.X, GameArea.Y, ref apple);
                ScoreValue.Header = _score.ToString();
                // Add snake segment
                snake.AddBodyPointToEnd();
                snake.AddBodyPointToEnd();
                gameTimer.Interval -= new TimeSpan(100000);
            }

            try
            {
                RedrawObjects();
            }
            catch (Exception ex)
            {
                gameTimer.Stop();
                time = new TimeSpan(0, 0, 0);
                MenuStatus.Content = App.Current.Resources["StatusError"].ToString() + "!"; // "Something went wrong, we got error!"
                MessageBox.Show(ex.Message, App.Current.Resources["Error"].ToString() + "!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
                MenuGrid.Visibility = Visibility.Visible;
                GameGrid.Visibility = Visibility.Hidden;
            }

            if (_endOfGame)
            {
                gameTimer.Stop();
                time = new TimeSpan(0, 0, 0);
                MenuStatus.Content = App.Current.Resources["End_of_game"].ToString() + "! \n\n"
                                     + App.Current.Resources["Your_score"].ToString() + ":" + _score.ToString();
                MenuGrid.Visibility = Visibility.Visible;
                GameGrid.Visibility = Visibility.Hidden;
            }
        }
Example #16
0
        private void clearNextScreen(object sender, EventArgs e)
        {
            dt.Stop();
            frm.clearPreview();

            dt2 = new System.Windows.Threading.DispatcherTimer();
            dt2.Stop();
            dt2.Interval = TimeSpan.FromMilliseconds(interim + 2000);
            dt2.Tick    += new EventHandler(nextLayer);
            dt2.Start();
        }
 private void OnTimedEvent(object source, EventArgs e)
 {
     dispatcherTimer.Stop();
     SpanTime = new TimeSpan();
     SpanTime = SpanTime.Add(dispatcherTimer.Interval);
     this.Dispatcher.Invoke(() =>
     {
         BottomPanelTool.Visibility = Visibility.Hidden;
         TopPanelTool.Visibility    = Visibility.Hidden;
     });
 }
Example #18
0
        public MainWindow()
        {
            InitializeComponent();

            Count_mine.Content = "0";

            GemClock.Tick += DispatcherTimer_Tick;
            GemClock.Stop();

            New_Game.Click += new RoutedEventHandler((s, ae) => { NewGame(); ReClock(); }); //  New_Game_Click;
            ScoreTB.Click  += new RoutedEventHandler((s, ae) => { CallScoreBoard(); });
        }
 public void TimeSlider_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (dxPlay == null)
     {
         return;
     }
     WasPlaing = IsPlaying;
     if (IsPlaying)
     {
         pause(); timer.Stop();
     }
 }
Example #20
0
        // Temporizador 1
        public void temporizador1_tick(object sender, EventArgs e)
        {
            if (a != 00)
            {
                a--;
            }



            segundoUno = a;

            if (segundoUno == 00)
            {
                if (minutoUno != 00)
                {
                    segundoUno = 59;
                    minutoUno--;
                    a = segundoUno;
                }

                if ((horaUno != 00) && (minutoUno == 00))
                {
                    horaUno--;
                    minutoUno = 59;
                    minutoUno--;
                    segundoUno = 59;
                    a          = segundoUno;
                }



                if ((segundoUno == 00) && (horaUno == 00) && (minutoUno == 00))
                {
                    segundoUno = 0;
                    temporizador1.Stop();
                    if (NumeroMedia == 0)
                    {
                        MediaElementAlarma.Play();
                    }
                    else
                    {
                        MediaElementAlarma.Stop();
                    }
                    temporizador2.Start();
                    System.Threading.Thread.Sleep(18000);
                }
            }



            Crono1.Text   = horaUno + ":" + minutoUno + ":" + segundoUno;
            CronoUni.Text = horaUno + ":" + minutoUno + ":" + segundoUno;
        }
Example #21
0
        void serverDetailRotater3DTransition_RotateCompleted(object sender, EventArgs e)
        {
            double angleTo   = (double)detailRotater3DTransition.GetValue(XamlTransitions.Rotate3D.AngleRotateToProperty);
            double angleFrom = (double)detailRotater3DTransition.GetValue(XamlTransitions.Rotate3D.AngleRotateFromProperty);

            if (angleTo == 180)
            {
                detailRotater3DTransition.Visibility = Visibility.Collapsed;
                detailBackGridTranslate.X            = 0;

                uiMasterView3DTimer.Start();
            }

            if (angleTo == 0)
            {
                detailFrontGridTranslate.X     = 0;
                masterView2DWrapperTranslate.X = 0;
                uiMasterView3DTimer.Stop();
                detailRotater3DTransition.Visibility = Visibility.Collapsed;
                masterRotater3DTransition.SetValue(XamlTransitions.Rotate3D.FrontMaterialProperty, (Material)null);
            }


            if (angleTo == 90)
            {
                if (angleFrom == 0)
                {
                    detailMain.SetValue(Grid.ColumnProperty, (int)1);
                    detailMain.SetValue(Grid.ColumnSpanProperty, (int)2);
                    gridRelayout = true; // event occurs aftre layout is done - snap shot is done at this time
                }

                if (angleFrom == 180)
                {
                    detailMain.SetValue(Grid.ColumnProperty, (int)2);
                    detailMain.SetValue(Grid.ColumnSpanProperty, (int)1);
                    gridRelayout = true; // event occurs aftre layout is done - snap shot is done at this time

                    // Rotate Master View
                    masterRotater3DTransition.SetValue(XamlTransitions.Rotate3D.AngleRotateFromProperty, (double)30);
                    masterRotater3DTransition.SetValue(XamlTransitions.Rotate3D.AngleRotateToProperty, (double)0);
                    masterRotater3DTransition.Rotate();
                    double scaleTo = (double)masterRotater3DTransition.GetValue(XamlTransitions.Rotate3D.ScaleXProperty);
                    masterRotater3DTransition.AnimateScaleXTo(scaleTo);
                    double translateTo = (double)masterRotater3DTransition.GetValue(XamlTransitions.Rotate3D.TranslateXProperty);
                    masterRotater3DTransition.AnimateTranslateXTo(translateTo);
                    double scaleYTo = (double)masterRotater3DTransition.GetValue(XamlTransitions.Rotate3D.ScaleYProperty);
                    masterRotater3DTransition.AnimateScaleYTo(scaleYTo);
                }
            }
        }
Example #22
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (Temporizador != null)
     {
         Temporizador.Stop();
     }
     // Preguntar si quiere cerrar.
     if (bPedirConfirmacion)
     {
         if (MessageBox.Show("¿Salir del programa?", "Cerrar", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
         {
             e.Cancel = true;
         }
     }
     if (!e.Cancel)
     {
         if (PuertoCOM.IsOpen)
         {
             PuertoCOM.Close();
         }
         if (BartenderEngine != null)
         {
             BartenderEngine.Stop(Bartender.SaveOptions.DoNotSaveChanges);
         }
     }
     else
     {
         if (Temporizador != null)
         {
             Temporizador.Start();
         }
     }
 }
Example #23
0
        /// <summary>
        ///  定时刷新从新生成窗口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dtimer_Tick(object sender, EventArgs e)
        {
            //主计时器停止
            dtimer.Stop();
            //广告计时器停止
            adtimer.Stop();
            //状态更新计时器停止
            stadtimer.Stop();
            //生成新的主窗口
            MainWindow mv = new MainWindow();

            mv.Show();
            //旧窗口关闭
            this.Close();
        }
Example #24
0
 private void Continue_Click(object sender, RoutedEventArgs e)
 {
     BackKeyTimer.Stop();
     BackTimerCounter        = 3;
     Quit.Visibility         = System.Windows.Visibility.Collapsed;
     ContentPanel.Visibility = System.Windows.Visibility.Visible;
     if (BonusTimerCounter <= 0)
     {
         MainTimer.Start();
     }
     else
     {
         BonusTimer.Start();
     }
 }
Example #25
0
        private void EditorOnTextChanged(object sender, EventArgs eventArgs)
        {
            //todo : ew.
            _scene.FragmentShaderSource = Editor.Text;

            if (timer == null)
            {
                timer    = new DispatcherTimer();
                Closing += (q, args) =>
                {
                    timer?.Stop();
                };
                timer.Tick += (s, args) =>
                {
                    Dispatcher.Invoke(() => { _scene.Initialise(_gl); });
                    timer.Stop();
                };
            }
            else
            {
                timer.Stop();
            }
            timer.Interval = TimeSpan.FromMilliseconds(500);
            timer.Start();
        }
Example #26
0
        public ViewModel(Window mainWin)
        {
            _dispatchTimer = new DispatcherTimer(new TimeSpan(0, 0, 5), DispatcherPriority.Normal, OnDispatcherTimer,
                                                 mainWin.Dispatcher);
            _dispatchTimer.Stop();;

            try
            {
                _monitorManager = MonitorManagerFactory.GetInstance();

                _monitorManager.UpdateMonitors(null);

                _deviceDetector = DeviceDetector.GetInstance();

                _deviceDetector.DeviceAttached += this.OnDeviceNotify;
                _deviceDetector.DeviceRemoved += this.OnDeviceNotify;
            }
            catch (Win32Exception win32Exception)
            {
                MessageBox.Show(String.Format("{0} \n StackTrace: \n{1}", win32Exception.Message, win32Exception.StackTrace),
                                             win32Exception.ErrorCode.ToString());
            }
            catch (System.TypeLoadException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public Page_ClientMain()
 {
     this.InitializeComponent();
     DataContext = App.ViewModel;
     DispatcherTimer tmr = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(5) };
     tmr.Tick += (_1, _2) =>
                     {
                         if (MultimediaUtil.VideoInputDevices.Any())
                         {
                             if (App.ViewModel.CurCam==null)
                                 App.ViewModel.CurCam = MultimediaUtil.VideoInputDevices[0];
                             WebCam.VideoCaptureDevice = App.ViewModel.CurCam;
                         }
                         //WebCam.
                         tmr.Stop();
                     };
     Loaded += (_1, _2) =>
     {
         if (App.ViewModel.ClientType == RemotingMessage.ClientTypes.Extended)
         {
         /*    conference.Visibility = System.Windows.Visibility.Visible;
             cr_1.DataContext = App.ViewModel.ConferenceRoom[1];
             cr_2.DataContext = App.ViewModel.ConferenceRoom[2];
             cr_3.DataContext = App.ViewModel.ConferenceRoom[3];*/
             tmr.Start();
         }
     };
 }
Example #28
0
        public wMain(Host _AppObjects)
        {
            try
            {
                InitializeComponent();
                lmf= MemoryField.LoadData("addresses.txt");
                Tag = this.Title;
                coll = new ObservableCollection<MemoryField>();
               // coll.Add(new MemoryField() { Address = Convert.ToString(0x450BBC, 16), Type = "BattleTime", Comment = "" });
                foreach (MemoryField mf in lmf) coll.Add(mf);
                dgMemory.ItemsSource = coll;
                dgMemory.Items.Refresh();
                dgMemory.CanUserReorderColumns = false;
                AppObjects = _AppObjects;               
                this.Owner = AppObjects.wMain;
                _timer = new DispatcherTimer();
                _timer.Tick += new EventHandler(_timer_Tick);

                lsFonts = new List<string>();
                foreach (FontFamily s in Fonts.SystemFontFamilies)
                lsFonts.Add(s.Source);
                FontFamily fm = new System.Windows.Media.FontFamily(SystemFonts.CaptionFontFamily.Source);
                
                dgMemory.FontFamily = fm;
                dgMemory.UpdateLayout();
                
                Start_Click(null, null);                                
            }
            catch (Exception)
            {
                _timer.Stop();
                throw;
            }
        }
		//public static event Action<Delegate, long> TimerEvent;


		public static DispatcherTimer AtDelay(this int Milliseconds, Action Handler)
		{
			if (Handler == null)
				return null;

			var t = new DispatcherTimer
			{
				Interval = TimeSpan.FromMilliseconds(Milliseconds)
			};

			t.Tick +=
				delegate
				{
					//var mark = DateTime.Now.Ticks;

					Handler();

					//if (TimerEvent != null)
					//    TimerEvent(Handler, DateTime.Now.Ticks - mark);

					t.Stop();
				};

			t.Start();

			return t;
		}
Example #30
0
        public PatientDetail3DManager(object fe)
        {
            baseFrameworkElement = fe as FrameworkElement;

            if (baseFrameworkElement == null)
            {
                return;
            }

            detailFront2D = (FrameworkElement)baseFrameworkElement.FindName("DetailFront2D");
            detailBack2D  = (FrameworkElement)baseFrameworkElement.FindName("DetailBack2D");
            detailBack2DWrapperTranslate  = (TranslateTransform)baseFrameworkElement.FindName("DetailBack2DWrapperTranslate");
            detailFront2DWrapperTranslate = (TranslateTransform)baseFrameworkElement.FindName("DetailFront2DWrapperTranslate");
            masterView2DWrapperTranslate  = (TranslateTransform)baseFrameworkElement.FindName("MasterView2DWrapperTranslate");
            detailBack2DWrapper           = (FrameworkElement)baseFrameworkElement.FindName("DetailBack2DWrapper");
            detailMain = (FrameworkElement)baseFrameworkElement.FindName("Detail");
            patientDetailRotater3DTransition = (IdentityMine.Avalon.Controls.Rotater3DTransition)baseFrameworkElement.FindName("PatientDetailRotater3DTransition");
            patientDetailRotater3DTransition.RotateCompleted += new IdentityMine.Avalon.Controls.Rotater3DTransition.SelectedEventHandler(patientDetailRotater3DTransition_RotateCompleted);

            masterView2D = (FrameworkElement)baseFrameworkElement.FindName("MasterView2D");
            patientMasterRotater3DTransition = (IdentityMine.Avalon.Controls.Rotater3DTransition)baseFrameworkElement.FindName("PatientMasterRotater3DTransition");
            patientMasterRotater3DTransition.RotateCompleted += new IdentityMine.Avalon.Controls.Rotater3DTransition.SelectedEventHandler(patientMasterRotater3DTransition_RotateCompleted);

            detailMain.LayoutUpdated += new EventHandler(detailMain_LayoutUpdated); // detail page changes layout with in the grid and 2D and 3D elements need to be updated

            detailBack2DWrapperTranslate.X = 10000;                                 // move back offscreen

            //setup a timer for updating the MasterView3D area. Due to bugs in VisualBrush on Beta2. This technique is being used
            //brushMaster = new VisualBrush(visual);
            uiMasterView3DTimer          = new System.Windows.Threading.DispatcherTimer();
            uiMasterView3DTimer.Interval = TimeSpan.FromMilliseconds(timerMasterView3DFrameRate);
            uiMasterView3DTimer.Tick    += new EventHandler(uiTimerMasterView3D_Tick);
            uiMasterView3DTimer.Stop();
        }
 public override void Run(RoleBase caster, Space space, MagicArgs args)
 {
     targets.Add(args.Target);
     for (int i = space.AllRoles().Count - 1; i >= 0; i--) {
         if (targets.Count == args.Number) { break; }
         RoleBase target = space.AllRoles()[i];
         if (caster.IsHostileTo(target) && target.InCircle(args.Destination, args.Radius * args.Scale)) {
             if (target != args.Target) { targets.Add(target); }
         }
     }
     int index = 0;
     CreateSubMagic(caster, space, args, index);
     DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(200) };
     EventHandler handler = null;
     timer.Tick += handler = delegate {
         if (caster.IsHostileTo(targets[index])) { caster.CastingToEffect(targets[index], args); }
         index++;
         if (index == targets.Count) {
             timer.Stop();
             timer.Tick -= handler;
         } else {
             int newInterval = timer.Interval.Milliseconds - 30;
             if (newInterval <= 20) { newInterval = 20; }
             timer.Interval = TimeSpan.FromMilliseconds(newInterval);
             CreateSubMagic(caster, space, args, index);
         }
     };
     timer.Start();
 }
 protected override void BeginRequest(RetryQueueRequest request)
 {
     //Adding an intentional delay here to work around a known timing issue
     //with the SSME.  If this is called too soon after initialization the
     //request will be aborted with no indication raised from the SSME.
     //TODO: Remove this workaround once the SSME has been fixed.
     DispatcherTimer timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(250);
     EventHandler tickHandler = null;
     tickHandler = (s, e) =>
         {
             SegmentInfo segment = null;
             List<StreamInfo> streams = null;
             var streamSelectionRequest = request as StreamSelectionRequest;
             if (streamSelectionRequest != null)
             {
                 streams = streamSelectionRequest.Streams.ToList();
                 segment = streamSelectionRequest.Segment;
             }
             else
             {
                 var streamModifyRequest = request as StreamModifyRequest;
                 if (streamModifyRequest != null)
                 {
                     streams = streamModifyRequest.Streams.ToList();
                     segment = streamModifyRequest.Segment;
                 }
             }                    
             segment.SelectStreamsAsync(streams, request);
             timer.Tick -= tickHandler;
             timer.Stop();
         };
     timer.Tick += tickHandler;
     timer.Start();
 }
        public ContextActionsRenderer(CodeTextEditor editor, TextMarkerService textMarkerService)
        {
            if (editor == null) throw new ArgumentNullException(nameof(editor));
            _editor = editor;
            _textMarkerService = textMarkerService;

            editor.TextArea.Caret.PositionChanged += CaretPositionChanged;

            editor.KeyDown += ContextActionsRenderer_KeyDown;
            _providers = new ObservableCollection<IContextActionProvider>();
            _providers.CollectionChanged += providers_CollectionChanged;

            editor.TextArea.TextView.ScrollOffsetChanged += ScrollChanged;
            _delayMoveTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(DelayMoveMilliseconds) };
            _delayMoveTimer.Stop();
            _delayMoveTimer.Tick += TimerMoveTick;

            if (editor.IsLoaded)
            {
                HookupWindowMove();
            }
            else
            {
                editor.Loaded += OnEditorLoaded;
            }
        }
        public MainWindowViewModel()
        {
            _modelCore = new ModelCore();
            _angleLogger = new AngleLogger(_modelCore);

            //描画とFPSの表示設定
            var drawer = new KinectBodyDrawer(_modelCore.KinectConnector);
            ImageSource = drawer.ImageSource;

            var timerForFps = new DispatcherTimer();
            timerForFps.Interval = TimeSpan.FromMilliseconds(100.0);
            timerForFps.Tick += (_, __) =>
            {
                FpsFrameArrived = _modelCore.FpsFrameArrived;
                FpsDataSend = _modelCore.FpsDataSend;
            };

            //イベントとコマンド設定
            SubscribeToModelEvents(_modelCore);
            SendDataChangeToModel(_modelCore);

            ConnectToServerCommand = new RelayCommand(() => _modelCore.AngleDataSender.Connect(IPAddress, Port));
            DisconnectFromServerCommand = new RelayCommand(() => _modelCore.AngleDataSender.Close());

            CloseWindowCommand = new RelayCommand(() =>
            {
                _modelCore.Dispose();
                _angleLogger.Dispose();
                timerForFps.Stop();
            });

            timerForFps.Start();
        }
Example #35
0
        public static void AnimatedPageLeft(this ScrollViewer S)
        {
            if (Page <=0 )
            {
                InAnimation = false;
                return;
            }
            double CurrentOffset = Page * PageWidth;
            double TargetOffset = Page * PageWidth - PageWidth;
            double Step = PageWidth / Duration;
            DispatcherTimer Timer = new DispatcherTimer();
            Timer.Interval = TimeSpan.FromMilliseconds(Interval);
            int TimeOffset = 0;
            Levevalue = (int)Duration / Interval;
            double StepValue = PageWidth/((Levevalue * (Levevalue + 1)) / 2);
            double savevalue = 0;

            Timer.Tick += (s, e) =>
            {
                savevalue += StepValue * ((Duration - TimeOffset) / 10);
                TimeOffset += Interval;
                S.ScrollToHorizontalOffset(CurrentOffset - savevalue);
                if (TimeOffset >= Duration)
                {
                    S.ScrollToHorizontalOffset(TargetOffset);
                    Timer.Stop();
                    InAnimation = false;
                }
            };
            Timer.Start();
            Page--;
        }
        public NewsItemFullPage()
        {
            InitializeComponent();

            _m = Marker.GetInstance();

            _cf = CategoryConfigA.Config;

            _sizeConfig = SizeConfig2;

            //_isSubscribed = false;

            if (UserConfig.FontSize == FontSizes.xsmall)
                _sizeConfig = SizeConfig0;
            else if (UserConfig.FontSize == FontSizes.small)
                _sizeConfig = SizeConfig1;
            else if (UserConfig.FontSize == FontSizes.medium)
                _sizeConfig = SizeConfig2;
            else if (UserConfig.FontSize == FontSizes.large)
                _sizeConfig = SizeConfig3;
            else if (UserConfig.FontSize == FontSizes.xlarge)
                _sizeConfig = SizeConfig4;

            var adsTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
            adsTimer.Tick += (sender, args) =>
            {
                InvokeAppendContent();
                adsTimer.Stop();
            };
            adsTimer.Start();

            GeneralHelper.SetupTutorial(6, Tutorial);
        }
        private InvokableCallMethodAction _callMethodAction; // action used to invoke the method

        public InvokeMethodTimer()
        {
            // Create a CallMethodAction to handle invoking the method.  Use the InvokableCallMethodAction
            // class so that the Invoke method can be invoked programmatically.
            _callMethodAction = new InvokableCallMethodAction();

            // Bind the action's MethodName and TargetObject properties to the corresponding properties
            // on the InvokeMethodTimer object
            Binding b = new Binding("MethodName") { Source = this };
            BindingOperations.SetBinding(_callMethodAction, CallMethodAction.MethodNameProperty, b);

            b = new Binding("TargetObject") { Source = this };
            BindingOperations.SetBinding(_callMethodAction, CallMethodAction.TargetObjectProperty, b);

            // Add the CallMethodAction to the InvokeMethodTimer's triggers collection.  Without this,
            // invoking the action will fail silently.
            Interactivity.EventTrigger trigger = new Interactivity.EventTrigger();
            trigger.Actions.Add(_callMethodAction);
            Interactivity.TriggerCollection triggers = Interactivity.Interaction.GetTriggers(this);
            triggers.Add(trigger);

            // Initialize the timer
            _timer = new DispatcherTimer() { Interval = Delay };
            _timer.Tick += (o, e) => 
            {
                _timer.Stop();
                _callMethodAction.Invoke(null); 
            };
        }
Example #38
0
 public QuestionView()
 {
     InitializeComponent();
     defaultAnswerButtonBrush = new Button().Background;
     maxCountDown = TimeSpan.FromSeconds(30);
     countDown = new DispatcherTimer();
     countDown.Interval = TimeSpan.FromSeconds(1);
     countDown.Tick += ((o, args) =>
         {
             remainingCountDown = remainingCountDown.Subtract(TimeSpan.FromSeconds(1));
             Timer.Content = remainingCountDown.Seconds;
             if (remainingCountDown == TimeSpan.Zero)
             {
                 countDown.Stop();
                 Timer.Content = "Time's Up";
             }
         });
     DataContextChanged += (
         (o, e) => 
             {
                 viewModel = e.NewValue as Question;
                 A.Background = defaultAnswerButtonBrush;
                 B.Background = defaultAnswerButtonBrush;
                 C.Background = defaultAnswerButtonBrush;
                 D.Background = defaultAnswerButtonBrush;
             });
     questionEnterAnimation = (Storyboard)Resources["QuestionEnterAnimation"];
     questionLeaveAnimation = (Storyboard)Resources["QuestionLeaveAnimation"];
 }
Example #39
0
        private void PlayOrPause_Click(object sender, RoutedEventArgs e)
        {
            if (m_mediaIsPlaying)
            {
                MediaView.Pause();
                MusicElement.Pause();
                MediaView.SpeedRatio = m_speed;
                m_mediaIsPlaying     = false;
                PlayOrPause.ToolTip  = "Play";

                PlayOrPause.Background = new ImageBrush(PlayPic.Source);
                timer.Stop();
            }
            else
            {
                MediaView.Play();
                if (MediaView.Position < TimeSpan.FromSeconds(timprogress.Maximum))
                {
                    MusicElement.Play();
                }
                MediaView.SpeedRatio = m_speed;
                m_mediaIsPlaying     = true;
                PlayOrPause.ToolTip  = "Pause";

                PlayOrPause.Background = new ImageBrush(PausePic.Source);
                timer.Start();
                MediaView.SpeedRatio = m_speed;
            }
        }
 public override void Run(RoleBase caster, Space space, MagicArgs args)
 {
     args.Position = args.MagicPosition == MagicPositions.Position ? args.Position : args.Destination;
     double angle = GlobalMethod.GetAngle(GlobalMethod.GetRadian(args.Position, args.Destination)) + 180;
     int count = 0;
     int number = 4;
     double width = 110 * args.Scale;
     EventHandler handler = null;
     DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(100) };
     timer.Tick += handler = delegate {
         if (count == args.Number) {
             timer.Tick -= handler;
             timer.Stop();
         } else {
             createSubMagic(space, args, number, angle, width);
             count++;
             number += 2;
             width += 110 * args.Scale;
         }
     };
     timer.Start();
     //捕获圆范围内将要伤害的精灵表
     for (int i = space.AllRoles().Count - 1; i >= 0; i--) {
         RoleBase target = space.AllRoles()[i];
         if (caster.IsHostileTo(target) && target.InCircle(args.Position, args.Radius * args.Scale)) {
             caster.CastingToEffect(target, args);
         }
     }
 }
Example #41
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            PathGeometry oldPathGeometry = currentPathGeometry;
            currentPath.Data = currentPathGeometry = new PathGeometry();

            if (timer == null)
            {
                int index = 0;

                timer = new DispatcherTimer();
                timer.Interval = TimeSpan.FromMilliseconds(8);
                timer.Tick += delegate
                {
                    var nextPoint = GetNextPoint(oldPathGeometry, index);
                    if (nextPoint != null)
                    {
                        AddNewPosition(nextPoint.Item1, nextPoint.Item2);
                    }
                    else
                    {
                        timer.Stop();
                        timer = null;
                    }
                    index++;
                };

                timer.Start();
            }
        }
Example #42
0
 private void ShowToolTip()
 {
     if (tooltip == null)
     {
         tooltip = new ToolTip();
         tooltip.StaysOpen = true;
         timer = new DispatcherTimer();
         timer.Interval = TimeSpan.FromSeconds(1.5);
         tooltip.PlacementTarget = Element;
         tooltip.Placement = PlacementMode.Right;
         timer.Tick += delegate
         {
             tooltip.IsOpen = false;
             timer.Stop();
         };
     }
     var list = ValidationService.GetErrors(Element);
     if (list.Count == 0) return;
     tooltip.Content = list.OrderBy(e => e.Priority).First().ErrorContent;
     if (tooltip.Content != null)
     {
         tooltip.IsOpen = true;
         timer.Start();
     }
 }
 public void removeMicrophone()
 {
     DispatcherTimer dt = new DispatcherTimer();
     dt.Tick -= delegate { try { FrameworkDispatcher.Update(); } catch { } };
     dt.Stop();
     microphone.BufferReady -= new EventHandler<EventArgs>(microphone_BufferReady);
 }
Example #44
0
        public void temporizador9_tick(object sender, EventArgs e)
        {
            if ((segundoNueve != 00) || (horaNueve != 00) || (minutoNueve != 00))
            {
                numeroNueve = 1;
            }

            if (i != 00)
            {
                i--;
            }



            segundoNueve = i;

            if (segundoNueve == 00)
            {
                if (minutoNueve != 00)
                {
                    segundoNueve = 59;
                    minutoNueve--;
                    i = segundoNueve;
                }

                if ((horaNueve != 00) && (minutoNueve == 00))
                {
                    horaNueve--;
                    minutoNueve  = 59;
                    segundoNueve = 59;
                    i            = segundoNueve;
                }


                if ((segundoNueve == 00) && (horaNueve == 00) && (minutoNueve == 00))
                {
                    if (numeroNueve == 1)
                    {
                        temporizador9.Stop();

                        if (NumeroMedia == 0)
                        {
                            MediaElementAlarma.Play();
                        }
                        else
                        {
                            MediaElementAlarma.Stop();
                        }
                        temporizador10.Start();
                        System.Threading.Thread.Sleep(18000);
                    }
                }
                segundoNueve = 0;
            }



            Crono9.Text   = horaNueve + ":" + minutoNueve + ":" + segundoNueve;
            CronoUni.Text = horaNueve + ":" + minutoNueve + ":" + segundoNueve;
        }
Example #45
0
 private void Button_Click2(object sender, RoutedEventArgs e)
 {
     dispatcherTimer.Stop();
     timr.Content   = "0";
     btst.IsEnabled = false;
     btml.IsEnabled = true;
 }
Example #46
0
 private static void OnOpenChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     var fc = sender as FlipContent;
     if (fc == null || e.NewValue == e.OldValue) return;
     if ((bool)e.NewValue)
     {
         fc.OwnerVisibility = Visibility.Visible;
         if (!VisualStateManager.GoToState(fc, "Open", true))
         {
             fc.IsOpen = false;
         }
     }
     else
     {
         VisualStateManager.GoToState(fc, "Close", true);
         var timer = new DispatcherTimer(DispatcherPriority.Loaded, DispatcherHelper.UIDispatcher);
         timer.Interval = TimeSpan.FromSeconds(0.2);
         timer.Tick += (o, args) =>
         {
             timer.Stop();
             fc.OwnerVisibility = Visibility.Collapsed;
         };
         timer.Start();
     }
 }
Example #47
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            //Networking.DeleteFile("CurrentGame");
            //Networking.DeleteFile("Players");

            //Check if a game in progress has already been saved and continue it
            string data = Networking.LoadData("CurrentGame");
            if (data != "" && MessageBox.Show("Would you like to resume the game with id of " + data, "Continue Game", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                NavigationService.Navigate(new Uri("/GamePage.xaml?gameid=" + data, UriKind.Relative));
            else
            {
                _timer = new DispatcherTimer();
                _timer.Interval = TimeSpan.FromMilliseconds(250);
                _timer.Tick += (o, arg) => ScanPreviewBuffer();
                //The timer auto-starts so it needs to be stopped here
                _timer.Stop();
            }

            //Login to the server
            Networking.Login();

            _cam = new PhotoCamera();

            _cam.Initialized += cam_Initialized;

            video.Fill = _videoBrush;
            _videoBrush.SetSource(_cam);
            _videoBrush.RelativeTransform = new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
        }
Example #48
0
		public void ThreadPool ()
		{
			int tid = Thread.CurrentThread.ManagedThreadId;
			bool called = false;
			Enqueue (() => {
				DispatcherTimer dt = new DispatcherTimer ();
				dt.Tick += delegate (object sender, EventArgs e) {
					try {
						Assert.AreSame (dt, sender, "sender");
						Assert.IsNotNull (e, "e");
						Assert.AreEqual (Thread.CurrentThread.ManagedThreadId, tid, "ManagedThreadId");

						Assert.IsTrue (dt.IsEnabled, "IsEnabled");
						dt.Stop ();
						Assert.IsFalse (dt.IsEnabled, "Stop");
					}
					finally {
						called = true;
					}
				};
				dt.Start ();
			});
			EnqueueConditional (() => called);
			EnqueueTestComplete ();
		}
        void queryTaskPoint_ExecuteCompleted(object sender, QueryEventArgs args)
        {
            FeatureSet featureSet = args.FeatureSet;

            if (featureSet == null || featureSet.Features.Count < 1)
            {
                MessageBox.Show("No features returned from query");
                return;
            }

            GraphicsLayer graphicsLayer = MyMap.Layers["MyPointGraphicsLayer"] as GraphicsLayer;

            foreach (Graphic graphic in args.FeatureSet.Features)
            {
                graphic.Symbol = LayoutRoot.Resources["YellowMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                graphicsLayer.Graphics.Add(graphic);
            }

            if (featureSet.Features.Count == 1000)
            {
                DispatcherTimer UpdateTimer = new System.Windows.Threading.DispatcherTimer();
                UpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, 250);
                UpdateTimer.Tick    += (evtsender, a) =>
                {
                    LoadPointGraphics(graphicsLayer.Graphics.Count, graphicsLayer.Graphics.Count + 1000);
                    UpdateTimer.Stop();
                };
                UpdateTimer.Start();
            }
        }
Example #50
0
        private void btn_stop_Click(object sender, RoutedEventArgs e)
        {
            dispatcherTimer.Stop();

            btn_stop.IsEnabled    = false;
            btn_senario.IsEnabled = true;
        }
Example #51
0
        public static void ShowToast(Grid baseGrid, string message)
        {
            gridCount ++;

            StackPanel grid = new StackPanel();
            grid.Width = 200;
            grid.Height = 40;
            grid.Background = new System.Windows.Media.SolidColorBrush(Colors.Gray);
            grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            grid.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            grid.Margin = new Thickness(0, 0, 0, 30);


            TextBlock text = new TextBlock();
            text.Text = message;
            text.VerticalAlignment = VerticalAlignment.Center;
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.FontSize = 22;

            grid.Children.Add(text);

            baseGrid.Children.Add(grid);

            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 3);
            timer.Tick += (sender, args) =>
            {
                var anim = new DoubleAnimation(0, (Duration) TimeSpan.FromSeconds(1));
                grid.BeginAnimation(UIElement.OpacityProperty, anim);
                anim.Completed += (s, _) => baseGrid.Children.Remove(grid);
                timer.Stop();
            };
            timer.Start();
        }
        public MainWindow()
        {
            InitializeComponent();
            SettingsHelper.UpgradeSettings();
            SettingsHelper.IncrementLaunches();

            this.AnimateSize(AnimationMode.Hide);

            if (Settings.Default.HideDelay > 0)
            {
                _hideTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(Settings.Default.HideDelay)};
                _hideTimer.Tick += delegate
                {
                    _hideTimer.Stop();
                    HideNotification();
                };
            }

            _notificationQueue = new Queue<string>();
            _directoryWatcher =
                new DirectoryWatcher(delegate(string path) { Dispatcher.Invoke(() => { AddToFileQueue(path); }); });
            _directoryWatcher.Start();

            App.SuccessfullyLoaded = true;
        }
        private void Actualizar()
        {
            aTimer.Stop();
            //TEMPORIZADOR
            Temporizador          = new System.Windows.Threading.DispatcherTimer();
            Temporizador.Tick    += new EventHandler(dispatcherTimer_Tick);
            Temporizador.Interval = new TimeSpan(0, 0, 1);
            Tiempo = new TimeSpan();
            Temporizador.Start();
            LogManager.Instancia.AgregarMensaje("Comenzando importación de datos.");

            ImportadorDatos importa = new ImportadorDatos(this.registro);

            try
            {
                var hilo = new Thread(
                    new ThreadStart(() =>
                {
                    importa.Procesar();
                    LogManager.Instancia.AgregarMensaje("¡Importacion Finalizada!");
                    Temporizador.Stop();
                    aTimer.Start();
                    LogManager.Instancia.Resetear();
                })
                    );
                hilo.IsBackground = true;
                hilo.Start();
            }
            catch (Exception exc)
            {
                Mensajes.Error(exc);
            }
        }
        /// <summary>
        /// Executes the specified action asynchronously on the thread the Dispatcher is associated with, after the specified timeout.
        /// </summary>
        /// <param name="dispatcher">The dispatcher instance.</param>
        /// <param name="timeout">The <see cref="TimeSpan"/> representing the amount of time to delay before the action is invoked.</param>
        /// <param name="action">The <see cref="Action"/> to execute.</param>
        public static void BeginInvokeAfterTimeout(this Dispatcher dispatcher, TimeSpan timeout, Action action)
        {
            if (!dispatcher.CheckAccess())
            {
                dispatcher.BeginInvoke(() => dispatcher.BeginInvokeAfterTimeout(timeout, action));
            }
            else
            {
                var dispatcherTimer = new DispatcherTimer()
                {
                    Interval = timeout
                };

                dispatcherTimer.Tick += (s, e) =>
                {
                    dispatcherTimer.Stop();

                    dispatcherTimer = null;

                    action();
                };

                dispatcherTimer.Start();
            }
        }
Example #55
0
        public Flipper(TimeSpan flipIn, Action action)
        {
            this.flipIn = flipIn;
            this.action = action;

            timer = new DispatcherTimer(flipIn, DispatcherPriority.Background, Timer_Tick, Dispatcher.CurrentDispatcher);
            timer.Stop();
        }
Example #56
0
        public StahpViewModel()
        {
            TotalRestTime = TimeSpan.FromHours(2).ToString();
            restTime = TimeSpan.Parse(TotalRestTime);

            timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };

            InterceptMouse.Start();
            InterceptMouse.MouseAction += (s, e) =>
            {
                if (restTime == TimeSpan.Zero)
                {
                    OnNotify();
                    return;
                }

                if (startAction.HasValue && DateTime.Now.Subtract(startAction.Value) > restTime)
                {
                    restTime = TimeSpan.Zero;
                    startAction = null;
                    timer.Stop();
                    timer.IsEnabled = false;

                    OnPropertyChanged("RestTime");

                    return;
                }

                if (startAction == null)
                    startAction = DateTime.Now;

                timer.Stop();
                timer.Start();

                OnPropertyChanged("RestTime");
            };

            timer.Tick += (s, e) =>
            {
                if (startAction.HasValue)
                    restTime = restTime.Subtract(DateTime.Now.Subtract(startAction.Value));

                timer.Stop();
                startAction = null;
            };
        }
 public DoubleClickMonitor()
 {
     _timer = new DispatcherTimer
     {
         Interval = new TimeSpan(0, 0, 0, 0, 200)
     };
     _timer.Tick += (s, e) => _timer.Stop();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationSettingsService"/> class.
        /// </summary>
        public ApplicationSettingsService()
        {
            _saveTimer = new DispatcherTimer();
            _saveTimer.Interval = TimeSpan.FromSeconds(1);
            _saveTimer.Tick += (s, e) =>
                                   {
                                       Save();
                                       _saveTimer.Stop();
                                   };

            _applicationSettings.PropertyChanged += (s, e) =>
                                                        {
                                                            _saveTimer.Stop();
                                                            _saveTimer.Start();
                                                        };

            Load();
        }
Example #59
0
 public PosTextBox()
 {
     _timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) };
     _timer.Tick += (sender, args) =>
         {
             _timer.Stop();
             RaiseExecuteCommandEvent();
         };
 }
Example #60
0
        public MainWindow()
        {
            InitializeComponent();

            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 0, 0, 10);
            timer.Tick += timer_Tick;
            timer.Stop();
        }