public async void Execute(object par) { int ticks = 0; try { ticks = Convert.ToInt32((string)par); if (ticks < 0) { throw new ArgumentException(); } } catch (Exception) { debugViewModel.AddDebugInfo("EndlessVcUp", "Given ticks input is not valid."); return; } try { await remoteVM.SelectedRaspiItem.raspi.EndlessVCUp(ticks); debugViewModel.AddDebugInfo("EndlessVcUp", ticks + " times"); } catch { debugViewModel.AddDebugInfo("EndlessVcUp", "failed"); } }
public async void Execute(object parameter) { string receiverDevice = remoteVM.SelectedReceiverItem.Content.ToString(); try { await remoteVM.SelectedRaspiItem.raspi.SetARDVoltage(receiverDevice); debugVM.AddDebugInfo("SetReceiverCommand", receiverDevice); } catch (Exception e) { debugVM.AddDebugInfo("SetReceiverCommand", "Failed"); } }
public async void Execute(object parameter) { String result; try { result = await remoteVM.SelectedRaspiItem.raspi.ResetMux(); debugVM.AddDebugInfo("Multiplexer is resetted: ", result); } catch (Exception exc) { debugVM.AddDebugInfo("Reset Mux failed. ", exc.Message); Debug.WriteLine("Reset Mux failed. " + exc.Message + " " + exc.Source); } }
public async void Execute(object parameter) { object selectedDuration = MainWindowViewModel.CurrentViewModelRemoteController.SelectedDuration.Content; if (selectedDuration != null) { Debug.WriteLine("The selected Duration for {0} is: {1}", this.GetType().Name, selectedDuration.ToString()); await remoteVM.SelectedRaspiItem.raspi.PressRockerSwitchUp(selectedDuration.ToString()); debugViewModel.AddDebugInfo("PressRockerSwitchUp", "success"); } else { debugViewModel.AddDebugInfo("Debug", "Invalid duration"); } }
public async void Execute(object parameter) { String result; try { result = await remoteVM.SelectedRaspiItem.raspi.DetectAudioShoe(); remoteVM.AudioShoeUpdate = Visibility.Visible; debugVM.AddDebugInfo("DetectAudioShoe", result); } catch (Exception e) { debugVM.AddDebugInfo("DetectAudioShoe :", e.Message); return; } }
public async void Execute(object parameter) { String result; try { result = await remoteVM.SelectedRaspiItem.raspi.UndetectTeleCoil(); remoteVM.TcoilUpdate = Visibility.Hidden; debugVM.AddDebugInfo("UndetectTeleCoil", result); } catch (Exception e) { debugVM.AddDebugInfo("UndetectTeleCoil :", e.Message); return; } }
public async void Execute(object parameter) { string raspiConfig = ""; try { raspiConfig = await remoteVM.SelectedRaspiItem.raspi.GetRaspiConfig(); debugVM.AddDebugInfo("ReadRaspiConfig", "Success"); } catch (Exception e) { debugVM.AddDebugInfo("ReadRaspiConfig", "Failed"); } remoteVM.RaspiConfigString = raspiConfig; }
public async void Execute(object parameter) { String result; object selectedDuration = MainWindowViewModel.CurrentViewModelRemoteController.SelectedDuration.Content; try { Debug.WriteLine("The selected Duration for {0} is: {1}", this.GetType().Name, selectedDuration.ToString()); result = await remoteVM.SelectedRaspiItem.raspi.PressPushButton(selectedDuration.ToString()); debugVM.AddDebugInfo("PressPushButton", result); } catch (Exception e) { debugVM.AddDebugInfo("PressPushButton :", e.Message); return; } }
public async void Execute(object parameter) { remoteVM.Model = remoteVM.SelectedHI.Content.ToString(); remoteVM.Family = remoteVM.SelectedHI.Name; if (remoteVM.Model == "" || remoteVM.Family == "") { debugVM.AddDebugInfo("SetHICommand", "selected item is not valid."); } try { await remoteVM.SelectedRaspiItem.raspi.SetHI(remoteVM.Family, remoteVM.Model); remoteVM.detectVC_type(); debugVM.AddDebugInfo("SetHICommand", remoteVM.Family + ", " + remoteVM.Model); } catch (Exception e) { debugVM.AddDebugInfo("SetHICommand", "Failed"); } }
private async void press_Combination(object sender, RoutedEventArgs e) { object selectedDurationCategorie = MainWindowViewModel.CurrentViewModelRemoteController.SelectedDuration.Content; if (selectedDurationCategorie != null) { string[] param = new string[4]; for (int i = 0; i < param.Length; i++) { param[i] = null; } param[param.Length - 1] = selectedDurationCategorie.ToString(); if (Push_Checkbox.IsChecked == true) { param[0] = "PB"; } if (RockerSwitchUp_Checkbox.IsChecked == true) { param[1] = "RSU"; } if (RockerSwitchDown_Checkbox.IsChecked == true) { param[2] = "RSD"; } await remoteVM.RaspberryPiInstance.PressCombination(param); vmDebug.AddDebugInfo("PressCombination", "success"); //Request request = new Request("PressCombination", param); //remoteVM.sendRequest(request); //remoteVM.getResult(request); } else { vmDebug.AddDebugInfo("Debug", "Invalid duration"); } }
public async void Execute(object parameter) { bool ledStatus = false; try { ledStatus = await remoteVM.SelectedRaspiItem.raspi.CheckLEDStatus(); debugVM.AddDebugInfo("CheckLEDStatus", ledStatus.ToString()); } catch (Exception e) { } if (ledStatus) { remoteVM.ToggleLEDButton = Visibility.Visible; } else { remoteVM.ToggleLEDButton = Visibility.Hidden; } }
public async void Execute(object parameter) { TcpClient registryServerSocket = new TcpClient(); Request request = new Request("getRegisteredDevices", null); try { await registryServerSocket.ConnectAsync("192.168.178.21", 54320); } catch (Exception e) { vmDebug.AddDebugInfo("[ERROR]", "Error connecting to the Registry Server: " + e.Message); return; } try { Transfer.sendObject(registryServerSocket.GetStream(), request); } catch (Exception e) { vmDebug.AddDebugInfo("[ERROR]", "Error sending to the RegistryServer: " + e.Message); return; } Object result; try { result = Transfer.receiveObject(registryServerSocket.GetStream()); } catch (Exception e) { vmDebug.AddDebugInfo("[ERROR]", "Error receiving from the RegistryServer: " + e.Message); return; } if (result.GetType() == typeof(SuccessResult)) { List <RaspberryPiItem> connectedList = remoteVM.BackendList.Where(item => item.Connected).ToList(); remoteVM.BackendList.Clear(); foreach (var entry in connectedList) { remoteVM.BackendList.Add(entry); } SuccessResult successResult = (SuccessResult)result; Dictionary <string, string> dictionary = (Dictionary <string, string>)successResult.result; foreach (var entry in dictionary) { remoteVM.addRaspberryPi(entry.Key, entry.Value); } } else if (result.GetType() == typeof(ExceptionResult)) { vmDebug.AddDebugInfo("[ERROR]", "Error Result from the RegistryServer: " + ((ExceptionResult)result).exceptionMessage); } else { vmDebug.AddDebugInfo("[ERROR]", "Unhandled Registry Server Result Type: " + result.GetType().ToString()); } registryServerSocket.Close(); }