Example #1
0
        private void MachineEvents_MachineHalted(object sender, MachineHaltedEventArgs e)
        {
            updater.Stop();
            if (e.Reason == MachineHaltReason.Crash)
            {
                if (e.CrashException.Message.Contains(MachineErrorMessages.NoEepromFound))
                {
                    MessageBox.Show("Machine EEPROM not found or empty. It prevents booting machine, install proper EEPROM with code or make it yourself.", "Machine EEPROM not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (e.CrashException.Message.Contains(MachineErrorMessages.FailedToLoadBios))
                {
                    MessageBox.Show("Unable to load BIOS from EEPROM, it maybe caused by corrupted EEPROM code, syntax code or something else. You can find more information below:\r\n\r\n" + e.CrashException.Message, "Machine BIOS load failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Machine has crashed with unknown error!\r\n\r\nSomething critical happened while running VM! More information can be found below:\r\n\r\n" + e.CrashException.Message + "\r\nStack trace:\r\n" + e.CrashException.StackTrace);
                }
            }
            else if (e.Reason == MachineHaltReason.Shutdown)
            {
                Machine.RunningInstance.ClearState();
            }

            if (InvokeRequired)
            {
                Invoke(new Action(() => { this.Close(); }));
            }
            else
            {
                this.Close();
            }
        }
        private void UpdateTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                statements = BL.ApplicationDataContext.Instance.Service.ProcessStatementsUpdate();

                pbcPrint.Properties.Maximum = Statements.Count(n => n.ShouldPrint);
                pbcEmail.Properties.Maximum = Statements.Count(n => n.ShouldEmail);

                if (BindingSource.DataSource == null)
                {
                    UpdateTimer.Stop();
                    Essential.BaseAlert.ShowAlert("Processing statements", "Statements processing complete.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Information);
                    this.Close();
                }
                else
                {
                    lblPrintProgress.Text    = string.Format("Printed {0} of {1}", Statements.Count(n => n.HasPrinted.HasValue), Statements.Count(n => n.ShouldPrint));
                    pbcPrint.EditValue       = Statements.Count(n => n.HasPrinted.HasValue);
                    lblEmailProgress.Text    = string.Format("Mailed {0} of {1}", Statements.Count(n => n.HasMailed.HasValue), Statements.Count(n => n.ShouldEmail));
                    pbcEmail.EditValue       = Statements.Count(n => n.HasMailed.HasValue);
                    BindingSource.DataSource = statements;
                    grdProgress.RefreshDataSource();
                }
            }
            catch
            {
                UpdateTimer.Stop();
                this.Close();
            }
        }
Example #3
0
        // Tick Event handler for the Timer control.  Handle fade in and fade out and paint progress bar.
        private void UpdateTimer_Tick(object sender, System.EventArgs e)
        {
            lblStatus.Text = m_sStatus;

            // Calculate opacity
            if (m_dblOpacityIncrement > 0)                      // Starting up splash screen
            {
                m_iActualTicks++;
                if (this.Opacity < 1)
                {
                    this.Opacity += m_dblOpacityIncrement;
                }
            }
            else             // Closing down splash screen
            {
                if (this.Opacity > 0)
                {
                    this.Opacity += m_dblOpacityIncrement;
                }
                else
                {
                    StoreIncrements();
                    UpdateTimer.Stop();
                    this.Close();
                }
            }
        }
Example #4
0
        //Point last = new Point();

        private void DrawForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
            {
                UpdateTimer.Start();
                DrawTimer.Start();
                lasttime = DateTime.Now;
            }
            if (e.KeyCode == Keys.C)
            {
                UpdateTimer.Stop();
                DrawTimer.Stop();
            }
            if (e.KeyCode == Keys.D)
            {
                //camera.View = camera.View * Matrix4.Translate(0f, coeff, 0f);
                rocket.Move(new Vector3(rocket.Position.X + 10 * coeff, rocket.Position.Y, rocket.Position.Z));
            }
            if (e.KeyCode == Keys.A)
            {
                rocket.Move(new Vector3(rocket.Position.X - 10 * coeff, rocket.Position.Y, rocket.Position.Z));
                //camera.View = camera.View * Matrix4.Translate(0f, -coeff, 0f);
            }
            if (e.KeyCode == Keys.W)
            {
                rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y - 10 * coeff, rocket.Position.Z));
                //camera.View = camera.View * Matrix4.Translate(0f, 0f, coeff);
            }
            if (e.KeyCode == Keys.S)
            {
                rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y + 10 * coeff, rocket.Position.Z));
                //camera.View = camera.View * Matrix4.Translate(0f, 0f, -coeff);
            }
        }
Example #5
0
 private void _UpdateTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         // Redraw and continue the timer if we're visible, enabled and not in DesignMode
         // The timer is also disabled here because the Timer component seems to have an error (it will crashafter a while!?). Restarting the timer is a workaround.
         UpdateTimer.Stop();
         if (IsEnabled)
         {
             if (_LastPosition == Cursor.Position)
             {
                 // Refresh only if the position has changed
                 return;
             }
             // Remember the current cursor position
             _LastPosition = Cursor.Position;
             // Repaint everything
             Invalidate();
             // Release the event after the display has been updated
             OnDisplayUpdated();
         }
     }
     finally
     {
         // Restart the timer
         UpdateTimer.Start();
     }
 }
        private void DialogWhitecap_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                UpdateTimer.Stop();
                InitBoard();
                UpdateTimer.Start();
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
            {
                UpdateTimer.Stop();

                try
                {
                    imagebuf.Save(string.Format("SS@{0}.png", DateTimeHelper.GetTimeStamp()), ImageFormat.Png);
                }
                catch (Exception)
                {
                    System.Media.SystemSounds.Exclamation.Play();
                }
                finally
                {
                    UpdateTimer.Start();
                }
            }
        }
Example #7
0
        private void UpdateTimer_Tick(Object sender, EventArgs e)
        {
            Int32 delay;

            do
            {
                if (!_actionEnumerator.MoveNext() || !_rover.Perform(_actionEnumerator.Current, out Update update))
                {
                    UpdateTimer.Stop();
                    UpdateStats();
                    Render();
                    beginRender.Enabled = true;
                    _actionEnumerator.Dispose();
                    return;
                }

                _stats = _stats.Add(_actionEnumerator.Current, update);
                _state.Apply(update);

                delay = _actionEnumerator.Current.Instruction switch
                {
                    Instruction.Move => 75,
                    Instruction.CollectSample => 50,
                    _ => 0
                };
            }while (delay == 0);
            UpdateTimer.Interval = delay;

            UpdateStats();
            Render();
        }
Example #8
0
 private void UpdateTimer_Tick(object sender, EventArgs e)
 {
     if (panel2.Width <= 100)
     {
         panel2.Width += 3;
     }
     else if (panel2.Width <= 200)
     {
         panel2.Width += 15;
     }
     else if (panel2.Width <= 400)
     {
         panel2.Width += 8;
     }
     else if (panel2.Width < 600)
     {
         panel2.Width += 20;
     }
     else if (panel2.Width >= 600)
     {
         UpdateTimer.Stop();
         h = 1;
         opener();
     }
 }
Example #9
0
        public void Dispose()
        {
            if (MouseInput != null)
            {
                MouseInput.LeftButtonDown -= new MouseInput.MouseHookCallback(OnLeftMouseDown);
                MouseInput.Uninstall();
            }

            if (procDelegate != null)
            {
                UnsetHooks();
            }

            if (UpdateTimer != null || SnapTimer != null)
            {
                UpdateTimer.Stop();
                UpdateTimer.Dispose();

                SnapTimer.Stop();
                SnapTimer.Dispose();
            }

            if (CurrentLog != null)
            {
                //Write Log to File on Exit?
                CurrentLog.LogEntries.Clear();
            }
        }
Example #10
0
 private void DialogWhitecap_DoubleClick(object sender, EventArgs e)
 {
     UpdateTimer.Stop();
     colortheme = rand.Next(64);
     //colortheme = 21;
     Start();
 }
        // Tick Event for the Timer control.  Handle fade in and fade out and paint progress bar.
        private void UpdateTimer_Tick(object sender, System.EventArgs e)
        {
            lblStatus.Text = m_sStatus;

            // Calculate opacity
            if (m_dblOpacityIncrement > 0)    // Starting up splash screen
            {
                m_iActualTicks++;
                if (this.Opacity < 1)
                {
                    this.Opacity += m_dblOpacityIncrement;
                }
            }
            else // Closing down splash screen
            {
                if (this.Opacity > 0)
                {
                    this.Opacity += m_dblOpacityIncrement;
                }
                else
                {
                    StoreIncrements();
                    UpdateTimer.Stop();
                    this.Close();
                }
            }

            // Paint progress bar
            if (m_bFirstLaunch == false && m_dblLastCompletionFraction < m_dblCompletionFraction)
            {
                m_dblLastCompletionFraction += m_dblPBIncrementPerTimerInterval;
                int width = (int)Math.Floor(pnlStatus.ClientRectangle.Width
                                            * m_dblLastCompletionFraction);
                int height = pnlStatus.ClientRectangle.Height;
                int x      = pnlStatus.ClientRectangle.X;
                int y      = pnlStatus.ClientRectangle.Y;
                if (width > 0 && height > 0)
                {
                    m_rProgress = new Rectangle(x, y, width, height);
                    if (!pnlStatus.IsDisposed)
                    {
                        Graphics            g            = pnlStatus.CreateGraphics();
                        LinearGradientBrush brBackground =
                            new LinearGradientBrush(m_rProgress,
                                                    Color.FromArgb(58, 96, 151),
                                                    Color.FromArgb(181, 237, 254),
                                                    LinearGradientMode.Horizontal);
                        g.FillRectangle(brBackground, m_rProgress);
                        g.Dispose();
                    }
                    int iSecondsLeft = 1 + (int)(TIMER_INTERVAL *
                                                 ((1.0 - m_dblLastCompletionFraction) / m_dblPBIncrementPerTimerInterval)) / 1000;
                    m_sTimeRemaining = (iSecondsLeft == 1) ?
                                       string.Format("1 second remaining") :
                                       string.Format("{0} seconds remaining", iSecondsLeft);
                }
            }
            lblTimeRemaining.Text = m_sTimeRemaining;
        }
 private void RobotSimulatorUI_FormClosing(object sender, FormClosingEventArgs e)
 {
     //if (invokedClose) return;
     //invokedClose = true;
     UpdateTimer.Stop();
     simulator.Disconnect();
     simulator.Disconnect();
 }
        /// <inheritdoc />
        internal protected override Task OnStoppedAsync()
        {
            DiscordClient.Connected -= OnDiscordClientConnected;

            UpdateTimer.Stop();

            return(Task.CompletedTask);
        }
Example #14
0
 private void StopConnectingButton_Click(object sender, EventArgs e)
 {
     SerialNumberTextBox.Enabled = true;
     TryToDisconnect();
     UpdateTimer.Stop();
     StopConnectingButton.Enabled = false;
     ConnectButton.Enabled        = true;
     PositionTextBox.Text         = "(disconnected)";
 }
Example #15
0
        /// <summary>
        /// form closing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClientForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            UpdateTimer.Stop();

            if (Network != null)
            {
                Network.Shutdown();
            }
        }
        private void UpdateTimer_Tick(object sender, System.EventArgs e)
        {
            lblStatus.Text = Status;

            if (!IsOpen)
            {
                UpdateTimer.Stop();
                Close();
            }
        }
Example #17
0
 void StopConnectingButton_Click(object sender, EventArgs e)
 {
     SerialNumberTextBox.Enabled = true;
     TryToDisconnect();
     UpdateTimer.Stop();
     StopConnectingButton.Enabled = false;
     ConnectButton.Enabled        = true;
     TargetTextBox.Text           = "(disconnected)";
     ScaledFeedbackTextBox.Text   = "(disconnected)";
 }
 private void DialogWhitecap_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         UpdateTimer.Stop();
         colortheme = rand.Next(64);
         //colortheme = 27;
         Start();
     }
 }
Example #19
0
        public void Dispose()
        {
            UpdateTimer.Stop();
            UpdateTimer.Elapsed -= OnTimerTick;
            UpdateTimer.Dispose();

            Client.OnReady -= OnClientReady;
            Client.ClearPresence();
            Client.Dispose();
        }
Example #20
0
 public void Stop()
 {
     if (!IsObserving)
     {
         return;
     }
     UpdateTimer.Stop();
     LogBuilder.AppendLine(string.Format("[{0}] : {1}", DateTime.Now.ToString(), Resources.StopObserve));
     IsObserving = false;
     Stopped?.Invoke(this);
 }
Example #21
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         UpdateTimer.Stop();
         UpdateTimer.Dispose();
         // free managed resources
         ClosePort(Port);
     }
     // free native resources if there are any.
 }
 /// <summary>
 /// Whether or not the hourly update time is active
 /// </summary>
 void ApplyHourlyTimer()
 {
     if (App.Default.EnableHourlyReminder)
     {
         UpdateTimer.Start();
     }
     else
     {
         UpdateTimer.Stop();
     }
 }
Example #23
0
        protected override void Init()
        {
            base.Init();
            Outline();

            Classifier.ClassificationChanged += (sender, args) => {
                //restart the timer
                UpdateTimer.Stop();
                UpdateTimer.Start();
            };
        }
Example #24
0
        void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            if (!SelectedProductGroupItem.IsCompatibleWithCurrentStore)
            {
                UserMessage.Show("The product group you selected is not compatible with the current Store (" + HostItemStore.Instance.StoreName + "). Please pick another group.");
                return;
            }

            UpdateTimer.Stop();
            Result = DialogResult.Open;
            Close();
        }
Example #25
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (UpdateTimer.Enabled)
     {
         UpdateTimer.Stop();
         button1.Text = "Play";
     }
     else if (UpdateTimer.Enabled == false)
     {
         UpdateTimer.Start();
         button1.Text = "Pause";
     }
 }
Example #26
0
 private void UpdateTimer_Tick(object sender, EventArgs e)
 {
     camera.View = rocket.Translation;
     rocket.Move(new Vector3(rocket.Position.X, rocket.Position.Y, rocket.Position.Z + coeff));
     //camera.View = camera.View * Matrix4.Scale(1 + coeff, 1 + coeff, 1 + coeff);
     hit = target.CheckHit(rocket);
     if (hit)
     {
         MessageBox.Show("Попал!");
         UpdateTimer.Stop();
         DrawTimer.Stop();
     }
     Invalidate();
 }
Example #27
0
        public void OnApplicationQuit()
        {
            Log?.Debug("OnApplicationQuit");

            // Cancel update timer
            UpdateTimer.Stop();

            // Clean up events
            BSEvents.lateMenuSceneLoadedFresh -= OnLateMenuSceneLoadedFresh;
            MpSession.TearDown();

            // Try to cancel any host announcements we may have had
            GameStateManager.UnAnnounce();
        }
Example #28
0
        protected override void Dispose(bool connectionLost)
        {
            UpdateTimer.Stop();

            Context.RPCClient.Callbacks.PlayerConnect -= Callbacks_PlayerConnect;
            Context.RPCClient.Callbacks.BeginRace     -= Callbacks_BeginRace;
            Context.RPCClient.Callbacks.EndRace       -= Callbacks_EndRace;
            Context.RPCClient.Callbacks.PlayerFinish  -= Callbacks_PlayerFinish;

            if (!connectionLost)
            {
                SendEmptyManiaLinkPage(LIVE_RANKING_LIST_MANIA_LINK_PAGE_ID);
            }
        }
Example #29
0
 private void UpdateTimer_Tick(object sender, EventArgs e)
 {
     if (StatementTask != null && StatementTask.Status != System.Threading.Tasks.TaskStatus.RanToCompletion)
     {
         btnViewActiveProcessing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
         btnProcessStatements.Visibility    = DevExpress.XtraBars.BarItemVisibility.Never;
     }
     else
     {
         btnViewActiveProcessing.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
         btnProcessStatements.Visibility    = DevExpress.XtraBars.BarItemVisibility.Always;
         UpdateTimer.Stop();
     }
 }
        protected override void UpdateTileLayer()
        {
            UpdateTimer.Stop();

            if (ParentMap == null || !ParentMap.MapProjection.IsWebMercator)
            {
                TileGrid = null;
                UpdateTiles();
            }
            else if (SetTileGrid())
            {
                SetRenderTransform();
                UpdateTiles();
            }
        }