private async void AddClientAction()
        {
            MetroDialogSettings settings = AppearanceManager.MetroDialog;

            settings.AffirmativeButtonText = Application.Current.Resources["String_Button_Add"] as string;
            settings.NegativeButtonText    = Application.Current.Resources["String_Button_Cancel"] as string;
            settings.DefaultButtonFocus    = MessageDialogResult.Affirmative;

            string hostname = await dialogCoordinator.ShowInputAsync(this, Application.Current.Resources["String_Header_AddClient"] as string, Application.Current.Resources["String_EnterHostnameForClient"] as string, settings);

            if (string.IsNullOrEmpty(hostname))
            {
                return;
            }

            WakeOnLANClientInfo client = new WakeOnLANClientInfo
            {
                Hostname   = hostname.ToUpper(),
                MACAddress = MACAddressHelper.GetDefaultFormat(MACAddress),
                Broadcast  = Broadcast,
                Port       = Port
            };

            WakeOnLANClientManager.AddClient(client);
        }
Exemple #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(string.Empty);
            }

            return(MACAddressHelper.GetDefaultFormat((PhysicalAddress)value));
        }
Exemple #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is PhysicalAddress physicalAddress))
            {
                return(string.Empty);
            }

            string macAddress = physicalAddress.ToString();

            return(string.IsNullOrEmpty(macAddress) ? string.Empty : MACAddressHelper.GetDefaultFormat(macAddress));
        }
Exemple #4
0
        private async void AddEntryAction()
        {
            DisplayStatusMessage = false;

            CustomDialog customDialog = new CustomDialog()
            {
                Title = Application.Current.Resources["String_Header_AddEntry"] as string
            };

            ARPTableAddEntryViewModel arpTableAddEntryViewModel = new ARPTableAddEntryViewModel(async instance =>
            {
                await dialogCoordinator.HideMetroDialogAsync(this, customDialog);

                try
                {
                    ARPTable arpTable = new ARPTable();

                    arpTable.UserHasCanceled += ArpTable_UserHasCanceled;

                    await arpTable.AddEntryAsync(instance.IPAddress, MACAddressHelper.Format(instance.MACAddress, "-"));

                    Refresh();
                }
                catch (Exception ex)
                {
                    StatusMessage        = ex.Message;
                    DisplayStatusMessage = true;
                }
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
            });

            customDialog.Content = new ARPTableAddEntryDialog
            {
                DataContext = arpTableAddEntryViewModel
            };

            await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }
Exemple #5
0
 private void CopySelectedMACAddressAction()
 {
     Clipboard.SetText(MACAddressHelper.GetDefaultFormat(SelectedARPTableInfo.MACAddress.ToString()));
 }
Exemple #6
0
        public static byte[] CreateMagicPacket(string mac)
        {
            var macBytes = MACAddressHelper.ConvertStringToByteArray(mac);

            return(CreateMagicPacket(macBytes));
        }
        public static byte[] Create(string mac)
        {
            byte[] macBytes = MACAddressHelper.ConvertStringToByteArray(mac);

            return(Create(macBytes));
        }
Exemple #8
0
 private void CopySelectedMACAddressAction()
 {
     Clipboard.SetText(MACAddressHelper.GetDefaultFormat(SelectedIPScanResult.MACAddress.ToString()));
 }