private void OnUpdateStatusChanged(object sender, UpdateStatusEventArgs e)
        {
            if (!this.Dispatcher.CheckAccess())
            {
                this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new UpdateStatusEventHandler((s, e2) => {
                    OnUpdateStatusChanged(sender, e2);
                }), sender, e);
                return;
            }
            UpdateMainProgressBar(e.Progress, e.MaxProgress);
            UpdateSubProgressBar(e.SummaryProgress, e.SummaryMaxProgress);

            string updateText = string.Empty;

            switch (e.UpdateStage)
            {
            case UpdateStatusEventArgs.Stage.DOWNLOADING:
                updateText = string.Format(LanguageManager.Model.UpdateDownloading, e.CurrentPatch, e.MaxPatch, e.SummaryProgress, e.SummaryMaxProgress);
                break;

            case UpdateStatusEventArgs.Stage.EXTRACTING:
                updateText = string.Format(LanguageManager.Model.UpdateExtracting, e.CurrentPatch, e.MaxPatch, e.SummaryProgress, e.SummaryMaxProgress);
                break;

            case UpdateStatusEventArgs.Stage.INSTALLING:
                updateText = string.Format(LanguageManager.Model.UpdateInstalling, e.Progress, e.MaxProgress);
                break;
            }
            this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new SetInfoText((text_) => {
                UpdateText.Text = text_;
            }), updateText);
        }
Exemple #2
0
        private void OnUpdateStatus(UpdateStatusEventArgs e)
        {
            //SetText(string.Format("Recieved Status Update from {0}. Load is {1}", e.ClientId, e.load), MessageType.Information);
            Color col;

            if (e.load < 30)
            {
                col = Color.Green;
            }
            else if (e.load < 50)
            {
                col = Color.DarkGreen;
            }
            else if (e.load < 70)
            {
                col = Color.Orange;
            }
            else
            {
                col = Color.Red;
            }

            int id = Int32.Parse(e.ClientId.Replace("Client", "")) - 1;

            ColorListItem(id, col);
        }
 private void RaiseUpdateStatusEvent(string status)
 {
     Dispatcher.Invoke(() =>
     {
         UpdateStatusEventArgs newEventArgs = new UpdateStatusEventArgs(UpdateStatusEvent, status);
         RaiseEvent(newEventArgs);
     });
 }
Exemple #4
0
 protected virtual void FireUpdateStatus(object sender, UpdateStatusEventArgs e)
 {
     smartEdit.Core.UpdateStatusEventHandler handler = EventUpdateStatus;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
Exemple #5
0
 private void OnControlUpdateStatus(Object sender, UpdateStatusEventArgs args)
 {
     if (args != null)
     {
         this.tssLabel.Text = args.Label;
         this.tssValue.Text = args.Value;
     }
     else
     {
         this.tssLabel.Text = String.Empty;
         this.tssValue.Text = String.Empty;
     }
 }
Exemple #6
0
        private void ReactToBuilidingStatusChange(object sender, UpdateStatusEventArgs args)
        {
            var building = sender as Entities.Building;

            if (building != null)
            {
                if (args.WasEntityDestroyed == false)
                {
                    UpdateBuildingStatus(building);
                }
                else
                {
                    this.SetVariableState(VariableState.SelectModeView);
                }
            }
        }
        /// <summary>
        /// manages Brace highlighting
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void TextArea_UpdateUI(object sender, UpdateUIEventArgs e)
        {
            // Has the caret changed position?
            var caretPos = TextArea.CurrentPosition;

            if (lastCaretPos != caretPos)
            {
                UpdateStatusEventArgs evt = new UpdateStatusEventArgs();
                evt.Text = "Pos: " + caretPos.ToString();
                FireUpdateStatus(this, evt);
                lastCaretPos = caretPos;
                var bracePos1 = -1;
                var bracePos2 = -1;
                //TODO Brace higligthing not working or overridden by Lexer??
                // Is there a brace to the left or right?
                if (caretPos > 0 && IsBrace(TextArea.GetCharAt(caretPos - 1)))
                {
                    bracePos1 = (caretPos - 1);
                }
                else if (IsBrace(TextArea.GetCharAt(caretPos)))
                {
                    bracePos1 = caretPos;
                }

                if (bracePos1 >= 0)
                {
                    // Find the matching brace
                    bracePos2 = TextArea.BraceMatch(bracePos1);
                    if (bracePos2 == Scintilla.InvalidPosition)
                    {
                        TextArea.BraceBadLight(bracePos1);
                        TextArea.HighlightGuide = 0;
                    }
                    else
                    {
                        TextArea.BraceHighlight(bracePos1, bracePos2);
                        TextArea.HighlightGuide = TextArea.GetColumn(bracePos1);
                    }
                }
                else
                {
                    // Turn off brace matching
                    TextArea.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition);
                    TextArea.HighlightGuide = 0;
                }
            }
        }
Exemple #8
0
        private void UpdateStateChange(object sender, UpdateStatusEventArgs args)
        {
            if (!this.IsHandleCreated)
            {
                this.HandleCreated += (send, e) =>
                {
                    this.UpdateStateChange(sender, args);
                };
                return;
            }
            this.Invoke((MethodInvoker) delegate {
                switch (args.State)
                {
                case State.PENDING:
                    updateStateText.Text = "Up To Date: " + CoreMusicApp.CURRENT_VERSION;
                    break;

                case State.CHECKING:
                    updateStateText.Text = "Checking...";
                    break;

                case State.DOWNLOADING:
                    updateStateText.Text   = "Downloading - " + (args.DownloadProgress < 10 ? " " : "") + args.DownloadProgress.ToString() + "%";
                    downloadProgress.Width = (int)((PROGRESS_MAX_WIDTH / 100.0) * (double)args.DownloadProgress);
                    break;

                case State.READY:
                    updateStateText.Text = "Ready to Update";
                    installUpdateButton.Show();
                    break;
                }
                if (args.State != State.READY)
                {
                    installUpdateButton.Hide();
                }
                if (args.State != State.DOWNLOADING)
                {
                    downloadProgress.Width = 0;
                    downloadProgressBorder.Hide();
                }
                else
                {
                    downloadProgressBorder.Show();
                }
            });
        }
Exemple #9
0
 /// <summary>
 /// Fires the <see cref="StatusUpdated"/> event.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">New status message.</param>
 private void Scrobbler_StatusUpdated(object sender, UpdateStatusEventArgs e)
 {
     StatusUpdated?.Invoke(this, e);
 }
Exemple #10
0
 void childForm_EventUpdateStatus(object sender, UpdateStatusEventArgs e)
 {
     this.toolStripStatusLabel.Text = e.Text;
 }
Exemple #11
0
 /// <summary>
 /// Updates the status.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">Contains the new status.</param>
 private void StatusUpdated(object sender, UpdateStatusEventArgs e)
 {
     CurrentStatus = e.NewStatus;
 }
Exemple #12
0
 /// <summary>
 /// Fires the StatusUpdated event.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">NEw status.</param>
 private void VM_StatusUpdated(object sender, UpdateStatusEventArgs e)
 {
     OnStatusUpdated(e.NewStatus);
 }
Exemple #13
0
 static void ApplicationStatusUpdater_UpdateStatus(object sender, UpdateStatusEventArgs e)
 {
     Console.WriteLine(e.StatusMessage);
 }
 private void weatherView_UpdateStatus(object sender, UpdateStatusEventArgs e)
 {
     ShowStatus(e.Status);
 }
 /// <summary>
 /// Updates the status.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">Contains the new status.</param>
 private void StatusUpdated(object sender, UpdateStatusEventArgs e)
 {
   CurrentStatus = e.NewStatus;
 }