Esempio n. 1
0
 private void ProcessEventHandler(object src, UpdateEvent updateEvent)
 {
     switch (updateEvent.Type)
       {
     case UpdateEventType.StatusText:
       SetControlText(lStatus, updateEvent.StringValue);
       break;
     case UpdateEventType.PhysicalAddress:
       Config.PhysicalAddress = (ushort)updateEvent.IntValue;
       SetControlText(tbPhysicalAddress, string.Format("{0,4:X}", updateEvent.IntValue));
       break;
     case UpdateEventType.ProgressBar:
       SetControlVisible(pProgress, true);
       SetProgressValue(pProgress, updateEvent.IntValue);
       break;
     case UpdateEventType.TVVendorId:
       TVVendor = (CecVendorId)updateEvent.IntValue;
       UpdateSelectedDevice();
       break;
     case UpdateEventType.BaseDevicePhysicalAddress:
       SetControlText(lConnectedPhysicalAddress, string.Format("Address: {0,4:X}", updateEvent.IntValue));
       break;
     case UpdateEventType.BaseDevice:
       Config.BaseDevice = (CecLogicalAddress)updateEvent.IntValue;
       break;
     case UpdateEventType.HDMIPort:
       Config.HDMIPort = (byte)updateEvent.IntValue;
       break;
     case UpdateEventType.MenuLanguage:
       SetControlText(cbUseTVMenuLanguage, "Use the TV's language setting" + (updateEvent.StringValue.Length > 0 ? " (" + updateEvent.StringValue + ")" : ""));
       break;
     case UpdateEventType.HasAVRDevice:
       if (HasAVRDevice != updateEvent.BoolValue)
       {
     HasAVRDevice = updateEvent.BoolValue;
     UpdateSelectedDevice();
       }
       break;
     case UpdateEventType.AVRVendorId:
       AVRVendor = (CecVendorId)updateEvent.IntValue;
       UpdateSelectedDevice();
       break;
     case UpdateEventType.Configuration:
       SuppressUpdates = true;
       ConfigurationChanged(updateEvent.ConfigValue);
       SuppressUpdates = false;
       break;
     case UpdateEventType.PollDevices:
       CheckActiveDevices();
       break;
     case UpdateEventType.ProcessCompleted:
       ActiveProcess = null;
       SetControlsEnabled(true);
       if (UpdatingInfoPanel != null)
       {
     UpdatingInfoPanel.SetControlEnabled(UpdatingInfoPanel.bUpdate, true);
     UpdatingInfoPanel = null;
       }
       SetControlVisible(pProgress, false);
       break;
     case UpdateEventType.ExitApplication:
       ActiveProcess = null;
       SetControlsEnabled(false);
       SetControlVisible(pProgress, false);
       Application.Exit();
       break;
       }
 }
Esempio n. 2
0
 public void UpdateInfoPanel(DeviceInformation panel)
 {
     if (!SuppressUpdates && ActiveProcess == null)
       {
     SetControlsEnabled(false);
     UpdatingInfoPanel = panel;
     panel.SetControlEnabled(panel.bUpdate, false);
     ActiveProcess = new UpdateDeviceInfo(this, ref Lib, panel);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }