Ejemplo n.º 1
0
 private void ApplyProgress(JukeboxDevice aJukeboxDevice, bool aComplete)
 {
     if (this.InvokeRequired)
     {
         // no need to block
         this.BeginInvoke(new DEventProgress(ApplyProgress), new object[] { aJukeboxDevice, aComplete });
         return;
     }
     if (aComplete)
     {
         buttonDone.Text              = "Done";
         buttonApply.Enabled          = true;
         buttonSelectAll.Enabled      = true;
         buttonSelectNone.Enabled     = true;
         deviceCheckedListBox.Enabled = true;
     }
     else if (aJukeboxDevice != null)
     {
         deviceCheckedListBox.SetItemCheckState(aJukeboxDevice.Index, CheckState.Indeterminate);
         if (aJukeboxDevice.Index == deviceCheckedListBox.SelectedIndex)
         {
             buttonTest.Enabled = true;
         }
     }
 }
Ejemplo n.º 2
0
        private void buttonApply_Click(object sender, EventArgs e)
        {
            buttonDone.Text              = "Cancel";
            buttonApply.Enabled          = false;
            buttonSelectAll.Enabled      = false;
            buttonSelectNone.Enabled     = false;
            deviceCheckedListBox.Enabled = false;
            buttonTest.Enabled           = false;
            List <JukeboxDevice> jbDevices = new List <JukeboxDevice>();

            for (int i = 0; i < deviceCheckedListBox.Items.Count; i++)
            {
                if (deviceCheckedListBox.GetItemChecked(i) && deviceCheckedListBox.GetItemCheckState(i) != CheckState.Indeterminate)
                {
                    JukeboxDevice jbDevice = (JukeboxDevice)deviceCheckedListBox.Items[i];
                    jbDevice.Index = i;
                    jbDevices.Add(jbDevice);
                }
            }

            iApplyThread              = new Thread(Apply);
            iApplyThread.Name         = "ApplyPresetPrefix";
            iApplyThread.IsBackground = true;
            iApplyThread.Start(jbDevices);
        }
Ejemplo n.º 3
0
 private void TestProgress(JukeboxDevice aJukeboxDevice, bool aComplete)
 {
     if (this.InvokeRequired)
     {
         // no need to block
         this.BeginInvoke(new DEventProgress(TestProgress), new object[] { aJukeboxDevice, aComplete });
         return;
     }
     if (aComplete)
     {
         buttonDone.Text              = "Done";
         buttonTest.Enabled           = true;
         buttonApply.Enabled          = true;
         buttonSelectAll.Enabled      = true;
         buttonSelectNone.Enabled     = true;
         deviceCheckedListBox.Enabled = true;
     }
 }
Ejemplo n.º 4
0
 private void DeviceAlive(object obj, DeviceList.EventArgsDevice e)
 {
     try {
         if (this.InvokeRequired)
         {
             this.BeginInvoke((MethodInvoker) delegate() { DeviceAlive(obj, e); });
         }
         else
         {
             if (e.Device.Name != null && e.Device.Name != "")
             {
                 JukeboxDevice jd    = new JukeboxDevice(e.Device, iPresetUri);
                 int           index = deviceCheckedListBox.Items.Add(jd);
                 if (jd.PresetUriMatch)
                 {
                     deviceCheckedListBox.SetItemCheckState(index, CheckState.Indeterminate);
                 }
             }
         }
     }
     catch (Exception) {
     }
 }