Bound UI Enabled
This commit is contained in:
parent
22f7143d6e
commit
4e4a59b0b2
3 changed files with 36 additions and 17 deletions
|
|
@ -50,9 +50,22 @@ namespace ImageCatalog_2
|
|||
}
|
||||
}
|
||||
|
||||
private bool _uiEnabled = true;
|
||||
|
||||
public bool UiEnabled
|
||||
{
|
||||
get { return _uiEnabled; }
|
||||
set
|
||||
{
|
||||
_uiEnabled = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void Test(object parameter)
|
||||
{
|
||||
Debug.WriteLine("Yep");
|
||||
this.UiEnabled = !this.UiEnabled;
|
||||
}
|
||||
|
||||
private async Task TestAsync()
|
||||
|
|
|
|||
22
imagecatalog/MainForm.Designer.cs
generated
22
imagecatalog/MainForm.Designer.cs
generated
|
|
@ -44,9 +44,9 @@ namespace ImageCatalog
|
|||
TabControl1 = new TabControl();
|
||||
TabPage5 = new TabPage();
|
||||
button1 = new Button();
|
||||
btnTest = new Button();
|
||||
bindingSource1 = new BindingSource(components);
|
||||
dataModelBindingSource = new BindingSource(components);
|
||||
btnTest = new Button();
|
||||
GroupBox11 = new GroupBox();
|
||||
Panel3 = new Panel();
|
||||
rdbNuovoMetodo = new RadioButton();
|
||||
|
|
@ -246,6 +246,7 @@ namespace ImageCatalog
|
|||
TabControl1.Controls.Add(TabPage2);
|
||||
TabControl1.Controls.Add(TabPage1);
|
||||
TabControl1.Controls.Add(TabPage4);
|
||||
TabControl1.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true));
|
||||
TabControl1.Location = new Point(16, 18);
|
||||
TabControl1.Margin = new Padding(4, 5, 4, 5);
|
||||
TabControl1.Name = "TabControl1";
|
||||
|
|
@ -280,6 +281,14 @@ namespace ImageCatalog
|
|||
button1.Text = "Test Async";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// bindingSource1
|
||||
//
|
||||
bindingSource1.DataSource = dataModelBindingSource;
|
||||
//
|
||||
// dataModelBindingSource
|
||||
//
|
||||
dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel);
|
||||
//
|
||||
// btnTest
|
||||
//
|
||||
btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true));
|
||||
|
|
@ -290,14 +299,6 @@ namespace ImageCatalog
|
|||
btnTest.Text = "Test";
|
||||
btnTest.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// bindingSource1
|
||||
//
|
||||
bindingSource1.DataSource = dataModelBindingSource;
|
||||
//
|
||||
// dataModelBindingSource
|
||||
//
|
||||
dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel);
|
||||
//
|
||||
// GroupBox11
|
||||
//
|
||||
GroupBox11.Controls.Add(Panel3);
|
||||
|
|
@ -1703,6 +1704,7 @@ namespace ImageCatalog
|
|||
//
|
||||
// _Button5
|
||||
//
|
||||
_Button5.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true));
|
||||
_Button5.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0);
|
||||
_Button5.Location = new Point(719, 66);
|
||||
_Button5.Margin = new Padding(4, 5, 4, 5);
|
||||
|
|
@ -1768,6 +1770,7 @@ namespace ImageCatalog
|
|||
//
|
||||
// _Button6
|
||||
//
|
||||
_Button6.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true));
|
||||
_Button6.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0);
|
||||
_Button6.Location = new Point(719, 18);
|
||||
_Button6.Margin = new Padding(4, 5, 4, 5);
|
||||
|
|
@ -1779,6 +1782,7 @@ namespace ImageCatalog
|
|||
//
|
||||
// _btnCreaCatalogoAsync
|
||||
//
|
||||
_btnCreaCatalogoAsync.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true));
|
||||
_btnCreaCatalogoAsync.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
|
||||
_btnCreaCatalogoAsync.Location = new Point(719, 120);
|
||||
_btnCreaCatalogoAsync.Margin = new Padding(4, 5, 4, 5);
|
||||
|
|
|
|||
|
|
@ -221,18 +221,20 @@ namespace ImageCatalog
|
|||
|
||||
private void lockUI()
|
||||
{
|
||||
TabControl1.Enabled = false;
|
||||
Button5.Enabled = false;
|
||||
Button6.Enabled = false;
|
||||
btnCreaCatalogoAsync.Enabled = false;
|
||||
Model.UiEnabled = false;
|
||||
//TabControl1.Enabled = false;
|
||||
//Button5.Enabled = false;
|
||||
//Button6.Enabled = false;
|
||||
//btnCreaCatalogoAsync.Enabled = false;
|
||||
}
|
||||
|
||||
private void unlockUI()
|
||||
{
|
||||
TabControl1.Enabled = true;
|
||||
Button5.Enabled = true;
|
||||
Button6.Enabled = true;
|
||||
btnCreaCatalogoAsync.Enabled = true;
|
||||
Model.UiEnabled = true;
|
||||
//TabControl1.Enabled = true;
|
||||
//Button5.Enabled = true;
|
||||
//Button6.Enabled = true;
|
||||
//btnCreaCatalogoAsync.Enabled = true;
|
||||
}
|
||||
|
||||
private void btnCreaCatalogo_Click(object sender, EventArgs e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue