Stop() public method

public Stop ( ) : void
return void
Esempio n. 1
1
        private static void Main()
        {
            DefaultMediaDevice = new MMDeviceEnumerator().GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
            DefaultMediaDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);

            TrayIcon = new NotifyIcon();
            TrayIcon.Icon = IconFromVolume();
            TrayIcon.Text = ToolTipFromVolume();
            TrayIcon.MouseClick += new MouseEventHandler(TrayIcon_MouseClick);
            TrayIcon.MouseDoubleClick += new MouseEventHandler(TrayIcon_MouseDoubleClick);
            TrayIcon.Visible = true;

            TrayIcon.ContextMenu = new ContextMenu();
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Open Volume Mixer", (o, e) => { Process.Start(SystemDir + "sndvol.exe"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("-"));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Playback devices", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,playback"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Recording devices", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,recording"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Sounds", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,sounds"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("-"));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Volume control options", (o, e) => { Process.Start(SystemDir + "sndvol.exe", "-p"); }));

            SingleClickWindow = new Timer();
            SingleClickWindow.Interval = SystemInformation.DoubleClickTime;
            SingleClickWindow.Tick += (o, e) =>
                {
                    SingleClickWindow.Stop();
                    StartVolControl();
                };

            Application.Run();
        }
Esempio n. 2
0
        public void Start()
        {
            if (Timer == 0)
            {
                Do();
                return;
            }
            this.lblTimer.Text = Timer--.ToString();
            if (Restart)
                lblTitle.Text = "Перезапуск компьютера через:";
            Timer t = new Timer();
            t.Interval = 1000;
            t.Tick += (o, e) => {
                if (Timer == 0)
                {
                    Do();
                    t.Stop();
                }
                else
                    this.lblTimer.Text = Timer--.ToString();
            };
            if (!CanCancel)
            {
                this.btCancel.Visible = false;
                this.Height = 70;
            }
            else
                this.btCancel.Click += (o, e) => {
                    t.Stop();
                    this.Close();
                };

            t.Start();
        }
Esempio n. 3
0
        public TableImportForm()
        {
            InitializeComponent();

            var timer = new Timer{Interval = 100, Enabled = true};
            timer.Tick += (o, e) =>
            {
                RichTextBoxWithHiddenCaret.HideCaret(richTextBox1.Handle); timer.Stop();
                RichTextBoxWithHiddenCaret.HideCaret(_tbExcelRange.Handle); timer.Stop();
            };
        }
Esempio n. 4
0
        public static void KillEmulator(bool forceBypass = false)
        {
            if (!ShouldKillswitchFire || (UICore.FirstConnect && !forceBypass) || (!S.GET <UI_CoreForm>().cbUseAutoKillSwitch.Checked&& !forceBypass))
            {
                return;
            }

            ShouldKillswitchFire = false;

            //Nuke netcore
            UI_VanguardImplementation.RestartServer();

            SyncObjectSingleton.FormExecute(() =>
            {
                //Stop the old timer and eat any exceptions
                try
                {
                    BoopMonitoringTimer?.Stop();
                    BoopMonitoringTimer?.Dispose();
                }
                catch
                {
                }

                killswitchSpamPreventTimer          = new Timer();
                killswitchSpamPreventTimer.Interval = 5000;
                killswitchSpamPreventTimer.Tick    += KillswitchSpamPreventTimer_Tick;
                killswitchSpamPreventTimer.Start();


                PlayCrashSound(true);

                if (CorruptCore.RtcCore.EmuDir == null)
                {
                    MessageBox.Show("Couldn't determine what emulator to start! Please start it manually.");
                    return;
                }
            });
            var info = new ProcessStartInfo();

            oldEmuDir             = CorruptCore.RtcCore.EmuDir;
            info.WorkingDirectory = oldEmuDir;
            info.FileName         = Path.Combine(oldEmuDir, "RESTARTDETACHEDRTC.bat");
            if (!File.Exists(info.FileName))
            {
                MessageBox.Show($"Couldn't find {info.FileName}! Killswitch will not work.");
                return;
            }

            Process.Start(info);
        }
Esempio n. 5
0
 private void LoadShader(string fileName)
 {
     try
     {
         var log = visualContext.AddUpdateFragmentShader(fileName);
         var correctedLineEndings = log.Replace("\n", Environment.NewLine).Trim();
         CallOnChange("Loading '+" + fileName + "' with success!" + Environment.NewLine + correctedLineEndings);
     }
     catch (ShaderLoadException e)
     {
         var correctedLineEndings = e.Message.Replace("\n", Environment.NewLine);
         CallOnChange("Error while compiling shader '" + fileName + "'" + Environment.NewLine + correctedLineEndings);
     }
     catch (FileNotFoundException e)
     {
         CallOnChange(e.Message);
     }
     catch (Exception e)
     {
         //try reload in 2 seconds, because sometimes file system is still busy
         Timer timer = new Timer(); //todo: is this executed on main thread?
         timer.Interval = 2000;
         timer.Tick += (a, b) =>
         {
             timer.Stop();
             timer.Dispose();
             LoadShader(shaderFileName); //if fileName is used here timer will always access fileName of first call and not a potential new one
         };
         timer.Start();
         CallOnChange("Error while accessing shaderfile '" + fileName + "'! Will retry shortly..." + Environment.NewLine + e.Message);
     }
 }
		public void Collapse(bool silent = false)
		{
			if (silent || AnimationDelay == 0)
			{
				Width = pnClosed.Width;
				pnOpened.Visible = false;
				pnClosed.Visible = true;
			}
			else
			{
				var timer = new Timer();
				timer.Interval = AnimationDelay > ContentSize ? AnimationDelay / ContentSize : 100;
				timer.Tick += (o, e) =>
				{
					if (Width > (pnClosed.Width + 50))
						Width -= 50;
					else
					{
						Width = pnClosed.Width;
						pnOpened.Visible = false;
						pnClosed.Visible = true;
						timer.Stop();
						timer.Dispose();
						timer = null;
					}
					Application.DoEvents();
				};
				timer.Start();
			}
			if (!silent)
				StateChanged?.Invoke(this, new StateChangedEventArgs(false));
		}
Esempio n. 7
0
 private void __reload_grid()
 {
     this.grid.CreateGraphics().Clear(Color.FromKnownColor(KnownColor.Control));
     Timer t = new Timer();
     t.Interval = 100;
     t.Tick += new EventHandler((_sender, _e) =>
     {
         t.Stop();
         try
         {
             g.BlockBorders(this.grid);
             g.Draw(this.grid.CreateGraphics());
         }
         catch
         {
             MessageBox.Show("Unable to load the saved configurations");
             newConfigurationToolStripMenuItem_Click(new object(), new EventArgs());
         }
         __last_valid_grid_block = g.abs2grid(g.AgentPoint);
         MarkStartPointGrid_Click(new object(), new EventArgs());
         __last_valid_grid_block = g.abs2grid(g.GoalPoint);
         MarkGoalPointGrid_Click(new object(), new EventArgs());
     });
     t.Start();
 }
Esempio n. 8
0
        public frmGame()
        {
            InitializeComponent();

            _isStartClicked = false;

            Remoting.GameSetting._frmMap = null;
            Remoting.GameSetting._isGameStarted = false;

            _isExit = false;

            // thread
            ThreadStart entryPoint = new ThreadStart(StartProcess);
            _processThread = new Thread(entryPoint);
            _processThread.Name = "Processing Thread";

            // timer start game
            _timerGame = new System.Windows.Forms.Timer();
            _timerGame.Interval = 500;
            _timerGame.Tick += new EventHandler(_timerGame_Tick);
            _timerGame.Stop();

            _timerBattle = new System.Windows.Forms.Timer();
            _timerBattle.Interval = 500;
            _timerBattle.Tick += new EventHandler(_timerBattle_Tick);
            _timerBattle.Stop();

            this.FormClosing += new FormClosingEventHandler(frmGame_FormClosing);
            this.FormClosed += new FormClosedEventHandler(frmGame_FormClosed);

            #if DEBUG
            _logWriter = new System.IO.StreamWriter("log.txt");
            #endif
        }
Esempio n. 9
0
 private void killWindow()
 {
     var T = new Timer();
     T.Interval = 8000;
     T.Tick += delegate { T.Stop(); Close(); };
     T.Start();
 }
Esempio n. 10
0
        private void _btnStart_Click(object sender, EventArgs e)
        {
            if (_objTimer == null)
            {
                UpdateFormView();
                string s = "Started Polling:\r\n";
                foreach (string d in Globals.Settings.PollDirs)
                {
                    s += "  " + d + " (" + System.IO.Path.GetFullPath(d) + ")\r\n";
                }
                Print(s);
                _objTimer          = new System.Windows.Forms.Timer();
                _objTimer.Interval = Globals.Settings.PollInterval;
                _objTimer.Start();
                _objTimer.Tick += (object x, EventArgs y) =>
                {
                    PollForChanges();
                };
                _btnStart.BackgroundImage = new Bitmap(DirPoll.Properties.Resources.appbar_control_pause);

                _btnSettings.Enabled   = false;
                _btnSettings.BackColor = Color.FromArgb(212, 212, 212);
                EnableMenuButton(_btnSettings, false);
            }
            else
            {
                _objTimer?.Stop();
                _objTimer = null;
                _btnStart.BackgroundImage = new Bitmap(DirPoll.Properties.Resources.appbar_control_play);
                EnableMenuButton(_btnSettings, true);
            }
        }
Esempio n. 11
0
 private void hideControl(Control ctrl, int time)
 {
     var T = new Timer();
     T.Interval = time * 1000;
     T.Tick += delegate { ctrl.Hide(); T.Stop(); };
     T.Start();
 }
Esempio n. 12
0
 public static void CallLater(TimeSpan delay, Action method)
 {
     var delayMilliseconds = (int) delay.TotalMilliseconds;
     if (delayMilliseconds < 0)
     {
         throw new ArgumentOutOfRangeException("delay", delay, Properties.Resources.ValueMustBePositive);
     }
     if (method == null)
     {
         throw new ArgumentNullException("method");
     }
     SafeThreadAsyncCall(delegate
     {
         var t = new Timer
         {
             Interval = Math.Max(1, delayMilliseconds)
         };
         t.Tick += delegate
         {
             t.Stop();
             t.Dispose();
             method();
         };
         t.Start();
     });
 }
Esempio n. 13
0
 void SplashShown(object sender, EventArgs ea)
 {
     Timer t = new Timer();
     t.Interval = 1000;
     t.Tick += (s, e) => {t.Stop(); this.Hide(); new MainForm().ShowDialog(); this.Close();};
     t.Start();
 }
		public PlayerListBox()
		{
			DrawMode = DrawMode.OwnerDrawVariable;
            this.BackColor = Color.DimGray;
			SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
		    realItems = new ObservableCollection<PlayerListItem>();
            realItems.CollectionChanged += RealItemsOnCollectionChanged;

		    timer = new Timer() { Interval = stagingMs, };
		    timer.Tick += (sender, args) =>
		        {
		            try {
		                BeginUpdate();
		                int currentScroll = base.TopIndex;

		                base.Items.Clear();
		                base.Items.AddRange(realItems.ToArray());

		                base.TopIndex = currentScroll;
		                EndUpdate();

		                timer.Stop();
		            } catch (Exception ex) {
		                Trace.TraceError("Error updating list: {0}",ex);
		            }
		        };
		    IntegralHeight = false; //so that the playerlistBox completely fill the edge (not snap to some item size)
		}
Esempio n. 15
0
    // private static SimpleCompileForm _simpleCompileForm;

    private static void Main(string[] args)
    {
        var worker = new BackgroundWorker();
        worker.DoWork += (sender, e) =>
        {
            try
            {
                _nativeWorkbenchForm = new NativeWorkbenchForm();
                _timer = new System.Windows.Forms.Timer();
                _timer.Stop();
                _timer.Interval = 100;
                _timer.Tick += _timer_Tick;
                _timer.Start();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            Application.EnableVisualStyles();
            Application.Run(_nativeWorkbenchForm);
        };
        worker.RunWorkerAsync();


        Thread.Sleep(-1);
    }
Esempio n. 16
0
        public Form_final(Form_close f, Form_operator form_operator_new)
        {
            user = new DataSet1TableAdapters.UserQuerry1TableAdapter();
            InitializeComponent();
            frm = f;
            form_operator = form_operator_new;
            form_operator.add_final(this);
            userInfo = new DataSet1TableAdapters.UserInfoTableAdapter();
            label_final.ForeColor = Color.Green;
            label_final.Font = new Font("label_final", 20);

            label_time.ForeColor = Color.Green;
            label_time.Font = new Font("label_time", 15);

            label_getmoney.ForeColor = Color.Green;
            label_getmoney.Font = new Font("label_getmoney", 15);

            label_balance.ForeColor = Color.Green;
            label_balance.Font = new Font("label_balance", 15);
            Opacity = 0;
            Timer timer = new Timer();
            timer.Tick += new EventHandler((sender, e) =>
            {
                if ((Opacity += 0.08d) >= 1) timer.Stop();
            });
            timer.Interval = 5;
            timer.Start();
        }
Esempio n. 17
0
        public dlDebugInfo()
        {
            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            if (Main.Data.Active != null && Main.Data.Active.Application == "eurotrucks2")
            {
                data = (Ets2DataMiner) Main.Data.Active;
            }
            Main.Data.AppActive += (sender, args) =>
            {
                if (Main.Data.Active != null && Main.Data.Active.Application == "eurotrucks2")
                {
                    data = (Ets2DataMiner) Main.Data.Active;
                }
            };

            var updateGfx = new Timer {Interval = 40};
            updateGfx.Tick += (sender, args) => this.Invalidate();
            updateGfx.Start();

            this.FormClosing += (sender, args) => updateGfx.Stop();
        }
Esempio n. 18
0
        public TimerLogic()
        {
            m_timer = new Timer();
            m_timer.Interval = m_tick;

            m_timer.Tick += delegate
            {
                m_log.Debug("Tick event happened");
                m_timer.Stop();
                // Commented until find bugs
            //				if(MousePositionHelper.MouseNotMoving == false)
            //				{
                    List<Task> tasksToShow = new DbHelper().LoadTasksForShowing();
                    m_log.DebugFormat("Loaded {0} tasks for showing", tasksToShow.Count);
                    foreach (Task task in tasksToShow)
                    {
                        new TaskShowController(task).PrepareWindow(); //Įkėliau viską į preparerį.
                        m_log.DebugFormat("Showed task with id {0}, name {1}, showTime {2}",
                                          task.Id, task.Text, DBTypesConverter.ToFullDateStringByCultureInfo(task.DateRemainder));
                    }
            //				}

                SetNewTimerInterval();
                m_timer.Start();
            };

            m_timer.Start();
        }
Esempio n. 19
0
        private void TimerTickLookForGrimDawn(object sender, EventArgs e)
        {
            System.Windows.Forms.Timer timer = sender as System.Windows.Forms.Timer;
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "DetectGrimDawnTimer";
            }

            string gdPath = _grimDawnDetector.GetGrimLocation();

            if (!string.IsNullOrEmpty(gdPath) && Directory.Exists(gdPath))
            {
                timer?.Stop();

                // Attempt to force a database update
                foreach (Control c in modsPanel.Controls)
                {
                    ModsDatabaseConfig config = c as ModsDatabaseConfig;
                    if (config != null)
                    {
                        config.ForceDatabaseUpdate(gdPath, string.Empty);
                        break;
                    }
                }

                Logger.InfoFormat("Found Grim Dawn at {0}", gdPath);
            }
        }
Esempio n. 20
0
       public Chart() : base ()
       {
         //SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //the PlotPane is already dbl buffered
         SetStyle(ControlStyles.UserPaint, true);
         SetStyle(ControlStyles.AllPaintingInWmPaint, true); //no ERASE BACKGROUND
         
         SetStyle(ControlStyles.UserMouse, true);

         
         UpdateStyles();
         
         m_Style = new Style(this, null);
         m_RulerStyle = new Style(this, null);
         m_PlotStyle = new Style(this, null);
         
         BuildDefaultStyle(m_Style);
         BuildDefaultRulerStyle(m_RulerStyle);
         BuildDefaultPlotStyle(m_PlotStyle);
         
         
         m_ControllerNotificationTimer = new Timer();
         m_ControllerNotificationTimer.Interval = REBUILD_TIMEOUT_MS;
         m_ControllerNotificationTimer.Enabled = false;
         m_ControllerNotificationTimer.Tick += new EventHandler((o, e) =>
                                                       {
                          //todo ETO NUJNO DLYA DRAG/DROP   if (m_RepositioningColumn!=null || m_ResizingColumn!=null ) return;//while grid is being manipulated dont flush timer just yet
                                                       
                                                        m_ControllerNotificationTimer.Stop(); 
                                                        notifyAndRebuildChart();
                                                       });
       }
Esempio n. 21
0
        public TreeListView()
        {
            this.DoubleBuffered = true;
            this.BackColor = SystemColors.Window;
            this.TabStop = true;

            m_tooltip = new ToolTip();
            m_tooltip.InitialDelay = 0;
            m_tooltip.UseAnimation = false;
            m_tooltip.UseFading = false;

            m_tooltipNode = null;
            m_tooltipTimer = new Timer();
            m_tooltipTimer.Stop();
            m_tooltipTimer.Interval = 500;
            m_tooltipTimer.Tick += new EventHandler(tooltipTick);

            m_rowPainter = new RowPainter();
            m_cellPainter = new CellPainter(this);

            m_nodes = new TreeListViewNodes(this);
            m_rowSetting = new TreeList.RowSetting(this);
            m_viewSetting = new TreeList.ViewSetting(this);
            m_columns = new TreeListColumnCollection(this);
            AddScrollBars();
        }
        private void startButton_Click(object sender, EventArgs e)
        {
            SynchronizationContext ctx = SynchronizationContext.Current;
            

            // Save the new gesture name to gestureInfoNew.data
            string name = gestureName.Text;
            Gestures.addNewGesture(name);
            Gestures.saveData(GestureStudio.GesturesDataPathNew);
            Gestures.loadData(GestureStudio.GesturesDataPathNew);

            // Count down 5.
            int countDown = 5;
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 1000;
            timer.Tick += (o, src) =>
                {
                    countDown--;
                    ctx.Post((state) =>
                        {
                            this.countDownLabel.Text = countDown.ToString();
                        }, null);

                    if (countDown == 0)
                    {
                        this.OnStart();
                        timer.Stop();
                        countDown = 5;
                        this.countDownLabel.Text = countDown.ToString();
                        this.gestureName.Text = "Name of the new gesture.";
                    }
                };

            timer.Start();
        }
Esempio n. 23
0
 void flash(PictureBox pictureBoxN, Timer t, Timer tp)
 {
     pictureBoxN.Visible = true;
     if (Convert.ToInt32(pictureBoxN.Tag) == 1)
     {
         pictureBoxN.Image = pictureBox2.Image;
     }
     else if (Convert.ToInt32(pictureBoxN.Tag) == 2)
     {
         pictureBoxN.Image = pictureBox3.Image;
     }
     else if (Convert.ToInt32(pictureBoxN.Tag) == 3)
     {
         pictureBoxN.Image = pictureBox4.Image;
     }
     else if (Convert.ToInt32(pictureBoxN.Tag) == 6)
     {
         pictureBoxN.Image = pictureBox3.Image;
     }
     else if (Convert.ToInt32(pictureBoxN.Tag) == 7)
     {
         pictureBoxN.Image = pictureBox2.Image;
         t.Start();
     }
     else if (Convert.ToInt32(pictureBoxN.Tag) >= 8)
     {
         pictureBoxN.Visible = false;
         pictureBoxN.Tag = 0;
         tp.Stop();
     }
     pictureBoxN.Tag = Convert.ToString(Convert.ToInt32(pictureBoxN.Tag) + 1);
 }
Esempio n. 24
0
        private void TimerTickLookForGrimDawn(object sender, EventArgs e)
        {
            System.Windows.Forms.Timer timer = sender as System.Windows.Forms.Timer;
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name             = "DetectGrimDawnTimer";
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
            }

            var    grimDawnDetector = _serviceProvider.Get <GrimDawnDetector>();
            string gdPath           = grimDawnDetector.GetGrimLocation();

            if (!string.IsNullOrEmpty(gdPath) && Directory.Exists(gdPath))
            {
                timer?.Stop();

                // Attempt to force a database update
                foreach (Control c in modsPanel.Controls)
                {
                    if (c is ModsDatabaseConfig config)
                    {
                        config.ForceDatabaseUpdate(gdPath, string.Empty);
                        break;
                    }
                }

                Logger.InfoFormat("Found Grim Dawn at {0}", gdPath);
            }
        }
Esempio n. 25
0
        private void FilterTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            // Switch focus from filters to mod list on enter, down, or pgdn
            switch (e.KeyCode)
            {
            case Keys.Enter:
                // Bypass the timer for immediate update
                e.Handled          = true;
                e.SuppressKeyPress = true;
                filterTimer?.Stop();
                TriggerSearch();
                break;

            case Keys.Up:
            case Keys.Down:
            case Keys.PageUp:
            case Keys.PageDown:
                if (SurrenderFocus != null)
                {
                    SurrenderFocus();
                }
                e.Handled = true;
                break;
            }
        }
Esempio n. 26
0
 public void Deactivate()
 {
     mavlinkCANRun = false;
     can?.Stop(chk_canonclose.Checked);
     can = null;
     timer?.Stop();
 }
Esempio n. 27
0
		public void startTweenEvent(object _objHolder,
		 int _destXpos,
		 int _destYpos,
		 string _animType,
		 int _timeInterval)
		{

			counter = 0;
			timeStart = counter;
			timeDest = _timeInterval;
			animType = _animType;

			this.components = new System.ComponentModel.Container();
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			this.timer1.Interval = 5;
			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

			objHolder = new System.Windows.Forms.Control();
			objHolder = (Control)_objHolder;
			objTimer = this.timer1;

			Arr_startPos[0] = objHolder.Location.X;
			Arr_startPos[1] = objHolder.Location.Y;
			Arr_destPos[0] = _destXpos;
			Arr_destPos[1] = _destYpos;

			objTimer.Stop();
			objTimer.Enabled = false;
			objTimer.Enabled = true;
		}
Esempio n. 28
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            Description fileHeader = new Description(txtProgramName.Text,txtProgramName.Text,txtAuthorName.Text,txtDescription.Text);
            fileHeader.GenerateOutput( this.getFillerCharacter() );

            Clipboard.SetText( fileHeader.Output );

            lblStatus.ForeColor = SystemColors.ControlText;

            Output popup = new Output();
            popup.Show();
            popup.txtOutput.Text = fileHeader.Output;

            Timer fadeTimer = new Timer();
            int i = 0;

            fadeTimer.Interval = 1500;
            fadeTimer.Tick += (sa, aeaa) =>
            {
                fadeTimer.Interval = 10;
                i++;

                lblStatus.ForeColor = Program.Lerp(SystemColors.ControlText, SystemColors.Control, (float)i / 100.0f);

                lblStatus.Invalidate();

                if (i == 100 )
                {
                    fadeTimer.Stop();
                }
            };

            fadeTimer.Start();
        }
Esempio n. 29
0
        public void MapCtrl_MethodsWithNoUserInteraction()
        {
            var focus = false;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var sut = new MainCtrl();
                var form = new MainForm();
                sut.InitMindMate(form);
                MainMenuCtrl mainMenuCtrl = new MainMenuCtrl(form.MainMenu, sut);
                form.MainMenuCtrl = mainMenuCtrl;
                form.Shown += (sender, args) =>
                {
                    sut.ReturnFocusToMapView();
                    sut.Bold(true);
                    focus = sut.CurrentMapCtrl.MapView.Tree.RootNode.Bold;
                    sut.ClearSelectionFormatting();
                    sut.Copy();
                    sut.Cut();
                    sut.SetBackColor(Color.White);
                    sut.SetFontFamily("Arial");
                    sut.SetFontSize(15);
                    sut.SetForeColor(Color.Blue);
                    sut.SetMapViewBackColor(Color.White);
                    sut.Strikethrough(true);
                    sut.Subscript();
                    sut.Superscript();
                    sut.Underline(true);
                };
                Timer timer = new Timer { Interval = 50 }; //timer is used because the Dirty property is updated in the next event of GUI thread.
                timer.Tick += delegate
                {
                    if (timer.Tag == null)
                    {
                        timer.Tag = "First Event Fired";
                    }
                    else if (timer.Tag.Equals("First Event Fired"))
                    {
                        timer.Tag = "Second Event Fired";
                    }
                    else
                    {
                        foreach(var f in sut.PersistenceManager)
                        {
                            f.IsDirty = false; //to avoid save warning dialog
                        }
                        form.Close();
                    }
                };

                timer.Start();
                form.ShowDialog();
                timer.Stop();
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();

            Assert.IsTrue(focus);
        }
Esempio n. 30
0
File: tween.cs Progetto: hebus/Tools
        ///<summary>
        ///this method kicks off the process
        ///</summary>
        public void startTweenEvent(object _objHolder, int _destXpos, int _destYpos, string _animType, int _timeInterval)
        {
            //inits the parameters for the tween process
                counter		= 0;
                timeStart	= counter;
                timeDest	= _timeInterval;
                animType	= _animType;

                this.components			= new System.ComponentModel.Container();
                this.timer1				= new System.Windows.Forms.Timer(this.components);
                this.timer1.Interval	= 1;
                this.timer1.Tick		+= new System.EventHandler(this.timer1_Tick);

                //Manages the object passed in to be tweened.
                //I create a new instance of a control and then force the object to convert to
                //a control. Doing it this way, the method accepts ANY control,
                //rather than hard-coding "Button" or some other specific control.
                objHolder	= new System.Windows.Forms.Control();
                objHolder	= (Control) _objHolder;
                objTimer	= this.timer1;

                //initializes the object's position in the pos Arrays
                Arr_startPos[0]	= objHolder.Location.X;
                Arr_startPos[1]	= objHolder.Location.Y;
                Arr_destPos[0]	= _destXpos;
                Arr_destPos[1]	= _destYpos;

                //resets the timer and finally starts it
                objTimer.Stop();
                objTimer.Enabled = false;
                objTimer.Enabled = true;
        }
Esempio n. 31
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            Timer t = new Timer();
            t.Interval = 500;
            t.Tick += delegate { 
                t.Stop();
                try
                {
                    if (acao1 != null)
                    {
                        acao1();
                        this.metroLabel6.Text = "Iniciando os serviços";
                        this.metroLabel6.Update();
                        acao2();
                    }
                    else
                    {
                        if (stopservice)
                            NFe.Components.ServiceProcess.StopService(servicename, 40000);
                        else
                            NFe.Components.ServiceProcess.RestartService(servicename, 40000);
                    }
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                catch (Exception ex)
                {
                    MetroFramework.MetroMessageBox.Show(null, ex.Message, "");
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            };
            t.Start();
        }
Esempio n. 32
0
 private void Reset(Timer MyTimer)
 {
     MyTimer.Stop();
     MyTimer.Interval = 1000;
     progressBar1.Maximum = Convert.ToInt32(textBox1.Text);
     progressBar1.Value = 0;
     MyTimer.Start();
 }
 public override bool ShowDataSourceSelector()
 {
     Timer t = new Timer();
     t.Interval = 5;
     t.Tick += (s, e) => { t.Stop(); t.Dispose(); t = null; ShowDataSeriesConfig(); };
     t.Start();
     return true;
 }
Esempio n. 34
0
    /// <summary>
    /// Stops the recording or the Pre-Start countdown.
    /// </summary>
    private void Stop()
    {
        try
        {
            FrameCount = 0;

            _capture.Stop();
            FrameRate.Stop();

            if (Stage != RecorderStages.Stopped && Stage != RecorderStages.PreStarting && Project.Any)
            {
                Close();
            }
            else if ((Stage == RecorderStages.PreStarting || Stage == RecorderStages.Snapping) && !Project.Any)
            {
                #region if Pre-Starting or in Snapmode and no Frames, Stops

                Stage = RecorderStages.Stopped;

                //Enables the controls that are disabled while recording;
                FpsNumericUpDown.IsEnabled = true;
                HeightIntegerBox.IsEnabled = true;
                WidthIntegerBox.IsEnabled  = true;

                IsRecording = false;
                Topmost     = true;

                Title = LocalizationHelper.Get("S.Board.Title") + " ■";

                AutoFitButtons();

                #endregion
            }
        }
        catch (NullReferenceException nll)
        {
            ErrorDialog.Ok(LocalizationHelper.Get("S.Board.Title"), "Error while stopping", nll.Message, nll);
            LogWriter.Log(nll, "NullPointer on the Stop function");
        }
        catch (Exception ex)
        {
            ErrorDialog.Ok(LocalizationHelper.Get("S.Board.Title"), "Error while stopping", ex.Message, ex);
            LogWriter.Log(ex, "Error on the Stop function");
        }
    }
Esempio n. 35
0
		public static void Delay(int delay, Action action) {
			Timer timer = new Timer();
			timer.Interval = delay;
			timer.Tick += (s, e) => {
				timer.Stop();
				action();
			};
			timer.Start();
		}
Esempio n. 36
0
 public Bomb(int x, int y)
 {
     base.X = x;
     base.Y = y;
     t = new Timer();
     t.Interval = Settings.BOMB_DURATION;
     t.Tick += (o, e) => { t.Stop(); t.Dispose(); Alive = false; };
     t.Start();
 }
Esempio n. 37
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     counter--;
     if (counter == 0)
     {
         timer1.Stop();
     }
     lblCountDown.Text = counter.ToString();
 }
Esempio n. 38
0
    private const int decayCooldownTime = 3000;         // The time between two messages to be allowed to be decayed

    public ErrorManager()
    {
        cursize = 0;
        errors  = new message[maxsize];
        updated = true;
        timer   = new System.Windows.Forms.Timer();
        timer.Stop();
        timer.Tick += Decay;
    }
Esempio n. 39
0
        void FadeOut()
        {
            if (InFadeOut)
                return;

            if (SystemInformation.TerminalServerSession)
            {
                if (Startup)
                    Application.ExitThread();

                StressForm = null;
                base.Close();
                return;
            }

            int duration = 500;//in milliseconds
            int steps = 50;
            Timer timer = new Timer();
            timer.Interval = duration / steps;
            timer.Enabled = true;

            int currentStep = steps;
            timer.Tick += (arg1, arg2) =>
            {
                Opacity = ((double)currentStep) / steps;
                currentStep--;

                if (currentStep <= 0)
                {
                    timer.Stop();
                    timer.Dispose();

                    if (Startup)
                        Application.ExitThread();

                    Visible = false;

                    if (StressForm != null && StressForm.Visible)
                        StressForm.Invoke(new Action(() =>
                        {
                            if (StressForm != null)
                            {
                                StressForm.TopMost = true;
                                Application.DoEvents();
                                StressForm.TopMost = false;
                            }
                        }));

                    StressForm = null;
                    base.Close();

                }
            };

            timer.Start();
        }
Esempio n. 40
0
        public void RefreshStop()
        {
            if (_refreshTimer == null)
            {
                return;
            }

            _refreshTimer.Tick -= RefreshTimerTick;
            _refreshTimer?.Stop();
            _refreshTimer?.Dispose();
        }
Esempio n. 41
0
        private void OnTimerTick(object sender, EventArgs e)
        {
            Timer timer = (Timer)sender;

            timer?.Stop();
            Application.DoEvents();
            _proxyEnabled    = ProxyEnabled();
            _proxyServer     = ProxyServer();
            _notifyIcon.Icon = _proxyEnabled ? _onIcon : _offIcon;
            _notifyIcon.Text = (_proxyEnabled ? "Proxy is ON" : "Proxy is OFF") + $"\r\nProxy: { _proxyServer}";
            timer?.Start();
        }
Esempio n. 42
0
        // This api receives javascript errors with stack dumps that have not been converted to source.
        // Javascript code will then attempt to convert them and report using HandleJavascriptError.
        // In case that fails, after 200ms we will make the report using the unconverted stack.
        public void HandlePreliminaryJavascriptError(ApiRequest request)
        {
            lock (request)
            {
                lock (lockJsError)
                {
                    if (preliminaryJavascriptError != null)
                    {
                        // If we get more than one of these without a real report, the first is most likely to be useful, I think.
                        // This also avoids ever having more than one timer running.
                        request.PostSucceeded();
                        return;
                    }
                    preliminaryJavascriptError = request.RequiredPostJson();
                }

                var form = Application.OpenForms.Cast <Form>().Last();
                // If we don't have an active Bloom form, I think we can afford to discard this report.
                if (form != null)
                {
                    form.BeginInvoke((Action)(() =>
                    {
                        // Arrange to report the error if we don't get a better report of it in 200ms.
                        jsErrorTimer?.Stop();                         // probably redundant
                        jsErrorTimer?.Dispose();                      // left over from previous report that had follow-up?
                        jsErrorTimer = new Timer {
                            Interval = 200
                        };
                        jsErrorTimer.Tick += (sender, args) =>
                        {
                            jsErrorTimer.Stop();                             // probably redundant?
                            // not well documented but found some evidence this is OK inside event handler.
                            jsErrorTimer.Dispose();
                            jsErrorTimer = null;

                            dynamic temp;
                            lock (lockJsError)
                            {
                                temp = preliminaryJavascriptError;
                                preliminaryJavascriptError = null;
                            }

                            if (temp != null)
                            {
                                ReportJavascriptError(temp);
                            }
                        };
                        jsErrorTimer.Start();
                    }));
                }
                request.PostSucceeded();
            }
        }
Esempio n. 43
0
 private void listViewAaxFiles_SizeChanged(object sender, EventArgs e)
 {
     if (_fileItems.Count > 0)
     {
         return;
     }
     _resizeTimer?.Stop();
     if (_resizeFlag)
     {
         return;
     }
     _resizeTimer?.Start();
 }
Esempio n. 44
0
    private void mTimer_Tick(object sender, EventArgs e)
    {
        mTimer.Stop();

        try {
            DoCapture();
        }
        catch (Exception ex) {
            Console.WriteLine(ex.Message);
        }

        mWb.Dispose();
        System.Windows.Forms.Application.Exit();
    }
Esempio n. 45
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (toolStripComboBox1.SelectedItem != null)
            {
                if (_devices[toolStripComboBox1.SelectedItem.ToString()] == null)
                {
                    Application.Exit();
                    return;
                }

                if (_devices[toolStripComboBox1.SelectedItem.ToString()] != null && _devices[toolStripComboBox1.SelectedItem.ToString()].IsRunning())
                {
                    _devices[toolStripComboBox1.SelectedItem.ToString()].Stop();
                    _chartRefresh?.Stop();
                    _gaussTimer?.Stop();
                    Application.Exit();
                    return;
                }
            }

            Application.Exit();
            return;
        }
Esempio n. 46
0
        private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //Save Settings
            UserSettings.All.RecorderTop  = Top;
            UserSettings.All.RecorderLeft = Left;
            UserSettings.Save();

            #region Remove Hooks

            try
            {
                _actHook.OnMouseActivity -= MouseHookTarget;
                _actHook.KeyDown         -= KeyHookTarget;
                _actHook.Stop(); //Stop the user activity watcher.
            }
            catch (Exception) { }

            #endregion

            SystemEvents.PowerModeChanged       -= System_PowerModeChanged;
            SystemEvents.DisplaySettingsChanged -= SystemEvents_DisplaySettingsChanged;

            #region Stops the timers

            if (Stage != (int)Stage.Stopped)
            {
                _preStartTimer.Stop();
                _preStartTimer.Dispose();

                _captureTimer.Stop();
                _captureTimer.Dispose();
            }

            //Garbage Collector Timer.
            _garbageTimer?.Stop();
            _followTimer?.Stop();

            #endregion

            //Clean all capture resources.
            if (_capture != null)
            {
                await _capture.Dispose();
            }

            GC.Collect();
        }
Esempio n. 47
0
 /// <summary>
 /// Resets the progress meter to the 0 value. This sets the status message to "Ready.".
 /// </summary>
 public void Reset()
 {
     _prog    = 0;
     _oldProg = 0;
     Key      = "Ready.";
     _timer?.Stop();
     if (Silent)
     {
         return;
     }
     if (ProgressHandler == null)
     {
         return;
     }
     ProgressHandler.Reset();
     Application.DoEvents(); // Allow the form to update a status bar if necessary.
 }
Esempio n. 48
0
    /// <summary>
    /// 1 フレームの時間とフレーム数を指定してアニメーション機能を提供します。
    /// </summary>
    /// <param name="interval">1 フレームの時間をミリ秒単位で指定します。</param>
    /// <param name="frequency">
    /// frequency はコールバックが呼ばれる回数から 1 を引いたものです。例えば frequency が 10 の時には 11 回呼ばれます。
    /// </param>
    /// <param name="callback">
    /// bool callback(int frame, int frequency) の形でコールバックを指定します。
    /// frame は 0 から frequency の値まで 1 ずつ増加します。
    /// frequency は引数と同じものです。
    /// </param>
    public static void Animate(int interval, int frequency, Func <int, int, bool> callback)
    {
        var timer = new System.Windows.Forms.Timer();

        timer.Interval = interval;
        int frame = 0;

        timer.Tick += (sender, e) =>
        {
            if (callback(frame, frequency) == false || frame >= frequency)
            {
                timer.Stop();
            }
            frame++;
        };
        timer.Start();
    }
Esempio n. 49
0
 public void close()
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke((MethodInvoker) delegate
         {
             close();
         });
     }
     else
     {
         tm?.Stop();
         this.Visible = false;
         video?.Stop();
         video?.Dispose();
         this.enabled = false;
     }
 }
Esempio n. 50
0
 private void rdbManual_CheckedChanged(object sender, EventArgs e)
 {
     btnAtualizar.Enabled = true;
     timer.Stop();
 }
Esempio n. 51
0
 public void Deactivate()
 {
     can?.Stop(chk_canonclose.Checked);
     can = null;
     timer?.Stop();
 }
Esempio n. 52
0
 public void StopBlinking()
 {
     _timer?.Stop();
     Update(timerCaused: false);
 }
Esempio n. 53
0
        private void UpdateFileName()
        {
            fUpdateFileNameTimer.Stop();

            if (IsSaved || fScribble.Document.IsAnalysisRunning)
            {
                return;
            }

            Stationery stationery = fScribble.Document.Pages[0].Stationery;

            if (stationery.TitleRectangleStyle != StationeryRectangleStyle.None &&
                !stationery.TitleRectangle.IsEmpty)
            {
                StringBuilder newName        = new StringBuilder();
                ArrayList     elements       = new ArrayList();
                Rectangle     titleRectangle = stationery.TitleRectangle;
                titleRectangle.Inflate(-200, -200);
                elements.AddRange(fScribble.Document.Pages[0].DrawElementsInRectangle(titleRectangle, 0.00000000000000000001f));
                elements.AddRange(fScribble.Document.Pages[0].InkElementsInRectangle(titleRectangle, 90.0f));
                elements.Sort();
                foreach (Element element in elements)
                {
                    if (element is TextElement)
                    {
                        string plainText = (element as TextElement).GetPlainText();
                        int    i         = plainText.IndexOf("\r\n");
                        if (i > 0)
                        {
                            plainText = plainText.Substring(0, i);
                        }
                        newName.Append(plainText);
                        newName.Append(" ");
                    }
                    else if (element is InkParagraphElement)
                    {
                        foreach (InkLineElement line in element.Elements)
                        {
                            foreach (InkWordElement word in line.Elements)
                            {
                                newName.Append(word.Text);
                                newName.Append(" ");
                            }
                            newName.Append(" ");
                        }
                    }
                    else if (element is InkLineElement)
                    {
                        foreach (InkWordElement word in element.Elements)
                        {
                            newName.Append(word.Text);
                            newName.Append(" ");
                        }
                        break;
                    }
                    else if (element is InkWordElement)
                    {
                        newName.Append((element as InkWordElement).Text);
                        newName.Append(" ");
                    }
                }
                if (newName.Length > 0)
                {
                    fFileName = newName.ToString().Trim();
                    foreach (char c in System.IO.Path.InvalidPathChars)
                    {
                        fFileName = fFileName.Replace(c, '_');
                    }
                    fFileName = fFileName.Replace('.', '_');
                    fFileName = fFileName.Replace(Path.DirectorySeparatorChar, '_');
                    fFileName = fFileName.Replace(Path.VolumeSeparatorChar, '-');
                    fFileName = fFileName.Replace(Path.AltDirectorySeparatorChar, '_');
                    if (fFileName.Length > 40)
                    {
                        fFileName = fFileName.Substring(0, 40);
                    }
                    Text = fFileName + " - " + TITLE;
                }
            }
        }
Esempio n. 54
0
 private void TimerEventProcessor(object myObject, EventArgs myEventArgs)
 {
     saveScreenshotTimer.Stop();
     SaveScreenshot();
     saveScreenshotTimer.Enabled = true;
 }
Esempio n. 55
0
 private void btnEndLoop_Click(object sender, EventArgs e)
 {
     timer?.Stop();
 }
Esempio n. 56
0
        /// <summary>
        /// Processes the message.
        /// </summary>
        /// <param name="messageType">Type of the message.</param>
        /// <param name="messageRecord">The message record.</param>
        /// <param name="buttons">The buttons.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="defaultButton">The default button.</param>
        /// <returns></returns>
        public override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton)
        {
            switch (messageType)
            {
            case InstallMessage.InstallStart:
            case InstallMessage.InstallEnd:
            {
                waitPrompt.Visible = false;
                showWaitPromptTimer.Stop();
            }
            break;

            case InstallMessage.ActionStart:
            {
                try
                {
                    //messageRecord[0] - is reserved for FormatString value

                    string message = null;

                    bool simple = true;
                    if (simple)
                    {
                        /*
                         * messageRecord[2] unconditionally contains the string to display
                         *
                         * Examples:
                         *
                         * messageRecord[0]    "Action 23:14:50: [1]. [2]"
                         * messageRecord[1]    "InstallFiles"
                         * messageRecord[2]    "Copying new files"
                         * messageRecord[3]    "File: [1],  Directory: [9],  Size: [6]"
                         *
                         * messageRecord[0]    "Action 23:15:21: [1]. [2]"
                         * messageRecord[1]    "RegisterUser"
                         * messageRecord[2]    "Registering user"
                         * messageRecord[3]    "[1]"
                         *
                         */
                        if (messageRecord.FieldCount >= 3)
                        {
                            message = messageRecord[2].ToString();
                        }
                    }
                    else
                    {
                        message = messageRecord.FormatString;
                        if (message.IsNotEmpty())
                        {
                            for (int i = 1; i < messageRecord.FieldCount; i++)
                            {
                                message = message.Replace("[" + i + "]", messageRecord[i].ToString());
                            }
                        }
                        else
                        {
                            message = messageRecord[messageRecord.FieldCount - 1].ToString();
                        }
                    }

                    if (message.IsNotEmpty())
                    {
                        currentAction.Text = currentActionLabel.Text + " " + message;
                    }
                }
                catch { }
            }
            break;
            }
            return(MessageResult.OK);
        }
Esempio n. 57
0
        void sourceVideoTextBox_TextChanged(object sender, EventArgs e)
        {
            Settings.Default.lastVideoFile = sourceVideoTextBox.Text;
            Settings.Default.Save();

            if (lookForAudioBitRates != null)
            {
                lookForAudioBitRates.Stop();
                lookForAudioBitRates.Dispose();
                lookForAudioBitRates = null;
            }

            OnGameDataFileChanged();

            SetTanscodeMessage("", "", "");

            if (sourceVideoTextBox.Text.Trim() == "")
            {
                return;
            }

            if (!File.Exists(sourceVideoTextBox.Text))
            {
                SetTanscodeMessage(sourceVideoFileErrorMessage: "*File does not exist");
                return;
            }

            try
            {
                var data     = OverlayData.FromFile(sourceVideoTextBox.Text);
                var fileName = data.VideoFiles.Last().FileName;

                if (!File.Exists(fileName))
                {
                    SetTanscodeMessage(sourceVideoFileErrorMessage: "*Captured video does not exist: " + fileName);
                    return;
                }

                var currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (data.CapturedVersion != null && data.CapturedVersion != currentVersion)
                {
                    SetTanscodeMessage(warningDetails: "*Video was captured with version {0}.\nIt is recommended to transcode and capture using the same version.\nTranscoding may not work.".F(data.CapturedVersion));
                }

                var details = VideoAttributes.TestFor(data);

                SetTanscodeMessage(formatDetails: "Frame Rate: {0}, Frame Size: {1}x{2}, Video: {3} @ {4}Mbs, Audio: {5}, {6}Khz @ {7}Kbs, ".F
                                       (details.FrameRate,
                                       details.FrameSize.Width,
                                       details.FrameSize.Height,
                                       details.VideoEncoding,
                                       details.BitRate == 0 ? "-- " : details.BitRate.ToString(),
                                       details.AudioEncoding,
                                       details.AudioSamplesPerSecond / 1000,
                                       details.AudioAverageBytesPerSecond / 1000),
                                   sourceVideoFileErrorMessage: details.ErrorMessage);
            }
            catch (Exception ex)
            {
                SetTanscodeMessage(sourceVideoFileErrorMessage: "*Error reading the video file. {0}".F(ex.Message));

                lookForAudioBitRates          = new System.Windows.Forms.Timer();
                lookForAudioBitRates.Tick    += sourceVideoTextBox_TextChanged;
                lookForAudioBitRates.Interval = 5000;
                lookForAudioBitRates.Start();
            }
        }
Esempio n. 58
0
    private void RecordPauseButton_Click(object sender, RoutedEventArgs e)
    {
        WebcamControl.Capture.PrepareCapture();

        if (Stage == RecorderStages.Stopped)
        {
            #region To Record

            _timer = new Timer {
                Interval = 1000 / FpsNumericUpDown.Value
            };

            Project = new ProjectInfo().CreateProjectFolder(ProjectByType.WebcamRecorder);

            RefreshButton.IsEnabled        = false;
            VideoDevicesComboBox.IsEnabled = false;
            FpsNumericUpDown.IsEnabled     = false;
            Topmost = true;

            //WebcamControl.Capture.GetFrame();

            #region Start - Normal or Snap

            if (UserSettings.All.CaptureFrequency != CaptureFrequencies.Manual)
            {
                #region Normal Recording

                _timer.Tick += Normal_Elapsed;
                Normal_Elapsed(null, null);
                _timer.Start();

                Stage = RecorderStages.Recording;

                #endregion
            }
            else
            {
                #region SnapShot Recording

                Stage = RecorderStages.Snapping;
                Title = "ScreenToGif - " + LocalizationHelper.Get("S.Recorder.Snapshot");

                Normal_Elapsed(null, null);

                #endregion
            }

            #endregion

            #endregion
        }
        else if (Stage == RecorderStages.Recording)
        {
            #region To Pause

            Stage = RecorderStages.Paused;
            Title = LocalizationHelper.Get("S.Recorder.Paused");

            DiscardButton.BeginStoryboard(FindResource("ShowDiscardStoryboard") as Storyboard, HandoffBehavior.Compose);

            _timer.Stop();

            #endregion
        }
        else if (Stage == RecorderStages.Paused)
        {
            #region To Record Again

            Stage = RecorderStages.Recording;
            Title = "ScreenToGif";

            _timer.Start();

            #endregion
        }
        else if (Stage == RecorderStages.Snapping)
        {
            #region Take Screenshot

            Normal_Elapsed(null, null);

            #endregion
        }
    }
Esempio n. 59
0
 void HandleFilterKeyup(object sender, EventArgs e)
 {
     delayedFilterTextChangedTimer.Stop();
     delayedFilterTextChangedTimer.Start();
 }
Esempio n. 60
0
        /*
         * Action: Start the timers to display the messages
         *
         */
        void timerFunc(string type_of_timer)
        {
            int msg_index = 0;

            //
            // Below code is only for debug purposes:
            //
            // int display_times = 0;
            //

            timer1.Tick += new System.EventHandler((s1, e1) =>
            {
                try
                {
                    if ((pause_msgs == 0) && (messages.Length > 0) && (config_correct == 0))
                    {
                        Point location  = new Point(xpos.Next(1, (int)(screen_width * (3.0 / 4.0))), ypos.Next(1, screen_height));
                        label1.Location = location;

                        msg_index = msg_index + 1;

                        if (msg_index >= messages.Length)
                        {
                            msg_index = 0;
                        }

                        label1.Text = messages[msg_index];

                        //
                        // Below code is just for debug purposes.
                        // display_times++;
                        // if (display_times > 10000)
                        // {
                        //     display_times = 0;
                        // }
                        //
                        // if (debug == 1)
                        // {
                        //     label2.Text = display_times.ToString() + ", " + location.ToString() + "\n";
                        //     label2.Text += messages[msg_index] + "\n";
                        //     label2.Text += label1.Visible.ToString();
                        // }
                        //

                        label1.Visible = true;
                        label1.Refresh();

                        timer2.Tick += new System.EventHandler((s2, e2) =>
                        {
                            label1.Visible = false;
                            label1.Refresh();
                            timer2.Stop();
                        });
                        timer2.Start();
                    }
                    else
                    {
                        // timer1.Stop();
                    }
                }
                catch
                {
                }

                if (type_of_timer == "faster")
                {
                    timer_sleep = timer_sleep - timer_change_rate;
                    if (timer_sleep <= 0)
                    {
                        timer_sleep = init_timer_sleep;
                    }
                    timer1.Interval = timer_sleep;
                }
                else if (type_of_timer == "slowing")
                {
                    timer_sleep = timer_sleep + timer_change_rate;
                    if (timer_sleep >= 10000)
                    {
                        timer_sleep = init_timer_sleep;
                    }
                    timer1.Interval = timer_sleep;
                }
            });
            timer1.Start();
        }