예제 #1
0
        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);
        }
예제 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(string.Empty);
            }

            return(MACAddressHelper.GetDefaultFormat((PhysicalAddress)value));
        }
예제 #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));
        }
예제 #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);
        }
예제 #5
0
 private void CopySelectedMACAddressAction()
 {
     Clipboard.SetText(MACAddressHelper.GetDefaultFormat(SelectedARPTableInfo.MACAddress.ToString()));
 }
예제 #6
0
        public static byte[] CreateMagicPacket(string mac)
        {
            var macBytes = MACAddressHelper.ConvertStringToByteArray(mac);

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

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