public TelaProgressoUpdate(String operacao, ProgressBarStyle progressBarStyle, WebClient webClient) { InitializeComponent(); lblOperacao.Text = operacao; progressBar.Style = progressBarStyle; this.webClient = webClient; }
/// <summary> /// Construtor sobrecarregado. /// </summary> /// <param name="operacao">Detalhe da operação sendo realizada.</param> /// <param name="progressBarStyle">Determina estilo de progresso de barra.</param> /// <param name="backgroundWorker">Backgroundworker utilizado</param> public TelaProgresso(String operacao, ProgressBarStyle progressBarStyle, ref BackgroundWorker backgroundWorker) { InitializeComponent(); lblOperacao.Text = operacao; progressBar.Style = progressBarStyle; this.backgroundWorker = backgroundWorker; }
public void ChangeProgressBar(int value, string text, ProgressBarStyle style) { if (value != 100) { download_bar.Visible = true; download_label.Visible = true; download_label.Text = text; download_bar.Style = style; if (style != ProgressBarStyle.Marquee) download_bar.Value = value; } else if (value == 100 && text.Equals("Parsing build list")) { download_label.Text = text; download_bar.Style = style; ProcessBuildList process_build = new ProcessBuildList(); m_build_list = process_build.Run(s_major_version); PopulateComboBoxes(m_build_list); } else { download_label.Visible = false; download_bar.Visible = false; } }
private void SetProgressBarSettings_Internal(int minimum, int maximum, int step, ProgressBarStyle style) { ProgressIndicator.Minimum = minimum; ProgressIndicator.Maximum = maximum; ProgressIndicator.Step = step; ProgressIndicator.Style = style; ProgressIndicator.Value = minimum; }
///<summary>Creates a new ProgressBarReporter that displays progress on the specified ProgressBar.</summary> public ProgressBarReporter(ProgressBar bar) { if (bar == null) throw new ArgumentNullException("bar"); Bar = bar; if (Bar.Style == ProgressBarStyle.Marquee) defaultStyle = ProgressBarStyle.Blocks; else defaultStyle = Bar.Style; }
// invokes private void progressBarFileStyle(ProgressBarStyle prbStyle) { if (this.progressFile.InvokeRequired) { this.progressFile.Invoke(new MethodInvoker(delegate { this.progressFile.Style = prbStyle; })); } else { this.progressFile.Style = prbStyle; } }
private void UpdateStyle(ProgressBarStyle x) { if (SyncContext != null) { SyncContext.Post(SetStyle, x); } else { Style = x; } }
/// <summary> /// Thread-safe wrapper for <see cref="System.Windows.Forms.ProgressBar.Style"/>. /// </summary> /// <param name="control">The <see cref="System.Windows.Forms.ProgressBar"/>.</param> /// <param name="value">The <see cref="System.Windows.Forms.ProgressBarStyle"/> to set.</param> public static void SetStyle(this ProgressBar control, ProgressBarStyle value) { if (control.InvokeRequired) { control.Invoke((Action<ProgressBarStyle>)((ProgressBarStyle var) => control.Style = var), value); } else { control.Style = value; } }
public ActionProgressDialog(AsyncAction action, ProgressBarStyle progressBarStyle) { InitializeComponent(); this.action = action; action.Completed += action_Completed; action.Changed += action_Changed; progressBar1.Style = progressBarStyle; updateStatusLabel(); buttonCancel.Enabled = action.CanCancel; ShowIcon = false; HideTitleBarIcons(); }
public static dlgProgress ShowProgress(string strTitle, string strMessage, string strStatus, ProgressBarStyle style, Form parent) { dlgProgress dlg = new dlgProgress(); dlg.Title = strTitle; dlg.Message = strMessage; dlg.Status = strStatus; dlg.ProgressStyle = style; dlg.Show(parent); dlg.TopMost = true; return dlg; }
/// <summary> /// Initializes a progress bar with the given name and details, and draws the 0% progress to the screen /// </summary> /// <param name="AX">The x coordinate of the bar</param> /// <param name="AY">The y coordinate of the bar</param> /// <param name="AWidth">The width of the bar</param> /// <param name="AStyle">The style of the bar</param> /// <param name="AFG">The foreground colour of the completed bar</param> /// <param name="ABG">The background colour of the bar</param> /// <param name="AShaded">The foreground colour of the uncompleted bar</param> public CrtProgressBar(CrtControl AParent, int ALeft, int ATop, int AWidth, ProgressBarStyle AStyle) : base(AParent, ALeft, ATop, AWidth, 1) { _Style = AStyle; _BackColour = Crt.Blue; _BarForeColour = Crt.Yellow; _BlankForeColour = Crt.LightGray; _LastMarqueeUpdate = DateTime.Now; _MarqueeAnimationSpeed = 25; _Maximum = 100; _PercentPrecision = 2; _PercentVisible = true; _Value = 0; Paint(true); }
public static void SetupUI(Scene scene) { scene.addRenderer(new ScreenSpaceRenderer(100, (int)RenderLayer.ScreenSpace)); scene.addRenderer(new RenderLayerExcludeRenderer(0, (int)RenderLayer.ScreenSpace)); var canvas = scene.createEntity("ui").addComponent(new UICanvas()); canvas.isFullScreen = true; canvas.renderLayer = (int)RenderLayer.ScreenSpace; var table = canvas.stage.addElement(new Table()); table.setFillParent(true).top().left().padTop(10); var bar = new ProgressBar(0, 1, 0.1f, false, ProgressBarStyle.create(Color.Yellow, Color.Black)); table.add(bar); table.row().setPadTop(10); var slider = new Slider(0, 1, 0.1f, false, SliderStyle.create(Color.White, Color.Black)); table.add(slider); table.row(); }
private void TerminatedHandler(object sender, BackgroundTaskTerminatedEventArgs e) { if (_autoClose && e.Reason != BackgroundTaskTerminatedReason.Exception) { this.ExitCode = ApplicationComponentExitCode.None; Host.Exit(); } else { _marqueeSpeed = 0; _enableCancel = true; switch (e.Reason) { case BackgroundTaskTerminatedReason.Exception: _exception = e.Exception; this.ExitCode = ApplicationComponentExitCode.Error; Host.Exit(); break; case BackgroundTaskTerminatedReason.Completed: case BackgroundTaskTerminatedReason.Cancelled: default: if (this.ProgressBarStyle == ProgressBarStyle.Marquee) { // Make the progress bar looks 'full' at completion _progressBarStyle = ProgressBarStyle.Blocks; _progressBar = this.ProgressBarMaximum; } break; } SignalProgressTerminate(); } }
private void Reset(string message, long max, long min, ProgressBarStyle style, long marqueeTimeoutMs, NotifyOptions options) { Validate(min, max, 0); _val = 0; _min = min; _max = max; _marqueeTimeoutMs = marqueeTimeoutMs; ReportOption = options; Message = message; Cancel = false; CommonUtils.ExecuteOnUIThread(() => { _ctrlProgress.Maximum = (int)_max; _ctrlProgress.Minimum = (int)_min; _ctrlProgress.Value = 0; _ctrlProgress.Style = style; }, _formOwner); Application.DoEvents(); _stopper.Restart(); }
void SetProgresssBarStyle(ProgressBarStyle ProgressBarStyle) { try { if (ProgressBar.IsDisposed) return; if (ProgressBar.InvokeRequired) { Invoke(new SetProgressBarStyleDelegate(SetProgresssBarStyle), ProgressBarStyle); } else { ProgressBar.Style = ProgressBarStyle; } } catch (Exception ex) { HelperFunctions.ShowError(ex); } }
/// <summary> /// Open and displays the task form. /// </summary> /// <param name="Parent">The calling form, so the task form can be centered</param> /// <param name="WindowTitle">The task dialog window title</param> /// <param name="InstructionText">Instruction text displayed after the info icon. Leave null /// to hide the instruction text and icon.</param> /// <param name="Cancelable">Specifies whether the operation can be canceled</param> /// <param name="Style">The progress bar style</param> /// <exception cref="Exception">Thrown if the Task form is already open and running. Use the IsOpen property /// to determine if the form is already running</exception> public static void Show(Form Parent, string WindowTitle, string InstructionText, bool Cancelable, ProgressBarStyle Style, int Steps) { Show(Parent, WindowTitle, InstructionText, null, Cancelable, Style, Steps); }
/// <summary> /// Designed to be called from a seperate thread from the main thread (multi threading) /// </summary> /// <param name="value"></param> private void SetDownloadProgressbarMarqueueStyle(ProgressBarStyle style) { try { if (!CloseAllThreads) this.Invoke(new Action(delegate() { this.progressBarDownload.Style = style; })); } catch (Exception ex) { throw ex; } }
/// <summary> /// Metod för att sätta egenskaper för progressbar på ett trådsäkert sätt. /// </summary> /// <param name="style"></param> /// <param name="current"></param> /// <param name="max"></param> private void SetCurrentProgress(ProgressBarStyle style, int current, int max) { if (this.statusProgressBar.ProgressBar.InvokeRequired) { this.statusProgressBar.ProgressBar.Invoke(new CurrentProgressCallback(SetCurrentProgress), new object[] { style, current, max }); } else { this.statusProgressBar.ProgressBar.Style = style; this.statusProgressBar.ProgressBar.Maximum = max; this.statusProgressBar.ProgressBar.Value = current; } /* if (this.wmfProgressBar.InvokeRequired) { this.wmfProgressBar.Invoke(new CurrentProgressCallback(SetCurrentProgress), new object[] { style, current, max }); } else { this.wmfProgressBar.Style = style; this.wmfProgressBar.Maximum = max; this.wmfProgressBar.Value = current; } */ }
private void SetLabelProgressPercentageMsg(string message, long count, long totalCount, ProgressBarStyle style) { progressReporter.ReportProgress(0, new ProgressDetails { SetlabelProgressPercentageMessage = true, ShowProgressBar = true, style = style, CurrentCount = count, Maximum = totalCount, Message = message }); }
public HorizontalProgressBar(ProgressBarStyle style) : base(style) { HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Top; }
void SetStyle(ProgressBarStyle style) { if (cProgressBar.InvokeRequired) { StyleDelegate d = new StyleDelegate(SetStyle); this.Invoke(d, style); } else { cProgressBar.Style = style; } }
private void SetProgressBarStyle(ProgressBarStyle style) { if (progressBar.InvokeRequired) { progressBar.BeginInvoke((MethodInvoker)delegate { progressBar.Style = style; }); } else { progressBar.Style = style; } }
private void UpdateBarStatus(string status, ProgressBarStyle style, JobInfo info) { if (InvokeRequired) { Invoke(new MethodInvoker(() => UpdateBarStatus(status, style, info))); return; } ((DataGridViewProgressCell) info.rowShown.Cells[1]).ProgressBarStyle = style; ((DataGridViewProgressCell) info.rowShown.Cells[1]).Text = status; }
private void SetProgressBarStyle(ProgressBarStyle style) { if (progressBar.InvokeRequired) { SetProgressStyleCallback d = new SetProgressStyleCallback(SetProgressBarStyle); this.Invoke(d, new object[] { style }); } else progressBar.Style = style; }
int ShellExec(String command) { WriteLine(command); Style = ProgressBarStyle.Marquee; ProcessStartInfo info = new ProcessStartInfo { UseShellExecute = false, LoadUserProfile = true, ErrorDialog = false, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, RedirectStandardOutput = true, StandardOutputEncoding = Encoding.UTF8, RedirectStandardError = true, StandardErrorEncoding = Encoding.UTF8, FileName = "cmd.exe", Arguments = "/c " + command }; Process shell = new Process(); shell.StartInfo = info; shell.EnableRaisingEvents = true; shell.ErrorDataReceived += new DataReceivedEventHandler(ShellErrorDataReceived); shell.OutputDataReceived += new DataReceivedEventHandler(ShellOutputDataReceived); shell.Start(); shell.BeginErrorReadLine(); shell.BeginOutputReadLine(); shell.WaitForExit(); return shell.ExitCode; }
void showMessage(string msg, ProgressBarStyle style) { messageToolStripProgressBar.Style = style; messageToolStripStatusLabel.Text = msg; messageToolStripProgressBar.Visible = true; messageToolStripStatusLabel.Visible = true; }
/// <summary> /// Sets the progress bar style. Thread-safe. /// </summary> /// <param name="style"></param> protected void SetProgressStyle(ProgressBarStyle style) { if (Progress.InvokeRequired == false) Progress.Style = style; else Progress.Invoke(new SetProgressStyleDelegate(SetProgressStyle), style); }
public StatusStateInfo(ProgressBarStyle pbs) { m_pbs = pbs; }
public static int ShowCommandBox(string title, string mainInstruction, string content, string commandButtons, bool showCancelButton, ProgressBarStyle progressBarStyle) { return(ShowCommandBox(IntPtr.Zero, title, mainInstruction, content, string.Empty, string.Empty, string.Empty, commandButtons, showCancelButton, CommonIcon.None, CommonIcon.Information, progressBarStyle)); }
/// <summary> /// Creates a Bootstrap progress-bar with a defined /// <paramref name="style" />, a default color and /// <paramref name="progress" />. /// </summary> /// <param name="style">The style of the progress bar</param> /// <param name="progress">The current progress percentage</param> public MvcHtmlString ProgressBar(ProgressBarStyle style, double progress) { return(ProgressBar(style, ProgressBarColor.Default, progress)); }
/// <summary> /// creates a default Skin that can be used for quick mockups. Includes button, textu button, checkbox, progress bar and slider styles. /// </summary> /// <returns>The default skin.</returns> public static Skin CreateDefaultSkin() { var skin = new Skin(); // define our colors var buttonColor = new Color(78, 91, 98); var buttonOver = new Color(168, 207, 115); var buttonDown = new Color(244, 23, 135); var overFontColor = new Color(85, 127, 27); var downFontColor = new Color(255, 255, 255); var checkedOverFontColor = new Color(247, 217, 222); var checkboxOn = new Color(168, 207, 115); var checkboxOff = new Color(63, 63, 63); var checkboxOver = new Color(130, 130, 130); var checkboxOverFontColor = new Color(220, 220, 220); var barBg = new Color(78, 91, 98); var barKnob = new Color(25, 144, 188); var barKnobOver = new Color(168, 207, 115); var barKnobDown = new Color(244, 23, 135); var windowColor = new Color(17, 17, 17); var textFieldFontColor = new Color(220, 220, 220); var textFieldCursorColor = new Color(83, 170, 116); var textFieldSelectionColor = new Color(180, 52, 166); var textFieldBackgroundColor = new Color(22, 22, 22); var scrollPaneScrollBarColor = new Color(44, 44, 44); var scrollPaneKnobColor = new Color(241, 156, 0); var listBoxBackgroundColor = new Color(20, 20, 20); var listBoxSelectionColor = new Color(241, 156, 0); var listBoxHoverSelectionColor = new Color(120, 78, 0); var selectBoxBackgroundColor = new Color(10, 10, 10); // add all our styles var buttonStyle = new ButtonStyle { Up = new PrimitiveDrawable(buttonColor, 10), Over = new PrimitiveDrawable(buttonOver), Down = new PrimitiveDrawable(buttonDown) }; skin.Add("default", buttonStyle); var textButtonStyle = new TextButtonStyle { Up = new PrimitiveDrawable(buttonColor, 6, 2), Over = new PrimitiveDrawable(buttonOver), Down = new PrimitiveDrawable(buttonDown), OverFontColor = overFontColor, DownFontColor = downFontColor, PressedOffsetX = 1, PressedOffsetY = 1 }; skin.Add("default", textButtonStyle); var toggleButtonStyle = new TextButtonStyle { Up = new PrimitiveDrawable(buttonColor, 10, 5), Over = new PrimitiveDrawable(buttonOver), Down = new PrimitiveDrawable(buttonDown), Checked = new PrimitiveDrawable(new Color(255, 0, 0, 255)), CheckedOverFontColor = checkedOverFontColor, OverFontColor = overFontColor, DownFontColor = downFontColor, PressedOffsetX = 1, PressedOffsetY = 1 }; skin.Add("toggle", toggleButtonStyle); var checkboxStyle = new CheckBoxStyle { CheckboxOn = new PrimitiveDrawable(30, checkboxOn), CheckboxOff = new PrimitiveDrawable(30, checkboxOff), CheckboxOver = new PrimitiveDrawable(30, checkboxOver), OverFontColor = checkboxOverFontColor, DownFontColor = downFontColor, PressedOffsetX = 1, PressedOffsetY = 1 }; skin.Add("default", checkboxStyle); var progressBarStyle = new ProgressBarStyle { Background = new PrimitiveDrawable(14, barBg), KnobBefore = new PrimitiveDrawable(14, barKnobOver) }; skin.Add("default", progressBarStyle); var sliderStyle = new SliderStyle { Background = new PrimitiveDrawable(6, barBg), Knob = new PrimitiveDrawable(14, barKnob), KnobOver = new PrimitiveDrawable(14, barKnobOver), KnobDown = new PrimitiveDrawable(14, barKnobDown) }; skin.Add("default", sliderStyle); var windowStyle = new WindowStyle { Background = new PrimitiveDrawable(windowColor) }; skin.Add("default", windowStyle); var textFieldStyle = TextFieldStyle.Create(textFieldFontColor, textFieldCursorColor, textFieldSelectionColor, textFieldBackgroundColor); skin.Add("default", textFieldStyle); var labelStyle = new LabelStyle(); skin.Add("default", labelStyle); var scrollPaneStyle = new ScrollPaneStyle { VScroll = new PrimitiveDrawable(6, 0, scrollPaneScrollBarColor), VScrollKnob = new PrimitiveDrawable(6, 50, scrollPaneKnobColor), HScroll = new PrimitiveDrawable(0, 6, scrollPaneScrollBarColor), HScrollKnob = new PrimitiveDrawable(50, 6, scrollPaneKnobColor) }; skin.Add("default", scrollPaneStyle); var listBoxStyle = new ListBoxStyle { FontColorHovered = new Color(255, 255, 255), Selection = new PrimitiveDrawable(listBoxSelectionColor, 5, 5), HoverSelection = new PrimitiveDrawable(listBoxHoverSelectionColor, 5, 5), Background = new PrimitiveDrawable(listBoxBackgroundColor) }; skin.Add("default", listBoxStyle); var selectBoxStyle = new SelectBoxStyle { ListStyle = listBoxStyle, ScrollStyle = scrollPaneStyle, Background = new PrimitiveDrawable(selectBoxBackgroundColor, 4, 4) }; skin.Add("default", selectBoxStyle); var textTooltipStyle = new TextTooltipStyle { LabelStyle = new LabelStyle(listBoxBackgroundColor), Background = new PrimitiveDrawable(checkboxOn, 4, 2) }; skin.Add("default", textTooltipStyle); return(skin); }
/// <summary> /// Processes Windows messages. /// </summary> /// <param name="m">The Message.</param> protected override void WndProc(ref Message m) { switch (m.Msg) { case 15: if (HideBar) { base.WndProc(ref m); } else { ProgressBarStyle style = Style; if (progressString == null) { progressString = Text; if (!HideBar && style != ProgressBarStyle.Marquee) { int range = Maximum - Minimum; int value = Value; if (m_booOptionalProgress) { progressString = String.Format("{0}% ({1}KB/s)", Maximum == 1 ? 0 : value, m_intOptionalValue); } else { if (range > 42949672) { value = (int)((uint)value >> 7); range = (int)((uint)range >> 7); } if (range > 0) { progressString = string.Format(progressString.Length == 0 ? "{0}KB" : "{1}: {0}", value.ToString() + "KB/" + range.ToString(), progressString); } } } } if (progressString.Length == 0) { base.WndProc(ref m); } else { using (Graphics g = CreateGraphics()) { base.WndProc(ref m); OnPaint(new PaintEventArgs(g, ClientRectangle)); } } } break; case 0x402: goto case 0x406; case 0x406: progressString = null; base.WndProc(ref m); break; default: base.WndProc(ref m); break; } }
public DataSchemaForm() { InitializeComponent(); defaultProgressBarStyle = progressBar.Style; }
private void RunFinalAction(out bool closeWizard) { FinalAction = null; closeWizard = false; // Override the WizardBase: try running the SR create/attach. If it succeeds, close the wizard. // Otherwise show the error and allow the user to adjust the settings and try again. Pool pool = Helpers.GetPoolOfOne(xenConnection); if (pool == null) { log.Error("New SR Wizard: Pool has disappeared"); using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.NEW_SR_CONNECTION_LOST, Helpers.GetName(xenConnection)), Messages.XENCENTER))) { dlg.ShowDialog(this); } closeWizard = true; return; } Host master = xenConnection.Resolve(pool.master); if (master == null) { log.Error("New SR Wizard: Master has disappeared"); using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.NEW_SR_CONNECTION_LOST, Helpers.GetName(xenConnection)), Messages.XENCENTER))) { dlg.ShowDialog(this); } closeWizard = true; return; } if (_srToReattach != null && _srToReattach.HasPBDs() && _srToReattach.Connection == xenConnection) { // Error - cannot reattach attached SR MessageBox.Show(this, String.Format(Messages.STORAGE_IN_USE, _srToReattach.Name(), Helpers.GetName(xenConnection)), Text, MessageBoxButtons.OK, MessageBoxIcon.Error); FinishCanceled(); return; } // show warning prompt if required if (!AskUserIfShouldContinue()) { FinishCanceled(); return; } List <AsyncAction> actionList = GetActions(master, m_srWizardType.DisasterRecoveryTask); if (actionList.Count == 1) { FinalAction = actionList[0]; } else { FinalAction = new ParallelAction(xenConnection, Messages.NEW_SR_WIZARD_FINAL_ACTION_TITLE, Messages.NEW_SR_WIZARD_FINAL_ACTION_START, Messages.NEW_SR_WIZARD_FINAL_ACTION_END, actionList); } // if this is a Disaster Recovery Task, it could be either a "Find existing SRs" or an "Attach SR needed for DR" case if (m_srWizardType.DisasterRecoveryTask) { closeWizard = true; return; } ProgressBarStyle progressBarStyle = FinalAction is SrIntroduceAction ? ProgressBarStyle.Blocks : ProgressBarStyle.Marquee; using (var dialog = new ActionProgressDialog(FinalAction, progressBarStyle) { ShowCancel = true }) { if (m_srWizardType is SrWizardType_Hba || m_srWizardType is SrWizardType_Fcoe) { ActionProgressDialog closureDialog = dialog; // close dialog even when there's an error for HBA SR type as there will be the Summary page displayed. FinalAction.Completed += s => Program.Invoke(Program.MainWindow, () => { if (closureDialog != null) { closureDialog.Close(); } }); } dialog.ShowDialog(this); } if (m_srWizardType is SrWizardType_Hba || m_srWizardType is SrWizardType_Fcoe) { foreach (var asyncAction in actionList) { AddActionToSummary(asyncAction); } } if (!FinalAction.Succeeded && FinalAction is SrReattachAction && _srToReattach.HasPBDs()) { // reattach failed. Ensure PBDs are now unplugged and destroyed. using (var dialog = new ActionProgressDialog(new SrAction(SrActionKind.UnplugAndDestroyPBDs, _srToReattach), progressBarStyle)) { dialog.ShowCancel = false; dialog.ShowDialog(); } } // If action failed and frontend wants to stay open, just return if (!FinalAction.Succeeded) { DialogResult = DialogResult.None; FinishCanceled(); if (m_srWizardType.AutoDescriptionRequired) { foreach (var srDescriptor in m_srWizardType.SrDescriptors) { srDescriptor.Description = null; } } return; } // Close wizard closeWizard = true; }
protected override void FinishWizard() { List <Dictionary <string, string> > listParam = new List <Dictionary <string, string> >(); List <Dictionary <string, List <string> > > listParamTemp = new List <Dictionary <string, List <string> > >(); BackupRestoreConfig.BrSchedule schedule = new BackupRestoreConfig.BrSchedule(); BackupRestoreConfig.Job job = new BackupRestoreConfig.Job(); string str_rules = ""; String str_job = ""; string str_command = ""; schedule.jobName = this.repJobSettingPage.JobNameText; job.job_name = this.repJobSettingPage.JobNameText; if (this.schedulePage.NowChecked) { str_command = "f"; schedule.scheduleType = 0; job.schedule_type = 0; schedule.scheduleDate = ""; } if (this.schedulePage.OnceChecked) { str_command = "y"; schedule.scheduleType = 1; job.schedule_type = 1; schedule.scheduleDate = this.schedulePage.StartDateText; schedule.scheduleTime = this.schedulePage.StartTimeText; } if (this.schedulePage.DailyChecked) { str_command = "a"; schedule.scheduleType = 2; job.schedule_type = 2; schedule.scheduleDate = this.schedulePage.StartDateText; schedule.scheduleTime = this.schedulePage.StartTimeText; schedule.recur = this.schedulePage.RecurText; } if (this.schedulePage.CircleChecked) { str_command = "u"; schedule.scheduleType = 4; job.schedule_type = 4; schedule.scheduleDate = this.schedulePage.StartDateText; schedule.scheduleTime = this.schedulePage.StartTimeText; schedule.recur = this.schedulePage.RecurText; } if (this.schedulePage.WeeklyChecked) { str_command = "z"; schedule.scheduleType = 3; job.schedule_type = 3; schedule.scheduleDate = this.schedulePage.StartDateText; schedule.scheduleTime = this.schedulePage.StartTimeText; schedule.recur = this.schedulePage.RecurText; List <int> listDays = new List <int>(); if (this.schedulePage.MondayChecked) { listDays.Add(1); } if (this.schedulePage.TuesdayChecked) { listDays.Add(2); } if (this.schedulePage.WednesdayChecked) { listDays.Add(3); } if (this.schedulePage.ThursdayChecked) { listDays.Add(4); } if (this.schedulePage.FridayChecked) { listDays.Add(5); } if (this.schedulePage.SaturdayChecked) { listDays.Add(6); } if (this.schedulePage.SundayChecked) { listDays.Add(0); } schedule.weeklyDays = listDays; } if (scheduleDetails != null && !scheduleDetails.Equals("")) { schedule.details = scheduleDetails; } else { schedule.details = this.repJobSettingPage.Choice_sr_ip + "|" + this.repJobSettingPage.DestUsernameText + "|" + this.repJobSettingPage.DestPasswordText + "|" + this.repJobSettingPage.VMNameText + "|" + this.repJobSettingPage.Choice_sr_uuid + "|0|" + this.repJobSettingPage.MacText + "|" + this.repJobSettingPage.NetworkValue + "|" + Helpers.GetMaster(this.repJobSettingPage.Selected_xenConnection).address + "|" + this.repJobSettingPage.Selected_xenConnection.Username + "|" + this.repJobSettingPage.Selected_xenConnection.Password + "|" + this.repJobSettingPage.Selected_host.uuid; } str_rules = HalsignUtil.ToJson(schedule); str_rules = str_rules.Replace("\\/", "/"); job.host = ""; job.key = "halsign_br_job_r"; job.request = str_command + this.repJobSettingPage.JobNameText.TrimEnd().TrimStart() + "|"; TimeSpan ts = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1, 0, 0, 0)); ts = new DateTime(this.schedulePage.StartDateValue.Year, this.schedulePage.StartDateValue.Month, this.schedulePage.StartDateValue.Day, this.schedulePage.StartTimeValue.Hour, this.schedulePage.StartTimeValue.Minute, this.schedulePage.StartTimeValue.Second).Subtract(new DateTime(1970, 1, 1, 0, 0, 0).ToLocalTime()); if (jobs != null) { jobs.request = str_command + jobs.request.Substring(1, jobs.request.Length - 1); jobs.schedule_type = job.schedule_type; str_job = HalsignUtil.ToJson(jobs); } else { job.start_time = ""; job.progress = -1; job.total_storage = -1; job.modify_time = ""; job.pid = -1; job.retry = -1; job.speed = -1; job.status = 0; job.current_full_count = 0; job.expect_full_count = 0;//this.scheduleBackupPage.IsFullBackup ? 0 : (this.scheduleBackupPage._expectFullCheckBox ? this.scheduleBackupPage._expectFullCountTextBox : 0); str_job = HalsignUtil.ToJson(job); } //string a = this.repJobSettingPage.Selected_xenConnection.Hostname; Dictionary <string, string> _dconf = new Dictionary <string, string>(); _dconf.Add("command", str_command); _dconf.Add("is_now", this.schedulePage.NowChecked.ToString()); _dconf.Add("replication_rules", str_rules); _dconf.Add("replication_job", str_job); if (jobs != null) { _dconf.Add("replication_editjob", "true"); } else { _dconf.Add("replication_editjob", "false"); } foreach (VM item in this.repChoseVmPage.VmCheckedList) { Dictionary <string, string> _dconf_param = new Dictionary <string, string>(); Dictionary <string, List <string> > _dconf_param_temp = new Dictionary <string, List <string> >(); string host_ip = " "; if (!HalsignHelpers.VMHome(item).address.Equals(this.repJobSettingPage.Choice_sr_ip)) { host_ip = this.repJobSettingPage.Choice_sr_ip; } List <string> syncCheckedList = new List <string>(); foreach (Dictionary <string, string> dRepChecked in this.synchronizationPage.RepCheckedList) { if (dRepChecked.ContainsKey(item.uuid)) { string request_expend = ""; if (this.repChoseVmPage.vdi_expand_list.ContainsKey(item.uuid)) { int vdiNo = 0; foreach (VBD vbd in item.Connection.ResolveAll <VBD>(item.VBDs)) { if (HalsignHelpers.IsCDROM(vbd)) { continue; } if (vbd.type.Equals(XenAPI.vbd_type.Disk)) { vdiNo++; } } if (vdiNo == this.repChoseVmPage.vdi_expand_list[item.uuid].Split('@').Length) { request_expend = "|" + "halsign_vdi_all"; } else { request_expend = "|" + this.repChoseVmPage.vdi_expand_list[item.uuid]; } } if ("new".Equals(dRepChecked[item.uuid])) { syncCheckedList.Add(this.repJobSettingPage.JobNameText + "|" + item.uuid + "|" + host_ip + "|" + this.repJobSettingPage.DestUsernameText + "|" + this.repJobSettingPage.DestPasswordText + "|" + this.repJobSettingPage.VMNameText + "|" + this.repJobSettingPage.Choice_sr_uuid + "|0|" + this.repJobSettingPage.MacText + "|" + this.repJobSettingPage.NetworkValue + "|" + Helpers.GetMaster(this.repJobSettingPage.Selected_xenConnection).address + "|" + this.repJobSettingPage.Selected_xenConnection.Username + "|" + this.repJobSettingPage.Selected_xenConnection.Password + "|" + this.repJobSettingPage.Selected_host.uuid + request_expend); } else { syncCheckedList.Add(this.repJobSettingPage.JobNameText + "|" + item.uuid + "|" + host_ip + "|" + this.repJobSettingPage.DestUsernameText + "|" + this.repJobSettingPage.DestPasswordText + "|" + dRepChecked[item.uuid] + "|" + Helpers.GetMaster(this.repJobSettingPage.Selected_xenConnection).address + "|" + this.repJobSettingPage.Selected_xenConnection.Username + "|" + this.repJobSettingPage.Selected_xenConnection.Password + request_expend); } } } _dconf_param_temp.Add(item.uuid, syncCheckedList); listParamTemp.Add(_dconf_param_temp); } BackupAction action = new BackupAction(Messages.COPY_VM, BackupRestoreConfig.BackupActionKind.Replication, this._xenModelObject, this.repChoseVmPage.VmCheckedList, _dconf, listParamTemp, this.repChoseVmPage.vdi_expand_list); if (action != null) { ProgressBarStyle progressBarStyle = ProgressBarStyle.Marquee; ActionProgressDialog dialog = new ActionProgressDialog(action, progressBarStyle); dialog.ShowCancel = false; dialog.ShowDialog(this); if (!action.Succeeded || !string.IsNullOrEmpty(action.Result)) { base.FinishCanceled(); //Program.MainWindow.BringToFront(); //e.PageIndex = e.PageIndex - 1; } else { base.FinishWizard(); } if (!(this._xenModelObject is Host)) { // todo Program.MainWindow.SwitchToTab(MainWindow.Tab.BR); if (this._xenModelObject is VM) { VM vm = this._xenModelObject as VM; vm.NotifyPropertyChanged("other_config"); } } } }
private void setProgressBarParms(ProgressBarStyle style, bool visible) { this.toolStripProgressBar1.Style = style; this.toolStripProgressBar1.Visible = visible; this.toolStripProgressBar1.Value = 0; }
/// <summary> /// Show the progress dialog to to the user. /// </summary> /// <param name="task">The <see cref="BackgroundTask"/> to execute.</param> /// <param name="desktopWindow">Desktop window that parents the progress dialog.</param> /// <param name="autoClose">Close the progress dialog after task completion.</param> /// <param name="progressBarStyle">The style of the progress bar.</param> public static void Show(BackgroundTask task, IDesktopWindow desktopWindow, bool autoClose = true, ProgressBarStyle progressBarStyle = ProgressBarStyle.Blocks, string startProgressMessage = null) { // as the progress dialog involves UI, the task should *always* be run under the application UI culture task.ThreadUICulture = Application.CurrentUICulture; var progressComponent = new ProgressDialogComponent(task, autoClose, progressBarStyle, startProgressMessage); ApplicationComponentExitCode result = ApplicationComponent.LaunchAsDialog( desktopWindow, progressComponent, Application.Name); if (result == ApplicationComponentExitCode.Error) { throw progressComponent.TaskException; } }
public static void SetProgressBarStyle(ProgressBar progressBar, ProgressBarStyle value) { progressBar.SetValue(ProgressBarStyleProperty, value); }
public void ProgressStyle(ProgressBarStyle value) { if (InvokeRequired) { this.Invoke(new Action<ProgressBarStyle>(ProgressStyle), new object[] { value }); return; } progressBar1.Style = value; }
/// <summary> /// Open and displays the task form. /// </summary> /// <param name="Parent">The calling form, so the task form can be centered</param> /// <param name="WindowTitle">The task dialog window title</param> /// <param name="InstructionText">Instruction text displayed after the info icon. Leave null /// to hide the instruction text and icon.</param> /// <param name="SubMessage">Detail text that is displayed just above the progress bar</param> /// <param name="Cancelable">Specifies whether the operation can be canceled</param> /// <param name="Style">The progress bar style</param> /// <exception cref="Exception">Thrown if the Task form is already open and running. Use the IsOpen property /// to determine if the form is already running</exception> public static void Show(Form Parent, string WindowTitle, string InstructionText, string SubMessage, bool Cancelable, ProgressBarStyle Style, int ProgressBarSteps) { // Make sure we dont have an already active form if (Instance != null && !Instance.IsDisposed) { throw new Exception("Task Form is already being displayed!"); } // Create new instance Instance = new TaskForm(); Instance.Text = WindowTitle; Instance.labelInstructionText.Text = InstructionText; Instance.labelContent.Text = SubMessage; Instance.Cancelable = Cancelable; Instance.progressBar.Style = Style; // Setup progress bar if (ProgressBarSteps > 0) { Instance.progressBar.Maximum = ProgressBarSteps; } // Hide Instruction panel if Instruction Text is empty if (String.IsNullOrWhiteSpace(InstructionText)) { Instance.panelMain.Hide(); Instance.labelContent.Location = new Point(10, 15); Instance.labelContent.MaximumSize = new Size(410, 0); Instance.labelContent.Size = new Size(410, 0); Instance.progressBar.Location = new Point(10, 1); Instance.progressBar.Size = new Size(410, 18); } // Hide Cancel if (!Cancelable) { Instance.panelButton.Hide(); Instance.Padding = new Padding(0, 0, 0, 15); Instance.BackColor = Color.White; } // Set window position to center parent double H = Parent.Location.Y + (Parent.Height / 2) - (Instance.Height / 2); double W = Parent.Location.X + (Parent.Width / 2) - (Instance.Width / 2); Instance.Location = new Point((int)Math.Round(W, 0), (int)Math.Round(H, 0)); // Display the Instanced Form Instance.Show(Parent); // Wait until the Instance form is displayed while (!Instance.IsHandleCreated) { Thread.Sleep(50); } }
public ActionProgressDialog(AsyncAction action, ProgressBarStyle progressBarStyle, bool showTryAgain) : this(action, progressBarStyle) { this.showTryAgain = showTryAgain; }
private void SetStyle(ProgressBarStyle s) { try { m_pbProgress.Style = s; } catch (Exception) { Debug.Assert(false); } }
public FormAsyncProgressBar(Action <BackgroundWorker> method, string taskName, ProgressBarStyle style) { InitializeComponent(); InitForm(method, taskName, style); }
public void setProgressStyle(ProgressBarStyle style) { pgbProgress.Style = style; }
public void SetProgressBarSettings(int minimum, int maximum, int step, ProgressBarStyle style) { this.Invoke(new SetProgressBarSettings_Delegate(SetProgressBarSettings_Internal), minimum, maximum, step, style); }
public ProgressBarStyle(ProgressBarStyle style) : base(style) { Filler = style.Filler; }
private void SetToolStripProgressBarStyle(ToolStripProgressBar toolStripProgressBar, ProgressBarStyle style) { if(toolStripProgressBar.GetCurrentParent().InvokeRequired) { toolStripProgressBar.GetCurrentParent().Invoke(new Action<ToolStripProgressBar, ProgressBarStyle>(SetToolStripProgressBarStyle), new object[] { toolStripProgressBar, style }); } else { toolStripProgressBar.Style = style; } }
public BackgoundTask RegisterBackgroundTask(string name, Image image, ProgressBarStyle progressStyle, int progressValue) { Debug.AssertNotNull(name, "Name is null"); BackgoundTask task = new BackgoundTask(); task.Name = name; task.Image = image; task.ProgressStyle = progressStyle; task.ProgressValue = progressValue; task.OnProgressChanged += OnBackgroundTaskProgressChanged; task.OnStopped += OnBackgroundTaskStopped; backgoundTasks.Add(task); ToolStripMenuItem menuItem = new ToolStripMenuItem(task.Name, task.Image, OnBackgroundTaskChanged); menuItem.Tag = task; TaskList.DropDownItems.Add(menuItem); task.AttachedControls.Add(new KeyValuePair<ToolStripMenuItem, ToolStripDropDownItem>(menuItem, TaskList)); ToolStripMenuItem stopMenuItem = new ToolStripMenuItem("Stop " + task.Name, task.Image, OnBackgroundTaskStop); stopMenuItem.Tag = task; TaskStopList.DropDownItems.Add(stopMenuItem); task.AttachedControls.Add(new KeyValuePair<ToolStripMenuItem, ToolStripDropDownItem>(stopMenuItem, TaskStopList)); OnBackgroundTaskChanged(task, null); return task; }
public static void SetProgressBarStyle(DependencyObject obj, ProgressBarStyle value) { obj.SetValue(ProgressBarStyleProperty, value); }
public void setDownloadBarStyle(ProgressBarStyle style) { downloadBar.Style = style; }
public static ProgressBar ProgressBar(ProgressBarSpec spec = null, int value = 0, ProgressBarStyle style = null) { return(new ProgressBar(spec, value, style)); }
/// <summary> /// Open and displays the task form. /// </summary> /// <param name="Parent">The calling form, so the task form can be centered</param> /// <param name="WindowTitle">The task dialog window title</param> /// <param name="InstructionText">Instruction text displayed after the info icon. Leave null /// to hide the instruction text and icon.</param> /// <param name="SubMessage">Detail text that is displayed just above the progress bar</param> /// <param name="Cancelable">Specifies whether the operation can be canceled</param> /// <param name="Style">The progress bar style</param> /// <exception cref="Exception">Thrown if the Task form is already open and running. Use the IsOpen property /// to determine if the form is already running</exception> public static void Show(Form Parent, string WindowTitle, string InstructionText, string SubMessage, bool Cancelable, ProgressBarStyle Style, int ProgressBarSteps) { // Make sure we dont have an already active form if (Instance != null && !Instance.IsDisposed) throw new Exception("Task Form is already being displayed!"); // Create new instance Instance = new TaskForm(); Instance.Text = WindowTitle; Instance.labelInstructionText.Text = InstructionText; Instance.labelContent.Text = SubMessage; Instance.Cancelable = Cancelable; Instance.progressBar.Style = Style; // Setup progress bar if (ProgressBarSteps > 0) { double Percent = (100 / ProgressBarSteps); Instance.progressBar.Step = (int)Math.Round(Percent, 0); Instance.progressBar.Maximum = Instance.progressBar.Step * ProgressBarSteps; } // Hide Instruction panel if Instruction Text is empty if (String.IsNullOrWhiteSpace(InstructionText)) { Instance.panelMain.Hide(); Instance.labelContent.Location = new Point(10, 15); Instance.labelContent.MaximumSize = new Size(410, 0); Instance.labelContent.Size = new Size(410, 0); Instance.progressBar.Location = new Point(10, 1); Instance.progressBar.Size = new Size(410, 18); } // Hide Cancel if (!Cancelable) { Instance.panelButton.Hide(); Instance.Padding = new Padding(0, 0, 0, 15); Instance.BackColor = Color.White; } // Set window position to center parent double H = Parent.Location.Y + (Parent.Height / 2) - (Instance.Height / 2); double W = Parent.Location.X + (Parent.Width / 2) - (Instance.Width / 2); Instance.Location = new Point((int)Math.Round(W, 0), (int)Math.Round(H, 0)); // Run form in a new thread Thread thread = new Thread(new ThreadStart(ShowForm)); thread.IsBackground = true; thread.SetApartmentState(ApartmentState.STA); thread.Start(); Thread.Sleep(100); // Wait for Run to work }
/// <summary> /// Sets the progress bar style. /// </summary> /// <param name="style">The style.</param> public void SetStyle(ProgressBarStyle style) { this.progressBar.Style = style; }
public PushProgressbarCommand() { mStyle = ProgressBarStyle.Blocks; }
public void SetProgressStyle(ProgressBarStyle style) { this.progressBarGenerate.Style = style; }
public PushProgressbarCommand(ProgressBarStyle style) { mStyle = style; }
/// <summary> /// Metod f�r att �ndra en progressbars style p� ett /// tr�ds�kert s�tt. /// /// /// </summary> /// <param name="progressBarStyle"></param> private void SetProgressBarStyle(ProgressBarStyle progressBarStyle) { if (this.statusProgressBar.ProgressBar.InvokeRequired) { this.statusProgressBar.ProgressBar.Invoke(new SetProgressStyleCallback(SetProgressBarStyle), new object[] { progressBarStyle }); } else { this.statusProgressBar.ProgressBar.Style = progressBarStyle; } }