public WinLIRCMappingEditorForm(Settings settings) { InitializeComponent(); this.settings = settings; this.winLIRCcommandMapping = new Hashtable(this.settings.WinLIRCCommandMapping); this.winLIRC = new WinLIRC(); this.winLIRC.SyncControl = this; this.winLIRC.HostName = this.settings.WinLIRCHostName; this.winLIRC.Port = this.settings.WinLIRCPort; this.winLIRC.CommandReceived += new WinLIRC.CommandReceivedEventHandler(winLIRC_CommandReceived); foreach (string winLIRCCommand in this.winLIRCcommandMapping.Keys) { ListViewItem lvi = new ListViewItem(winLIRCCommand); lvi.SubItems.Add(((MainForm.CommandName)this.winLIRCcommandMapping[winLIRCCommand]).ToString()); this.listViewCommandMapping.Items.Add(lvi); } this.comboBoxApplicationCommand.Items.AddRange(Enum.GetNames(typeof(MainForm.CommandName))); this.comboBoxApplicationCommand.SelectedIndex = 0; }
internal void ChangeSetting(string settingName) { switch (settingName) { case "VideoBackgroundColor": if (this.currentGraphBuilder != null) this.currentGraphBuilder.VideoRefresh(); else this.videoControl.BackColor = Settings.VideoBackgroundColor; break; case "UseVideo169Mode": if (this.currentGraphBuilder != null) { this.currentGraphBuilder.UseVideo169Mode = Settings.UseVideo169Mode; this.currentGraphBuilder.VideoRefresh(); } break; case "TimeShiftingActivated": this.toolStripButtonTimeShifting.Checked = Settings.TimeShiftingActivated; this.graphBuilderType = Settings.TimeShiftingActivated ? GraphBuilderType.BDATimeShifting : GraphBuilderType.BDA; if (this.currentGraphBuilder is IBDA) { ChannelDVB currentChannelDVB = (this.currentGraphBuilder as ITV).CurrentChannel as ChannelDVB; if (currentChannelDVB != null) { if (Settings.TimeShiftingActivated ^ this.currentGraphBuilder is GraphBuilderBDATimeShifting) TuneChannelGUI(currentChannelDVB, true); } } break; case "UseWPF": this.videoControl.UseWPF = Settings.UseWPF; if (this.currentGraphBuilder is ITV) TuneChannel((this.currentGraphBuilder as ITV).CurrentChannel, true); else ClearGraph(); break; case "UseWinLIRC": if (Settings.UseWinLIRC) { this.winLIRC = new WinLIRC(); this.winLIRC.SyncControl = this; this.winLIRC.HostName = Settings.WinLIRCHostName; this.winLIRC.Port = Settings.WinLIRCPort; this.winLIRC.CommandReceived += new WinLIRC.CommandReceivedEventHandler(winLIRC_CommandReceived); this.winLIRC.Start(); //if (!this.winLIRC.Start()) // MessageBox.Show("Cannot connect to WinLIRC server: " + this.winLIRC.HostName + ":" + this.winLIRC.Port); } else if (this.winLIRC != null) this.winLIRC.Stop(); break; } }
private void winLIRC_CommandReceived(object sender, WinLIRC.CommandReceivedEventArgs e) { this.textBoxWinLIRCCommand.Text = e.RemoteCommandName + "-" + e.IrCommand; }
private void winLIRC_CommandReceived(object sender, WinLIRC.CommandReceivedEventArgs e) { string commandNameKey = e.RemoteCommandName + "-" + e.IrCommand; if (Settings.WinLIRCCommandMapping.ContainsKey(commandNameKey)) { CommandName commandName = (CommandName)Settings.WinLIRCCommandMapping[commandNameKey]; ExecuteCommand(commandName, e.Repeat); } }