コード例 #1
0
ファイル: CecConfigGUI.cs プロジェクト: bramp/libcec
        public CecConfigGUI()
        {
            Config = new LibCECConfiguration();
              Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
              Config.DeviceName = "CEC Config";
              Config.GetSettingsFromROM = true;
              Config.ClientVersion = CecClientVersion.Version1_5_1;
              Callbacks = new CecCallbackWrapper(this);
              Config.SetCallbacks(Callbacks);
              LoadXMLConfiguration(ref Config);
              Lib = new LibCecSharp(Config);

              InitializeComponent();
              LoadButtonConfiguration();

              ActiveProcess = new ConnectToDevice(ref Lib, Config);
              ActiveProcess.EventHandler += ProcessEventHandler;
              (new Thread(ActiveProcess.Run)).Start();
        }
コード例 #2
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 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;
       }
 }
コード例 #3
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 private void bRescanDevices_Click(object sender, EventArgs e)
 {
     if (!SuppressUpdates && ActiveProcess == null)
       {
     SetControlsEnabled(false);
     ActiveProcess = new RescanDevices(ref Lib);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }
コード例 #4
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 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();
       }
 }
コード例 #5
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 public void UpdateConfigurationAsync()
 {
     if (!SuppressUpdates && ActiveProcess == null)
       {
     SetControlsEnabled(false);
     ActiveProcess = new UpdateConfiguration(ref Lib, Config);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }
コード例 #6
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 public void ShowDeviceInfo(CecLogicalAddress address)
 {
     if (!SuppressUpdates && ActiveProcess == null)
       {
     SetControlsEnabled(false);
     ActiveProcess = new ShowDeviceInfo(this, ref Lib, address);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }
コード例 #7
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 public void SetPhysicalAddress(ushort physicalAddress)
 {
     if (!SuppressUpdates && ActiveProcess == null && cbOverrideAddress.Checked)
       {
     SetControlsEnabled(false);
     SetControlText(cbPortNumber, string.Empty);
     SetControlText(cbConnectedDevice, string.Empty);
     ActiveProcess = new UpdatePhysicalAddress(ref Lib, physicalAddress);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }
コード例 #8
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 public void SetConnectedDevice(CecLogicalAddress address, int portnumber)
 {
     if (!SuppressUpdates && ActiveProcess == null)
       {
     SetControlsEnabled(false);
     ActiveProcess = new UpdateConnectedDevice(ref Lib, address, portnumber);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }
コード例 #9
0
ファイル: CecConfigGUI.cs プロジェクト: behaviour/libcec
 public void SendImageViewOn(CecLogicalAddress address)
 {
     if (!SuppressUpdates && ActiveProcess == null)
       {
     SetControlsEnabled(false);
     ActiveProcess = new SendImageViewOn(ref Lib, address);
     ActiveProcess.EventHandler += ProcessEventHandler;
     (new Thread(ActiveProcess.Run)).Start();
       }
 }