public void SetStatus(string status, int progress, int total) { if (this.progressBar.InvokeRequired == true || this.statusLabel.InvokeRequired == true) { var callback = new SetStatusDelegate(SetStatus); this.Invoke(callback, new object[] { status, progress, total }); return; } if (this.statusLabel.Text != status) { this.statusLabel.Text = status; } if (this.progressBar.Value != progress) { this.progressBar.Value = progress; } if (this.progressBar.Maximum != total) { this.progressBar.Maximum = total; } }
private void SetStatus(NqsSettingItem item, int posistion, Exception error) { if (InvokeRequired) { SetStatusDelegate del = SetStatus; Invoke(del, item, posistion, error); } else { progressBar1.Value = posistion; if (rtbStatus.TextLength == 0) { rtbStatus.AppendText("Batch Results:\r\n"); } if (error == null) { SetMessage(String.Format("Message of type {0} has been stuffed into {1} queue \r\n", item.SelectedTypeName, item.QueueName), Color.Green); } else { SetMessage(String.Format("Error stuffing message of type {0} into {1} queue! \r\n", item.SelectedTypeName, item.QueueName), Color.Red); } } }
public void SetStatus(string t) { try { if (this.InvokeRequired) { SetStatusDelegate inv = new SetStatusDelegate(this.SetStatus); this.Invoke(inv, new object[] { t }); } else { Body = t; Refresh(); Invalidate(); //TopMost = true; BringToFront(); } } catch (Exception ex) { Engine.Instance.Logs.LogUnexpected(ex); } }
internal CDNClient(uint DepotID, Progress Progress, ProgressBar ProgressBar, SetStatusDelegate SetStatusMethod) { Log("Instance of CDN client created"); ThreadsCount = DwThreadsCount; this.DepotID = DepotID; BaseURLs = new string[ThreadsCount]; Decryptors = new Aes[ThreadsCount]; WaitHandles = new ManualResetEvent[ThreadsCount]; for (int Iterator = 0; Iterator < ThreadsCount; Iterator++) { Aes Decryptor = Create(); Decryptor.BlockSize = 128; Decryptor.KeySize = 256; Decryptors[Iterator] = Decryptor; WaitHandles[Iterator] = new ManualResetEvent(false); } Initialize(ThreadsCount); for (int Iterator = 0; Iterator < ThreadsCount; Iterator++) { BaseURLs[Iterator] = $"https://{NextServer()}/depot/{this.DepotID = DepotID}/"; } Log($"Picked {ThreadsCount} the least busy CDN servers"); BaseDownloadPath = $@"{DownloadsDirectory}\{DepotID}"; DepotKey = DepotKeys[DepotID]; this.Progress = Progress; this.ProgressBar = ProgressBar; SetStatus = SetStatusMethod; Decompressor = new VZip(ThreadsCount); }
private void frmDM_DongBo_Load(object sender, EventArgs e) { lblStatus.Text = String.Empty; dgSetStatus = SetStatus; dgSetProgressMaxValue = SetProgressMaxValue; dgSetProgressCurValue = SetProgressCurValue; dgDisableChapNhanButton = SetChapNhanButtonEnableState; }
public PupilFinder(string videoFileName, System.Windows.Controls.ProgressBar progressBar, System.Windows.Shell.TaskbarItemInfo taskbar, SetStatusDelegate setStatus, FrameProcessedDelegate updateFrame, FramesProcessedDelegate framesProcessed) { this.videoFileName = videoFileName; this.progressBar = progressBar; SetStatus = setStatus; UpdateFrame = updateFrame; OnFramesPupilsProcessed = framesProcessed; this.taskbar = taskbar; videoSource = new VideoCapture(videoFileName); width = (int)videoSource.Get(VideoCaptureProperties.FrameWidth); height = (int)videoSource.Get(VideoCaptureProperties.FrameHeight); fps = (int)videoSource.Get(VideoCaptureProperties.Fps); frameCount = (int)videoSource.Get(VideoCaptureProperties.FrameCount); duration = frameCount / fps; // try to auto load stuff if they exist if (File.Exists(autoTimestampFileName)) { LoadTimestamps(autoTimestampFileName); isTimestampParsed = true; } else { timeStamps = Num.zeros((frameCount, 4), NPTypeCode.Int32); } if (File.Exists(autoPupilsFileName)) { LoadPupilLocations(autoPupilsFileName); } else { pupilLocations = Num.zeros((frameCount, 4), NPTypeCode.Double); pupilLocations *= Num.NaN; // use NaN to indicate pupil not yet found on this frame } cvFrame = new Mat(); for (int i = 0; i < 3; i++) { colorChannels[i] = new Mat(); } red = colorChannels[0]; top = 0; left = 0; right = width; bottom = height; isFrameProcessed = new bool[frameCount]; for (int i = 0; i < frameCount; i++) { isFrameProcessed[i] = false; } }
private bool TrackDownloadProgress(object Args) { object[] ArgsArray = (object[])Args; ulong ID = (ulong)ArgsArray[0]; ProgressBar ProgressBar = (ProgressBar)ArgsArray[1]; SetStatusDelegate SetStatusMethod = (SetStatusDelegate)ArgsArray[2]; void SetStatus(string Text, SolidColorBrush Color) => Current.Dispatcher.Invoke(() => SetStatusMethod(Text, Color)); Progress Progress = ProgressBar.Progress; if (!InitiateDownload(ISteamUGC, ID, false) || !GetDownloadProgress(ISteamUGC, ID, out _, out long Total)) { SetStatus(LocString(LocCode.FailedToInitiateDw), DarkRed); return(false); } int TimeoutCounter = 7; while (Total == 0L && --TimeoutCounter != 0) { Delay(1000).Wait(); GetDownloadProgress(ISteamUGC, ID, out _, out Total); } if (Total == 0L) { SetStatus(LocString(LocCode.ProgressTrackerTimeout), DarkRed); return(false); } TimeoutCounter = 70; void ProgressUpdatedHandler() => SetStatus(string.Format(ETAString, Progress.ETA < 0L ? NAString : ConvertTime(Progress.ETA)), YellowBrush); Current.Dispatcher.Invoke(() => ProgressBar.ProgressUpdated += ProgressUpdatedHandler); Progress.Total = Total; Current.Dispatcher.Invoke(ProgressBar.SetDownloadMode); while (GetDownloadProgress(ISteamUGC, ID, out long Downloaded, out Total) && --TimeoutCounter != 0) { Delay(100).Wait(); if (Downloaded == 0L && Total == 0L) { break; } if (Downloaded != Progress.Current) { TimeoutCounter = 70; } Progress.Increase(Downloaded - Progress.Current); } Current.Dispatcher.Invoke(() => ProgressBar.ProgressUpdated -= ProgressUpdatedHandler); if ((GetModState(ISteamUGC, ID) & 4U) == 0U && Total - Progress.Current > 10485760L) { SetStatus(LocString(TimeoutCounter == 0 ? LocCode.ProgressTrackerTimeout : LocCode.ProgresTrackerStopped), DarkRed); return(false); } Progress.Increase(Progress.Total - Progress.Current); return(true); }
private void SetStatus(string statusText) { if (lblStatus.InvokeRequired) { var d = new SetStatusDelegate(SetStatus); Invoke(d, new object[] { statusText }); } else { lblStatus.Text = statusText; } }
private void SetStatus2(string status) { if (labelStatus.InvokeRequired) { SetStatusDelegate d = new SetStatusDelegate(SetStatus2Real); labelStatus.Invoke(d, new object[] { status }); } else { SetStatus2Real(status); } }
private void SetStatus(string status) { if (lblFilePath.InvokeRequired) { var del = new SetStatusDelegate(SetStatus); Invoke(del, new[] { status }); } else { lblStatus.Text = status; } }
public void SetStatus(string text) { if (this.InvokeRequired) { SetStatusDelegate del = new SetStatusDelegate(SetStatus); this.BeginInvoke(del, new object[] { text }); } else { this.lblProgress.Text = text; } }
private void SetStatus(string status, int percent) { if (this.progressBar.InvokeRequired || this.statusLabel.InvokeRequired) { SetStatusDelegate callback = new SetStatusDelegate(SetStatus); this.Invoke(callback, new object[] { status, percent }); return; } this.statusLabel.Text = status; this.progressBar.Value = percent; }
private void ShowPreloader(bool showPreloader) { if (pbPreloader.InvokeRequired) { var d = new SetStatusDelegate(ShowPreloader); Invoke(d, new object[] { showPreloader }); } else { pbPreloader.Visible = showPreloader; } }
private void SetStatus(string status, int percent) { if (this.progressBar.InvokeRequired || this.statusLabel.InvokeRequired) { var callback = new SetStatusDelegate(SetStatus); this.Invoke(callback, new object[] { status, percent }); return; } this.statusLabel.Text = status; this.progressBar.Value = percent; }
public void SetStatus(string t) { if (this.InvokeRequired) { SetStatusDelegate inv = new SetStatusDelegate(this.SetStatus); this.BeginInvoke(inv, new object[] { t }); } else { Body = t; Refresh(); Invalidate(); } }
//Why we need to change the status text by this function. //Because some the events are fired on another //thread, to change the control value safety, we used this function to //update control value. more detail, please refer to Control.BeginInvoke method // in MSDN protected void _setStatus(string v) { if (InvokeRequired) { object[] args = new object[1]; args[0] = v; SetStatusDelegate d = new SetStatusDelegate(_setStatusCallback); BeginInvoke(d, args); } else { _setStatusCallback(v); } }
private void SetStatus(string status, int percent) { if (this.progressBar.InvokeRequired || this.statusLabel.InvokeRequired) { SetStatusDelegate callback = new SetStatusDelegate(SetStatus); this.Invoke(callback, new object[] { status, percent }); return; } this.statusLabel.Text = status; this.progressBar.Value = percent; /*if (TaskbarManager.IsPlatformSupported == true) * { * TaskbarManager.Instance.SetProgressValue(percent, 100); * }*/ }
public void SetStatus(string t) { if (this.InvokeRequired) { SetStatusDelegate inv = new SetStatusDelegate(this.SetStatus); this.Invoke(inv, new object[] { t }); } else { Body = t; Refresh(); Invalidate(); //TopMost = true; BringToFront(); } }
private void SetStatus(PrintStatus status) { if (lblStatus.InvokeRequired) { var d = new SetStatusDelegate(SetStatus); lblStatus.Invoke(d, new object[] { status }); } else { checkRemoveBorder.Enabled = status == PrintStatus.DONE; // comboColorPalette.Enabled = status == PrintStatus.DONE; // checkInvertPalette.Enabled = status == PrintStatus.DONE; comboMagnify.Enabled = status == PrintStatus.DONE; btnSave.Enabled = status == PrintStatus.DONE; lblStatus.Text = string.Format("Status: {0}", status.ToString()); } }
public void SetStatus(Status s) { if (!_houston.InvokeRequired) { if (_checkInputFile) { return; } switch (s) { case Status.aborted: SubItems[(int)Display.stat].Text = "Aborted"; WriteToLog("aborted"); Locked = false; break; case Status.completed: SubItems[(int)Display.stat].Text = "Completed"; WriteToLog("job completed"); Locked = false; break; case Status.idle: SubItems[(int)Display.stat].Text = "Idle"; if (stat == Status.queued || stat == Status.rqueued) { WriteToLog("dequeued"); } if (stat == Status.scheduled || stat == Status.rscheduled) { WriteToLog("unscheduled"); } else { WriteToLog("added to the job list"); } WriteToLog("folder name set to " + new FileInfo(_inputFile.Filename).DirectoryName); _fileWatch.Path = new FileInfo(_inputFile.Filename).DirectoryName; break; case Status.running: SubItems[(int)Display.stat].Text = "Running"; WriteToLog("started"); break; case Status.queued: case Status.rqueued: SubItems[(int)Display.stat].Text = "Queued"; WriteToLog("queued for immediate startup"); if (stat == Status.scheduled || stat == Status.rscheduled) { SubItems[(int)Display.start].Text = ""; } break; case Status.scheduled: case Status.rscheduled: SubItems[(int)Display.stat].Text = "Scheduled"; WriteToLog("scheduled for " + _schedTime.ToString()); break; case Status.schedulerequest: SubItems[(int)Display.stat].Text = "Waiting to be scheduled"; WriteToLog("waiting to be scheduled"); Locked = false; break; case Status.waiting: SubItems[(int)Display.stat].Text = "Paused"; WriteToLog("paused by the remote scheduler and waiting to be resumed"); break; case Status.resumed: SubItems[(int)Display.stat].Text = "Running"; WriteToLog("calculation is resumed"); break; case Status.compiling: SubItems[(int)Display.stat].Text = "compiling"; WriteToLog("compiling the source code"); break; default: break; } stat = s; if (s == Status.resumed) { s = Status.running; } } else //We are on a non GUI thread. { SetStatusDelegate ssDel = new SetStatusDelegate(SetStatus); _houston.Invoke(ssDel, new object[] { s }); } }
internal CDNClient(uint DepotID, Progress Progress, ProgressBar ProgressBar, SetStatusDelegate SetStatusMethod, ulong ModID) : this(DepotID, Progress, ProgressBar, SetStatusMethod) { this.ModID = ModID; BaseDownloadPath += $".{ModID}"; }
//Why we need to change the status text by this function. //Because some the events are fired on another //thread, to change the control value safety, we used this function to //update control value. more detail, please refer to Control.BeginInvoke method // in MSDN protected void _SetStatus(string v) { if( InvokeRequired ) { object[] args = new object[1]; args[0] = v; SetStatusDelegate d = new SetStatusDelegate(_SetStatusCallBack); BeginInvoke(d, args); } else { _SetStatusCallBack(v); } }
internal Task <bool> TrackDownloadProgressAsync(ulong ModID, ProgressBar ProgressBar, SetStatusDelegate SetStatus) => Factory.StartNew(TrackDownloadProgress, new object[] { ModID, ProgressBar, SetStatus });
public HoughPupilFinder(string videoFileName, System.Windows.Controls.ProgressBar progressBar, System.Windows.Shell.TaskbarItemInfo taskbar, SetStatusDelegate setStatus, FrameProcessedDelegate updateFrame, FramesProcessedDelegate framesProcessed) : base(videoFileName, progressBar, taskbar, setStatus, updateFrame, framesProcessed) { }
public Form1() { InitializeComponent(); setStatusDelegate = new SetStatusDelegate(SetStatus); }
public void SetStatus(string sText, Color cColor) { if (this.InvokeRequired) { SetStatusDelegate call = new SetStatusDelegate(SetStatus); this.Invoke(call, new object[] { sText, cColor }); } else { lblStatus.Text = sText; lblStatus.ForeColor = cColor; } }