private void WakeUp(WakeOnLANInfo info) { DisplayStatusMessage = false; IsSending = true; try { WakeOnLAN.Send(info); // DEBUG //await Task.Delay(5000); StatusMessage = LocalizationManager.GetStringByKey("String_MagicPacketSuccessfulSended"); DisplayStatusMessage = true; } catch (Exception ex) { StatusMessage = ex.Message; DisplayStatusMessage = true; } finally { IsSending = false; } }
private void WakeUpAction() { DisplayStatusMessage = false; StatusMessage = string.Empty; try { WakeOnLANInfo info = new WakeOnLANInfo { MagicPacket = MagicPacketHelper.Create(MACAddress), Broadcast = IPAddress.Parse(Broadcast), Port = Port }; WakeOnLAN.Send(info); StatusMessage = Application.Current.Resources["String_MagicPacketSuccessfulSended"] as string; DisplayStatusMessage = true; } catch (Exception ex) { StatusMessage = ex.Message; DisplayStatusMessage = true; } }
private void WakeUpClientAction() { WakeOnLANInfo info = new WakeOnLANInfo { MagicPacket = WakeOnLAN.CreateMagicPacket(SelectedClient.MACAddress), Broadcast = IPAddress.Parse(SelectedClient.Broadcast), Port = SelectedClient.Port }; WakeUp(info); }
private void WakeUpAction() { WakeOnLANInfo info = new WakeOnLANInfo { MagicPacket = WakeOnLAN.CreateMagicPacket(MACAddress), Broadcast = IPAddress.Parse(Broadcast), Port = Port }; WakeUp(info); }
public static WakeOnLANInfo CreateInfo(ProfileInfo profileInfo) { var info = new WakeOnLANInfo { MagicPacket = Models.Network.WakeOnLAN.CreateMagicPacket(profileInfo.WakeOnLAN_MACAddress), Broadcast = IPAddress.Parse(profileInfo.WakeOnLAN_Broadcast), Port = profileInfo.WakeOnLAN_OverridePort ? profileInfo.WakeOnLAN_Port : SettingsManager.Current.WakeOnLAN_Port }; return(info); }
private void WakeUpProfileAction() { WakeOnLANInfo info = new WakeOnLANInfo { MagicPacket = WakeOnLAN.CreateMagicPacket(SelectedProfile.WakeOnLAN_MACAddress), Broadcast = IPAddress.Parse(SelectedProfile.WakeOnLAN_Broadcast), Port = SelectedProfile.WakeOnLAN_Port }; WakeUp(info); }
public void WakeUpSelectedClientsAction() { DisplayStatusMessage = false; StatusMessage = string.Empty; int errorCount = 0; foreach (WakeOnLANClientInfo template in SelectedWakeOnLANClients) { try { WakeOnLANInfo info = new WakeOnLANInfo { MagicPacket = MagicPacketHelper.Create(template.MACAddress), Broadcast = IPAddress.Parse(template.Broadcast), Port = template.Port }; WakeOnLAN.Send(info); } catch (Exception ex) { errorCount++; if (!string.IsNullOrEmpty(StatusMessage)) { StatusMessage += Environment.NewLine; } StatusMessage += ex.Message; DisplayStatusMessage = true; } } if (SelectedWakeOnLANClients.Count == 1) { StatusMessage = Application.Current.Resources["String_MagicPacketSuccessfulSended"] as string; DisplayStatusMessage = true; } if (SelectedWakeOnLANClients.Count > 1 && SelectedWakeOnLANClients.Count != errorCount) { StatusMessage = string.Format(Application.Current.Resources["String_MagicPacketSuccessfulSendedToClients"] as string, SelectedWakeOnLANClients.Count - errorCount); DisplayStatusMessage = true; } }
private void WakeUp(WakeOnLANInfo info) { DisplayStatusMessage = false; StatusMessage = string.Empty; try { WakeOnLAN.Send(info); StatusMessage = Application.Current.Resources["String_MagicPacketSuccessfulSended"] as string; DisplayStatusMessage = true; } catch (Exception ex) { StatusMessage = ex.Message; DisplayStatusMessage = true; } }
private async void WakeUp(WakeOnLANInfo info) { DisplayStatusMessage = false; IsSending = true; try { WakeOnLAN.Send(info); await Task.Delay(2000); // Make the user happy, let him see a reload animation (and he cannot spam the send command) StatusMessage = LocalizationManager.GetStringByKey("String_MagicPacketSuccessfulSended"); DisplayStatusMessage = true; } catch (Exception ex) { StatusMessage = ex.Message; DisplayStatusMessage = true; } finally { IsSending = false; } }