private void RemoteControlConfigForm_Load(object sender, EventArgs e) { lvButtons.Font = new Font(ThemeManager.NormalFont.FontFamily, ThemeManager.NormalFont.SizeInPoints - 1, GraphicsUnit.Point); if (_remoteControl != null) { SetTitle("TXT_CHANGEEMOTECONFIG"); } else { _remoteControl = _config.RemoteControl.NewRemoteControlRow(); _createNewRemote = true; } txtRemoteName.Text = _remoteControl.RemoteName; chkEnabled.Checked = _remoteControl.Enabled; BuildButtonListFields(); PopulatePinTypes(); DisplayPinsData(); DisplayButtonsData(); txtRemoteName.TextChanged += new EventHandler(txtRemoteName_TextChanged); chkEnabled.CheckedChanged += new EventHandler(chkEnabled_CheckedChanged); }
private bool DispatchToOutputPin(string remoteName, string request, out RCCServiceConfig.RemoteButtonsRow button) { bool canDispatch = false; button = null; RCCServiceConfig.RemoteControlRow remote = _config.RemoteControl.FindByRemoteName(remoteName); if (remote != null && remote.Enabled) { var rows = from btn in _config.RemoteButtons where (btn.Enabled && btn.RemoteName == remoteName && btn.InputData == request) select btn; if (rows != null && rows.Count() > 0) { button = rows.First(); if (TimedButtonProcessing.CanProcessData(remoteName, button.TimedRepeatRate, request)) { canDispatch = true; Logger.LogInfo("OK to dispatch command on remote '{0}'", remoteName); } else { if (button.TimedRepeatRate > 0) { Logger.LogInfo("Can't dispatch command on remote '{2}'. Must wait {0} seconds before processing this data again: {1}", rows.First().TimedRepeatRate, request, remoteName); } else { Logger.LogInfo("Can't dispatch command on remote '{1}'. This data is to be only processed once: {0}", request, remoteName); } } } else { Logger.LogInfo("Can't dispatch command on remote '{1}'. Either there are no buttons defined for this data: {0} or they are disabled.", request, remoteName); } } else { Logger.LogInfo("Can't dispatch command on remote '{0}' as it seems to be disabled.", remoteName); } return(canDispatch); }