cec-config-gui: make overriding the physical address optional
[deb_libcec.git] / src / cec-config-gui / AsyncForm.cs
index 4584d755c79a595ea2c4989add5ce2595fe29178..5898ce54be44112ecfc4da1341c7f930bd2fb6a6 100644 (file)
@@ -59,6 +59,24 @@ namespace CecConfigGui
       }
     }
 
+    delegate void SetCheckboxItemCheckedCallback(CheckedListBox control, int index, bool val);
+    public void SetCheckboxItemChecked(CheckedListBox control, int index, bool val)
+    {
+      if (control.InvokeRequired)
+      {
+        SetCheckboxItemCheckedCallback d = new SetCheckboxItemCheckedCallback(SetCheckboxItemChecked);
+        try
+        {
+          this.Invoke(d, new object[] { control, index, val });
+        }
+        catch (Exception) { }
+      }
+      else
+      {
+        control.SetItemChecked(index, val);
+      }
+    }
+
     delegate void SetProgressValueCallback(ProgressBar control, int val);
     public void SetProgressValue(ProgressBar control, int val)
     {
@@ -114,5 +132,26 @@ namespace CecConfigGui
         control.Visible = val;
       }
     }
+
+    delegate void DisplayDialogCallback(Form control, bool modal);
+    public void DisplayDialog(Form control, bool modal)
+    {
+      if (this.InvokeRequired)
+      {
+        DisplayDialogCallback d = new DisplayDialogCallback(DisplayDialog);
+        try
+        {
+          this.Invoke(d, new object[] { control, modal });
+        }
+        catch (Exception) { }
+      }
+      else
+      {
+        if (modal)
+          control.ShowDialog(this);
+        else
+          control.Show(this);
+      }
+    }
   }
 }