private async void btnInfo_Click(object sender, RoutedEventArgs e) { //try { string info = ""; rv.PJLinkConnection c = connectBeamer(); info = await c.getProjectorInfo(); LampStatusCommand lscmd = new LampStatusCommand(); if (await c.sendCommand(lscmd) == Command.Response.SUCCESS) { info += "\n"; info += lscmd.dumpToString(); } var view = ApplicationView.GetForCurrentView(); view.TryResizeView(new Size(328, 250)); InfoDialog dialog = new InfoDialog(info); await dialog.ShowAsync(); view.TryResizeView(new Size(328, 100)); } //catch (Exception) { } }
private async void btnMute_Click(object sender, RoutedEventArgs e) { await Task.Run(async() => { try { rv.PJLinkConnection c = connectBeamer(); AVMuteCommand qcmd = new AVMuteCommand(AVMuteCommand.Action.QUERYSTATE); if (await c.sendCommand(qcmd) == Command.Response.SUCCESS) { AVMuteCommand acmd; if (qcmd.Status == AVMuteCommand.Action.MUTE) { acmd = new AVMuteCommand(AVMuteCommand.Action.UNMUTE); await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _timerMuteBlink.Stop(); btnMute.Background = btndefBack; }); } else { acmd = new AVMuteCommand(AVMuteCommand.Action.MUTE); await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _timerMuteBlink.Start(); }); } await c.sendCommand(acmd); } } catch (Exception) { } }); }
public static async Task <ProjectorInfo> create(PJLinkConnection c) { ProjectorInfo pi = new ProjectorInfo(); pi._projectorHostName = c.HostName; ProjectorNameCommand pnc = new ProjectorNameCommand(); if (await c.sendCommand(pnc) == Command.Response.SUCCESS) { pi._projectorHostName = pnc.Name; } ManufacturerNameCommand mnc = new ManufacturerNameCommand(); if (await c.sendCommand(mnc) == Command.Response.SUCCESS) { pi._projectorManufacturerName = mnc.Manufacturer; } ProductNameCommand prnc = new ProductNameCommand(); if (await c.sendCommand(prnc) == Command.Response.SUCCESS) { pi._projectorProductName = prnc.ProductName; } ErrorStatusCommand esc = new ErrorStatusCommand(); if (await c.sendCommand(esc) == Command.Response.SUCCESS) { pi._fanStatus = esc.FanStatus; pi._lampStatus = esc.LampStatus; pi._coverStatus = esc.CoverStatus; pi._filterStatus = esc.FilterStatus; pi._otherStatus = esc.OtherStatus; } PowerCommand pc = new PowerCommand(PowerCommand.Power.QUERY); if (await c.sendCommand(pc) == Command.Response.SUCCESS) { pi._powerStatus = pc.Status; } LampStatusCommand lsc = new LampStatusCommand(); if (await c.sendCommand(lsc) == Command.Response.SUCCESS) { pi._multiLampStatus = lsc.StatusList; pi._multiLampHours = lsc.HoursList; pi._numOfLamps = lsc.NumOfLamps; } InputCommand ic = new InputCommand(); if (await c.sendCommand(ic) == Command.Response.SUCCESS) { pi._input = ic.Input; pi._inputPort = ic.Port; } return(pi); }
public static ProjectorInfo create(PJLinkConnection c) { ProjectorInfo pi = new ProjectorInfo(); pi._projectorHostName = c.HostName; ProjectorNameCommand pnc = new ProjectorNameCommand(); if (c.sendCommand(pnc) == Command.Response.SUCCESS) pi._projectorHostName = pnc.Name; ManufacturerNameCommand mnc = new ManufacturerNameCommand(); if (c.sendCommand(mnc) == Command.Response.SUCCESS) pi._projectorManufacturerName = mnc.Manufacturer; ProductNameCommand prnc = new ProductNameCommand(); if (c.sendCommand(prnc) == Command.Response.SUCCESS) pi._projectorProductName = prnc.ProductName; ErrorStatusCommand esc = new ErrorStatusCommand(); if (c.sendCommand(esc) == Command.Response.SUCCESS) { pi._fanStatus = esc.FanStatus; pi._lampStatus = esc.LampStatus; pi._coverStatus = esc.CoverStatus; pi._filterStatus = esc.FilterStatus; pi._otherStatus = esc.OtherStatus; } PowerCommand pc = new PowerCommand(PowerCommand.Power.QUERY); if (c.sendCommand(pc) == Command.Response.SUCCESS) pi._powerStatus = pc.Status; LampStatusCommand lsc = new LampStatusCommand(); if (c.sendCommand(lsc) == Command.Response.SUCCESS) { pi._multiLampStatus = lsc.StatusList; pi._multiLampHours = lsc.HoursList; pi._numOfLamps = lsc.NumOfLamps; } InputCommand ic = new InputCommand(); if (c.sendCommand(ic) == Command.Response.SUCCESS) { pi._input = ic.Input; pi._inputPort = ic.Port; } return pi; }
async void _timerPowerCheck_Elapsed(object source, object e) { await Task.Run(async() => { try { rv.PJLinkConnection c = connectBeamer(); PowerCommand.PowerStatus powStat = PowerCommand.PowerStatus.UNKNOWN; try { powStat = await c.powerQuery(); } catch (Exception) { try { powStat = await c.powerQuery(); } catch (Exception) { } } switch (powStat) { case PowerCommand.PowerStatus.OFF: case PowerCommand.PowerStatus.COOLING: case PowerCommand.PowerStatus.UNKNOWN: await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { this.btnPwr.Background = btndefBack; this.btnMute.IsEnabled = false; _startupRoundCntr++; if (_timerPowerCheck.Interval == new TimeSpan(0, 0, 5) && powStat != PowerCommand.PowerStatus.UNKNOWN) { _timerPowerCheck.Interval = new TimeSpan(0, 1, 0); // 1min _startupRoundCntr = 0; _timerPowerBlink.Stop(); this.btnPwr.Background = btndefBack; } }); break; case PowerCommand.PowerStatus.ON: case PowerCommand.PowerStatus.WARMUP: await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { this._timerPowerBlink.Stop(); this.btnPwr.Background = new SolidColorBrush(Colors.LawnGreen); this.btnMute.IsEnabled = true; AVMuteCommand qcmd = new AVMuteCommand(AVMuteCommand.Action.QUERYSTATE); if (await c.sendCommand(qcmd) == Command.Response.SUCCESS) { if (qcmd.Status == AVMuteCommand.Action.MUTE) { _timerMuteBlink.Start(); } else { _timerMuteBlink.Stop(); btnMute.Background = btndefBack; } } _startupRoundCntr++; if (_timerPowerCheck.Interval == new TimeSpan(0, 0, 5) && _startupRoundCntr == 10) { _timerPowerCheck.Interval = new TimeSpan(0, 1, 0); // 1min _startupRoundCntr = 0; _timerPowerBlink.Stop(); this.btnPwr.Background = new SolidColorBrush(Colors.LawnGreen); } }); break; } await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (_timerPowerCheck.Interval == new TimeSpan(0, 0, 5) && _startupRoundCntr == 10) { _timerPowerCheck.Interval = new TimeSpan(0, 1, 0); // 1min _startupRoundCntr = 0; _timerPowerBlink.Stop(); this.btnPwr.Background = btndefBack; } }); } catch (Exception) { } }); }
private async void Page_Loaded(object sender, RoutedEventArgs e) { if (!LoadConfig()) { tmrTimer.Stop(); txtTime.Text = "Invalid Config"; btnMute.Visibility = Visibility.Collapsed; btnPwr.Visibility = Visibility.Collapsed; btnInfo.Visibility = Visibility.Collapsed; } btndefBack = btnPwr.Background; // Hook up the Elapsed event for the timer. _timerMuteBlink.Tick += _timerMuteBlink_Elapsed; // Set the Interval to 0.5 seconds (500 milliseconds). _timerMuteBlink.Interval = new TimeSpan(0, 0, 0, 0, 500); _timerPowerCheck.Tick += _timerPowerCheck_Elapsed; _timerPowerCheck.Interval = new TimeSpan(0, 1, 0); // 1min _timerPowerCheck.Start(); _timerPowerBlink.Tick += _timerPowerBlink_Elapsed; _timerPowerBlink.Interval = new TimeSpan(0, 0, 0, 0, 500); // 0.5sec rv.PJLinkConnection c = connectBeamer(); PowerCommand.PowerStatus powStat = PowerCommand.PowerStatus.UNKNOWN; try { powStat = await c.powerQuery(); } catch (Exception) { try { powStat = await c.powerQuery(); } catch (Exception) { } } switch (powStat) { case PowerCommand.PowerStatus.OFF: case PowerCommand.PowerStatus.COOLING: case PowerCommand.PowerStatus.UNKNOWN: this.btnPwr.Background = btndefBack; this.btnMute.IsEnabled = false; break; case PowerCommand.PowerStatus.ON: case PowerCommand.PowerStatus.WARMUP: this.btnPwr.Background = new SolidColorBrush(Colors.LawnGreen); this.btnMute.IsEnabled = true; try { AVMuteCommand qcmd = new AVMuteCommand(AVMuteCommand.Action.QUERYSTATE); if (await c.sendCommand(qcmd) == Command.Response.SUCCESS) { if (qcmd.Status == AVMuteCommand.Action.MUTE) { _timerMuteBlink.Start(); } else { _timerMuteBlink.Stop(); } } } catch (Exception) { } break; } }