コード例 #1
0
        private void GvSelectionChanged(object sender, EventArgs e)
        {
            var id = GetSlectedWorkflowId();
            var wf = GetWorkflow(id);

            if (_timer != null && _timer.Started)
            {
                _timer.Stop();
                _timer.Dispose();
            }

            if (wf != null && wf.IsEnabled)
            {
                _timer = new UITimer {
                    Interval = 0.5
                };
                _timer.Elapsed += (s, ea) => UpdateButtons(id, false);
                _timer.Start();

                UpdateButtons(id, true);
            }
            else
            {
                UpdateButtons(id, true);
            }
        }
コード例 #2
0
ファイル: WebView2Handler.cs プロジェクト: nzysoft/Eto
        protected override void OnUnLoad(EventArgs e)
        {
            base.OnUnLoad(e);

            timer?.Stop();
            timer = null;
        }
コード例 #3
0
        //Stopwatch sw = new Stopwatch();

        void Timer_Elapsed(object sender, EventArgs e)
        {
            timer.Stop();
            //sw.Start();
            var code = getCode();

            if (!string.IsNullOrEmpty(code))
            {
                designPanel?.Update(code);
            }
        }
コード例 #4
0
        void Timer_Elapsed(object sender, EventArgs e)
        {
            timer.Stop();
            processingCount = 1;             // only check for additional changes AFTER this point to restart the timer
            var code = getCode();

            if (!string.IsNullOrEmpty(code))
            {
                designPanel?.Update(code);
            }
        }
コード例 #5
0
        internal void TriggerIsActiveChanged(bool gotFocus)
        {
            // don't do anything until we really need to know.
            if (_IsActiveChanged == null)
            {
                return;
            }

            _didGetFocus |= gotFocus;

            if (_timer == null)
            {
                // use a timer as the active window does not get updated immediately or when showing the task switcher
                // not sure if there's a platform-specific way to do this that would work better...
                _timer          = new UITimer();
                _timer.Elapsed += (sender, e) =>
                {
                    var windows = Gtk.Window.ListToplevels();
                    // first, check if any window has focus.. then yes, we are the active application.
                    bool isActive = _didGetFocus | windows.Any(r => r.HasFocus | r.HasToplevelFocus);
                    if (!isActive)
                    {
                        // no windows have focus, so check the active window
                        isActive = AnyIsActiveWindow(windows);

                        // we are "active" but not really as there's no top level window with focus.
                        // so keep checking until one of the top levels actually has focus or the active window changes.
                        if (isActive || _didGetFocus)
                        {
                            _timer.Interval = 0.5;
                        }
                        else
                        {
                            _timer.Stop();
                        }
                    }
                    else
                    {
                        _timer.Stop();
                    }

                    _didGetFocus = false;

                    if (_isActive != isActive)
                    {
                        _isActive = isActive;
                        OnIsActiveChanged(EventArgs.Empty);
                    }
                };
            }
            _timer.Interval = 0.2;
            _timer.Start();
        }
コード例 #6
0
        Control StartStopButton(ProgressBar bar)
        {
            var control = new Button {
                Text = "Start Timer"
            };

            control.Click += delegate {
                if (timer == null)
                {
                    timer = new UITimer {
                        Interval = 0.5
                    };
                    timer.Elapsed += delegate {
                        if (bar.Value < bar.MaxValue)
                        {
                            bar.Value += 50;
                        }
                        else
                        {
                            bar.Value = bar.MinValue;
                        }
                    };
                    timer.Start();
                    control.Text = "Stop Timer";
                }
                else
                {
                    timer.Stop();
                    timer.Dispose();
                    timer        = null;
                    control.Text = "Start Timer";
                }
            };
            return(control);
        }
コード例 #7
0
ファイル: WindowTests.cs プロジェクト: philstopford/Eto
 public void WindowFromPointShouldReturnWindowUnderPoint()
 {
     ManualForm("Move your mouse, it should show the title of the window under the mouse pointer",
                form =>
     {
         var content = new Panel {
             MinimumSize = new Size(100, 100)
         };
         var timer = new UITimer {
             Interval = 0.5
         };
         timer.Elapsed += (sender, e) =>
         {
             var window      = Window.FromPoint(Mouse.Position);
             content.Content = $"Window: {window?.Title}";
         };
         timer.Start();
         form.Closed += (sender, e) =>
         {
             timer.Stop();
         };
         form.Title = "Test Form";
         return(content);
     }
                );
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: jwk000/MineSweeper
        void GameOver(bool isWin)
        {
            //重绘整个窗口
            this.Invalidate(new Rectangle(0, 0, this.Size.Width, this.Size.Height));

            UITimer.Stop();
            DialogResult ret;

            if (isWin)
            {
                ret = MessageBox.Show("你找到了所有雷,点击重试重玩", "You Are Winner", MessageBoxButtons.RetryCancel);
            }
            else
            {
                ret = MessageBox.Show("你踩到了雷,重来一次吗?", "Game Over", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }

            if (ret == DialogResult.Retry)
            {
                RestartGame();
            }
            else
            {
                Close();
            }
        }
コード例 #9
0
        protected override void OnTargetMouseLeftButtonUp()
        {
            RequestRender();

            _timer?.Stop();
            _timer = null;
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: jwk000/Maze
        //每次进行计算的步骤
        void A1_TickOnce(A1Thread th)
        {
            if (th.CurrentStep1 == A1Step.GetNotVisitedRoom)
            {
                if (NotVisitedRooms.Count == 0)
                {
                    //结束生成
                    UITimer.Stop();
                    Restart();
                    return;
                }
                int idx = RandGen.Next(0, NotVisitedRooms.Count);
                idx = 0;
                th.CurrentStepRoom          = NotVisitedRooms[idx];
                th.CurrentStepRoom._visited = true;
                NotVisitedRooms.Remove(th.CurrentStepRoom);
                th.LastStepRooms.Clear();
                th.LastStepRooms.Add(th.CurrentStepRoom);
                th.CurrentStep1 = A1Step.VisitNextRoom;
            }

            if (!A1_VisitNextRoom(th))
            {
                th.CurrentStep1 = A1Step.GetNotVisitedRoom;
            }
        }
コード例 #11
0
ファイル: Form1.cs プロジェクト: jwk000/Maze
        void A3_Tick()
        {
            if (NotVisitedRooms.Count == 0)
            {
                UITimer.Stop();
                Restart();
                return;
            }

            List <Room> nextReactor = new List <Room>();

            //随机门
            while (ReactorSrc.Count > 0)
            {
                int  idx  = RandGen.Next(0, ReactorSrc.Count);
                Room room = ReactorSrc[idx];
                ReactorSrc.RemoveAt(idx);
                for (int i = 0; i < 2; i++)
                {
                    int  doorid   = 0;
                    Room nextRoom = A3GetRoomByRandDoor(room, out doorid);
                    if (nextRoom == null)
                    {
                        continue;
                    }
                    OpenRoomDoor(room, doorid);
                    nextRoom._visited = true;
                    nextReactor.Add(nextRoom);
                    NotVisitedRooms.Remove(nextRoom);
                }
            }
            ReactorSrc = nextReactor;
        }
        /// <summary>
        /// 依据相机配置链接相机
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public bool Connectted(CameraConfig config, Module module, Camera cam)
        {
            try
            {
                this.CameraConfig = config;
                if (camera != null)
                {
                    UITimer.Stop();
                    camera.Acquisition.Unconfigure();
                    camera.Dispose();
                }

                camera        = new ImaqdxSession(config.Name);
                this.Exposure = config.DefaultExp;
                this.Gain     = config.DefaultGain;
                this.Timeout  = 1000;

                for (int i = 0; i < config.Mat2D.Count; ++i)
                {
                    config.Mat2D[i].LoadCalib(PathDefine.sPathCamera + $"{module}-{cam}-{i}.bmp");
                }

                bOpen = true;
            }
            catch (Exception ex)
            {
                bOpen = false;
                throw new Exception($"相机[{config.Name}]初始化失败!!! 原因[{ex.StackTrace}]");
            }

            return(bOpen);
        }
コード例 #13
0
        public DirectDrawingSection()
        {
            timer = new UITimer {
                Interval = 0.01
            };
            drawable = new Drawable();
            drawable.BackgroundColor = Colors.Black;
            timer.Elapsed           += (sender, e) => {
                if (this.ParentWindow == null)
                {
                    timer.Stop();
                    return;
                }

                lock (boxes) {
                    if (boxes.Count == 0)
                    {
                        InitializeBoxes();
                    }

                    var bounds = drawable.Size;
                    try {
                        using (var graphics = drawable.CreateGraphics()) {
                            graphics.Antialias = false;
                            foreach (var box in boxes)
                            {
                                box.Erase(graphics);
                                box.Move(bounds);
                                box.Draw(graphics);
                            }
                        }
                    } catch (NotSupportedException) {
                        timer.Stop();
                        this.BackgroundColor = Colors.Red;
                        this.Content         = new Label {
                            Text = "This platform does not support direct drawing", TextColor = Colors.White, VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center
                        };
                    }
                }
            };

            var layout = new DynamicLayout(new Padding(10));

            layout.AddSeparateRow(null, UseTexturesAndGradients(), null);
            layout.Add(drawable);
            this.Content = layout;
        }
コード例 #14
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (timer != null)
     {
         timer.Stop();
     }
 }
コード例 #15
0
ファイル: ThemedSpinnerHandler.cs プロジェクト: zzlvff/Eto
 /// <summary>
 /// Called when the control is unloaded, which is when it is not currently on a displayed window
 /// </summary>
 /// <param name="e">Event arguments</param>
 public override void OnUnLoad(EventArgs e)
 {
     base.OnUnLoad(e);
     if (enabled)
     {
         timer.Stop();
     }
 }
コード例 #16
0
 protected override void StopTimer()
 {
     if (fTimer != null)
     {
         fTimer.Stop();
         fTimer.Dispose();
         fTimer = null;
     }
 }
コード例 #17
0
 public void End_WaitAtEndOfTurn()
 {
     timer.Stop();
     WaitingAtEndOfTurn = false;
     if (Game.ProcessEndOfTurn())
     {
         Game.ChoseNextCiv();
     }
 }
コード例 #18
0
ファイル: BACnetPanel2.cs プロジェクト: fanzcsoft/bacstack
        /// <summary>
        /// Disabled future refreshes
        /// </summary>
        /// <param name="e"></param>
        protected override void OnUnLoad(EventArgs e)
        {
            base.OnUnLoad(e);

            if (_refreshTimer != null)
            {
                _refreshTimer.Stop();
                _refreshTimer = null;
            }
        }
コード例 #19
0
 void ErrorTimer_Elapsed(object sender, EventArgs e)
 {
     errorTimer.Stop();
     if (errorContent != null)
     {
         errorPanel.Content = errorContent;
         errorPanel.Visible = true;
         errorContent       = null;
     }
 }
コード例 #20
0
 private void UITimer_Tick(object sender, EventArgs e)
 {
     time--;
     lblTimerDisplay.Text = time.ToString();
     if (time <= 0)
     {
         UITimer.Stop();
         playBeepSound();
     }
 }
コード例 #21
0
        // This method demonstrates a pattern for making thread-safe
        // calls on a Windows Forms control.
        //
        // If the calling thread is different from the thread that
        // created the TextBox control, this method creates a
        // SetTextCallback and calls itself asynchronously using the
        // Invoke method.
        //
        // If the calling thread is the same as the thread that created
        // the TextBox control, the Text property is set directly.

        private void UpdateUI(InterfaceBoxState newState)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.InvokeRequired)
            {
                UpdatePadStateCallback d = new UpdatePadStateCallback(UpdateUI);
                this.Invoke(d, new object[] { newState });
            }
            else
            {
                // Check if this update is following the interface box being triggered from the 'armed' state
                if (interfaceBox.State.ArmTriggered)
                {
                    if (anyPadOn(newState))
                    {
                        lockedOut = true;
                        UITimer.Stop();
                        playBeepSound();
                    }
                }

                int index = 0;
                foreach (Port currentPort in newState.Ports)
                {
                    foreach (Pad currentPad in currentPort.Pads)
                    {
                        if (CheckBoxList[index].Checked)
                        {
                            radioButtonList[index].Checked = currentPad.IsClosed;
                        }
                        else
                        {
                            radioButtonList[index].Checked = false;
                        }

                        index++;
                    }
                }

                //// Update the pad states on the UI
                //radioButton1.Checked = ! newState.Ports[0].Pads[0].IsClosed;
                //radioButton2.Checked = ! newState.Ports[0].Pads[1].IsClosed;
                //radioButton3.Checked = ! newState.Ports[0].Pads[2].IsClosed;
                //radioButton4.Checked = ! newState.Ports[0].Pads[3].IsClosed;
                //radioButton5.Checked = ! newState.Ports[0].Pads[4].IsClosed;
                //radioButton6.Checked = ! newState.Ports[1].Pads[0].IsClosed;
                //radioButton7.Checked = ! newState.Ports[1].Pads[1].IsClosed;
                //radioButton8.Checked = ! newState.Ports[1].Pads[2].IsClosed;
                //radioButton9.Checked = ! newState.Ports[1].Pads[3].IsClosed;
                //radioButton10.Checked = ! newState.Ports[1].Pads[4].IsClosed;
            }
        }
コード例 #22
0
        void Timer_Elapsed(object sender, EventArgs e)
        {
            if (interfaceBuilder == null)
            {
                return;
            }
            timer.Stop();
            var code = getCode();

            if (!string.IsNullOrEmpty(code))
            {
                try
                {
                    interfaceBuilder.Create(code, ctl => FinishProcessing(ctl, null), ex => FinishProcessing(null, ex));
                }
                catch (Exception ex)
                {
                    FinishProcessing(null, ex);
                }
            }
        }
コード例 #23
0
 private void btnReset_MouseUp(object sender, MouseEventArgs e)
 {
     CommTimer.Stop();
     if (anyPadOn(interfaceBox.State))
     {
         UITimer.Stop();
         playBeepSound();
     }
     else
     {
         interfaceBox.Arm();
     }
 }
コード例 #24
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (blinkTimer != null)
                {
                    blinkTimer.Stop();
                    blinkTimer.Dispose();
                    blinkTimer = null;
                }
            }

            var doc = CharacterDocument;

            doc.Info.DosAspectChanged  -= Info_DosAspectChanged;
            doc.Info.iCEColoursChanged -= Info_iCEColoursChanged;

            doc.ICEColoursChanged -= Info_iCEColoursChanged;
            doc.SizeChanged       -= document_SizeChanged;

            base.Dispose(disposing);
        }
コード例 #25
0
ファイル: Caret.cs プロジェクト: yoshiheight/Crash.Editor
 /// <summary>
 ///
 /// </summary>
 public void UpdateOnFocusChanged()
 {
     if (_textView.SharedInfo.HasFocus)
     {
         _isCaretPositive = true;
         _blinkTimer.Restart();
     }
     else
     {
         _isCaretPositive = false;
         _blinkTimer.Stop();
     }
 }
コード例 #26
0
ファイル: EtoServices.cs プロジェクト: thereverand/XFEto
        public override void StartTimer(TimeSpan interval, Func <bool> callback)
        {
            var timer = new UITimer {
                Interval = interval.TotalSeconds
            };

            timer.Elapsed += (s, e) => {
                if (!callback())
                {
                    timer.Stop();
                }
            };
            timer.Start();
        }
コード例 #27
0
 private void PlayerEventHappened(object sender, PlayerEventArgs e)
 {
     switch (e.EventType)
     {
     case PlayerEventType.NewTurn:
     {
         if (Game.GetActiveUnit != null)
         {
             Map.ViewPieceMode = false;
         }
         animationTimer.Stop();
         animationCount = 0;
         animationTimer.Start();
         break;
     }
     }
 }
コード例 #28
0
ファイル: CountDownTime.cs プロジェクト: altbodhi/EtoTimer
 protected void Finish()
 {
     isRun = false;
     ChangeState();
     timer.Stop();
     if (isBreak || !periodic.Checked.Value)
     {
         new SoundPlayer("sound.wav").Play();
         MessageBox.Show("Обратный отсчет завершен.");
     }
     else
     {
         new SoundPlayer("sound.wav").PlaySync();
         this.StartTimer(this, EventArgs.Empty);
     }
 }
コード例 #29
0
        void GvSelectionChanged(object sender, EventArgs e)
        {
            var id = GetSlectedWorkflowId();
            var wf = GetWorkflow(id);

            if (wf.IsEnabled)
            {
                _timer.Stop();
                _timer.Elapsed += (s, ea) => UpdateButtons(id, false);
                _timer.Start();

                UpdateButtons(id, true);
            }
            else
            {
                UpdateButtons(id, true);
            }
        }
        /// <summary>
        /// 依据设备名称链接相机
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool Connectted(string name)
        {
            try
            {
                if (camera != null)
                {
                    UITimer.Stop();
                    camera.Acquisition.Unconfigure();
                    camera.Dispose();
                }

                camera = new ImaqdxSession(name);
                bOpen  = true;
            }
            catch (Exception ex)
            {
                bOpen = false;
            }

            return(bOpen);
        }
コード例 #31
0
		public void clearInterval(UITimer timer){
			if(timer!=null){
				timer.Stop();
			}
		}