예제 #1
0
        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;
            }
        }
예제 #2
0
 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);
         }
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
 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);
 }
예제 #5
0
 private void frmDM_DongBo_Load(object sender, EventArgs e)
 {
     lblStatus.Text          = String.Empty;
     dgSetStatus             = SetStatus;
     dgSetProgressMaxValue   = SetProgressMaxValue;
     dgSetProgressCurValue   = SetProgressCurValue;
     dgDisableChapNhanButton = SetChapNhanButtonEnableState;
 }
예제 #6
0
        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;
            }
        }
예제 #7
0
        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);
        }
예제 #8
0
 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);
     }
 }
예제 #10
0
 private void SetStatus(string status)
 {
     if (lblFilePath.InvokeRequired)
     {
         var del = new SetStatusDelegate(SetStatus);
         Invoke(del, new[] { status });
     }
     else
     {
         lblStatus.Text = status;
     }
 }
예제 #11
0
 private void SetStatus(string status)
 {
     if (lblFilePath.InvokeRequired)
     {
         var del = new SetStatusDelegate(SetStatus);
         Invoke(del, new[] { status });
     }
     else
     {
         lblStatus.Text = status;
     }
 }
예제 #12
0
 public void SetStatus(string text)
 {
     if (this.InvokeRequired)
     {
         SetStatusDelegate del = new SetStatusDelegate(SetStatus);
         this.BeginInvoke(del, new object[] { text });
     }
     else
     {
         this.lblProgress.Text = text;
     }
 }
예제 #13
0
		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;
        }
예제 #16
0
        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();
            }
        }
예제 #17
0
        //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);
            }
        }
예제 #18
0
        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);
             * }*/
        }
예제 #19
0
        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();
            }
        }
예제 #20
0
        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());
            }
        }
예제 #21
0
    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 });
        }
    }
예제 #22
0
 internal CDNClient(uint DepotID, Progress Progress, ProgressBar ProgressBar, SetStatusDelegate SetStatusMethod, ulong ModID) : this(DepotID, Progress, ProgressBar, SetStatusMethod)
 {
     this.ModID        = ModID;
     BaseDownloadPath += $".{ModID}";
 }
예제 #23
0
파일: Form1.cs 프로젝트: DirkViljoen/eSalon
        //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);
            }
        }
예제 #24
0
 internal Task <bool> TrackDownloadProgressAsync(ulong ModID, ProgressBar ProgressBar, SetStatusDelegate SetStatus) => Factory.StartNew(TrackDownloadProgress, new object[] { ModID, ProgressBar, SetStatus });
예제 #25
0
 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)
 {
 }
예제 #26
0
 public Form1()
 {
     InitializeComponent();
     setStatusDelegate = new SetStatusDelegate(SetStatus);
 }
예제 #27
0
파일: Form1.cs 프로젝트: muupu/GoMoku
 public Form1()
 {
     InitializeComponent();
     setStatusDelegate = new SetStatusDelegate(SetStatus);
 }
예제 #28
0
 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;
     }
 }