예제 #1
0
        private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            double percentage = e.BytesReceived / (double)e.TotalBytesToReceive * 100;

            Threading.SetComponentText(this, status, String.Format(Properties.Strings.UpdateDownloading, String.Format("{0}/{1} ({2:f}%)", e.BytesReceived, e.TotalBytesToReceive, percentage)));
            Threading.ComponentInvoke(progressBar1, (x) => x.Value = (int)Math.Truncate(percentage));
        }
예제 #2
0
        private void Timer_OnNewState(object sender, TimerState e)
        {
            Threading.ComponentInvoke(buttonManualBackup, (x) => x.Enabled = e == TimerState.SavingEnabled || e == TimerState.WaitingForCanvas);

            if (e == TimerState.NeverSaved)
            {
                TaskbarHelper.SetState(SaiHelper.AppProcess, TaskbarProgressBarState.Paused);
            }
            else if (e == TimerState.SavingEnabled)
            {
                TaskbarHelper.SetState(SaiHelper.AppProcess, TaskbarProgressBarState.Normal);
            }

            switch (e)
            {
            case TimerState.NeverSaved:
                Threading.SetComponentText(this, labelStatus, Properties.Strings.StateNeverSaved);
                break;

            case TimerState.SavingDisabled:
                Threading.SetComponentText(this, labelStatus, Properties.Strings.StateSavingDisabled);
                break;

            case TimerState.SavingEnabled:
                Threading.SetComponentText(this, labelStatus, Properties.Strings.StateSavingEnabled);
                break;

            case TimerState.WaitingForCanvas:
                Threading.SetComponentText(this, labelStatus, Properties.Strings.StateWaitingForCanvas);
                break;

            case TimerState.WaitingForProcess:
                Threading.SetComponentText(this, labelStatus, Properties.Strings.StateWaitingForProcess);
                break;

            case TimerState.WaitingForProject:
                Threading.SetComponentText(this, labelStatus, Properties.Strings.StateWaitingForProject);
                break;
            }

            BeginInvoke(new Action(() => sToolStripMenuItem.Text = labelStatus.Text));
        }
예제 #3
0
 private void Timer_OnProgress(object sender, int e)
 {
     Threading.ComponentInvoke(progressBar1, (x) => x.Value = e);
     TaskbarHelper.SetProgress(SaiHelper.AppProcess, e, progressBar1.Maximum);
 }