public MainWindow() { InitializeComponent(); //scriptTextBlock.DataContext = this; _serviceItemList = new ObservableCollection<ServiceItem>(); _remoteControl = new RemoteControl(); _remoteControl.RemoteControlEvent += _remoteControl_OnRemoteControl; _remoteControl.StartServer(); _notesWorker.WorkerSupportsCancellation = true; _notesWorker.DoWork += notesWorker_DoWork; _notesWorker.RunWorkerCompleted += notesWorker_RunWorkerCompleted; _pcoWorker.WorkerSupportsCancellation = true; _pcoWorker.DoWork += pcoWorker_DoWork; _pcoWorker.RunWorkerCompleted += pcoWorker_RunWorkerCompleted; // diable screen saver while running SleepUtil.SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_SYSTEM_REQUIRED); // display remote control address Label1.Content = _remoteControl.status; }
void _remoteControl_OnRemoteControl(object sender, RemoteControl.RemoteControlArgs e) { if (e.PageParams.Count == 0) return; // action from remote page foreach (var item in e.PageParams.ToList()) { if (item.Value == "play") playVideo(); // calls generateHtml() else if (item.Value == "stop") stopLive(); // calls generateHtml() else if (item.Value == "next") ScriptListView.SelectedIndex = ScriptListView.SelectedIndex + 1; // does NOT call generateHtml(); saves current slide to App.Current.Properties["card"] else if (item.Value == "prev") ScriptListView.SelectedIndex = ScriptListView.SelectedIndex - 1; // does NOT call generateHtml(); saves current slide to App.Current.Properties["card"] else { foreach (ServiceItem si in _serviceItemList) if (si.Title == WebUtility.UrlDecode(item.Value.ToString())) { serviceListBox.SelectedItem = si; // calls generateHtml() break; } } } }