コード例 #1
0
        private async void CopyAsProfileAction()
        {
            CustomDialog customDialog = new CustomDialog()
            {
                Title = LocalizationManager.GetStringByKey("String_Header_CopyProfile")
            };

            IPScannerProfileViewModel ipScannerProfileViewModel = new IPScannerProfileViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);

                IPScannerProfileInfo ipScannerProfileInfo = new IPScannerProfileInfo
                {
                    Name    = instance.Name,
                    IPRange = instance.IPRange,
                    Group   = instance.Group
                };

                IPScannerProfileManager.AddProfile(ipScannerProfileInfo);
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
            }, IPScannerProfileManager.GetProfileGroups(), SelectedProfile);

            customDialog.Content = new IPScannerProfileDialog
            {
                DataContext = ipScannerProfileViewModel
            };

            await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }
コード例 #2
0
        private async void EditProfileAction()
        {
            CustomDialog customDialog = new CustomDialog()
            {
                Title = Application.Current.Resources["String_Header_EditProfile"] as string
            };

            IPScannerProfileViewModel ipScannerProfileViewModel = new IPScannerProfileViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);

                IPScannerProfileManager.RemoveProfile(SelectedProfile);

                IPScannerProfileInfo ipScannerProfileInfo = new IPScannerProfileInfo
                {
                    Name    = instance.Name,
                    IPRange = instance.IPRange,
                    Group   = instance.Group
                };

                IPScannerProfileManager.AddProfile(ipScannerProfileInfo);
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);
            }, IPScannerProfileManager.GetProfileGroups(), SelectedProfile);

            customDialog.Content = new IPScannerProfileDialog
            {
                DataContext = ipScannerProfileViewModel
            };

            await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }