mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11:27 -07:00
Minor refactoring of VistaDialog
This commit is contained in:
parent
d2557b4be5
commit
1805e31f86
@ -469,8 +469,6 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dialog?.ShowSuccess($"{App.ProjectName} has succesfully uninstalled");
|
Dialog?.ShowSuccess($"{App.ProjectName} has succesfully uninstalled");
|
||||||
|
|
||||||
App.Terminate();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -86,14 +86,10 @@ namespace Bloxstrap.Dialogs
|
|||||||
public virtual void CloseBootstrapper()
|
public virtual void CloseBootstrapper()
|
||||||
{
|
{
|
||||||
if (this.InvokeRequired)
|
if (this.InvokeRequired)
|
||||||
{
|
|
||||||
this.Invoke(CloseBootstrapper);
|
this.Invoke(CloseBootstrapper);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void ShowSuccess(string message)
|
public virtual void ShowSuccess(string message)
|
||||||
{
|
{
|
||||||
|
@ -13,58 +13,54 @@ namespace Bloxstrap.Dialogs
|
|||||||
|
|
||||||
public partial class VistaDialog : BootstrapperDialogForm
|
public partial class VistaDialog : BootstrapperDialogForm
|
||||||
{
|
{
|
||||||
private TaskDialogPage Dialog;
|
private TaskDialogPage _dialogPage;
|
||||||
|
|
||||||
protected override string _message
|
protected sealed override string _message
|
||||||
{
|
{
|
||||||
get => Dialog.Heading ?? "";
|
get => _dialogPage.Heading ?? "";
|
||||||
set => Dialog.Heading = value;
|
set => _dialogPage.Heading = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ProgressBarStyle _progressStyle
|
protected sealed override ProgressBarStyle _progressStyle
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Dialog.ProgressBar is null)
|
if (_dialogPage.ProgressBar is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (value)
|
_dialogPage.ProgressBar.State = value switch
|
||||||
{
|
{
|
||||||
case ProgressBarStyle.Continuous:
|
ProgressBarStyle.Continuous => TaskDialogProgressBarState.Normal,
|
||||||
case ProgressBarStyle.Blocks:
|
ProgressBarStyle.Blocks => TaskDialogProgressBarState.Normal,
|
||||||
Dialog.ProgressBar.State = TaskDialogProgressBarState.Normal;
|
ProgressBarStyle.Marquee => TaskDialogProgressBarState.Marquee,
|
||||||
break;
|
_ => _dialogPage.ProgressBar.State
|
||||||
|
};
|
||||||
case ProgressBarStyle.Marquee:
|
|
||||||
Dialog.ProgressBar.State = TaskDialogProgressBarState.Marquee;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override int _progressValue
|
protected sealed override int _progressValue
|
||||||
{
|
{
|
||||||
get => Dialog.ProgressBar is null ? 0 : Dialog.ProgressBar.Value;
|
get => _dialogPage.ProgressBar?.Value ?? 0;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Dialog.ProgressBar is null)
|
if (_dialogPage.ProgressBar is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dialog.ProgressBar.Value = value;
|
_dialogPage.ProgressBar.Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool _cancelEnabled
|
protected sealed override bool _cancelEnabled
|
||||||
{
|
{
|
||||||
get => Dialog.Buttons[0].Enabled;
|
get => _dialogPage.Buttons[0].Enabled;
|
||||||
set => Dialog.Buttons[0].Enabled = value;
|
set => _dialogPage.Buttons[0].Enabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VistaDialog()
|
public VistaDialog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Dialog = new TaskDialogPage()
|
_dialogPage = new TaskDialogPage()
|
||||||
{
|
{
|
||||||
Icon = new TaskDialogIcon(App.Settings.Prop.BootstrapperIcon.GetIcon()),
|
Icon = new TaskDialogIcon(App.Settings.Prop.BootstrapperIcon.GetIcon()),
|
||||||
Caption = App.ProjectName,
|
Caption = App.ProjectName,
|
||||||
@ -79,7 +75,7 @@ namespace Bloxstrap.Dialogs
|
|||||||
_message = "Please wait...";
|
_message = "Please wait...";
|
||||||
_cancelEnabled = false;
|
_cancelEnabled = false;
|
||||||
|
|
||||||
Dialog.Buttons[0].Click += (sender, e) => ButtonCancel_Click(sender, e);
|
_dialogPage.Buttons[0].Click += ButtonCancel_Click;
|
||||||
|
|
||||||
SetupDialog();
|
SetupDialog();
|
||||||
}
|
}
|
||||||
@ -100,10 +96,10 @@ namespace Bloxstrap.Dialogs
|
|||||||
Buttons = { TaskDialogButton.OK }
|
Buttons = { TaskDialogButton.OK }
|
||||||
};
|
};
|
||||||
|
|
||||||
successDialog.Buttons[0].Click += (sender, e) => App.Terminate();
|
successDialog.Buttons[0].Click += (_, _) => App.Terminate();
|
||||||
|
|
||||||
Dialog.Navigate(successDialog);
|
_dialogPage.Navigate(successDialog);
|
||||||
Dialog = successDialog;
|
_dialogPage = successDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,9 +128,8 @@ namespace Bloxstrap.Dialogs
|
|||||||
|
|
||||||
errorDialog.Buttons[0].Click += (sender, e) => App.Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
|
errorDialog.Buttons[0].Click += (sender, e) => App.Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
|
||||||
|
|
||||||
Dialog.Navigate(errorDialog);
|
_dialogPage.Navigate(errorDialog);
|
||||||
|
_dialogPage = errorDialog;
|
||||||
Dialog = errorDialog;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,15 +141,12 @@ namespace Bloxstrap.Dialogs
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dialog.BoundDialog?.Close();
|
_dialogPage.BoundDialog?.Close();
|
||||||
base.CloseBootstrapper();
|
base.CloseBootstrapper();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void VistaDialog_Load(object sender, EventArgs e)
|
private void VistaDialog_Load(object sender, EventArgs e) => TaskDialog.ShowDialog(_dialogPage);
|
||||||
{
|
|
||||||
TaskDialog.ShowDialog(Dialog);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user