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

            PortScannerProfileViewModel portScannerProfileViewModel = new PortScannerProfileViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);

                PortScannerProfileInfo portScannerProfileInfo = new PortScannerProfileInfo
                {
                    Name     = instance.Name,
                    Hostname = instance.Hostname,
                    Ports    = instance.Ports,
                    Group    = instance.Group
                };

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

            customDialog.Content = new PortScannerProfileDialog
            {
                DataContext = portScannerProfileViewModel
            };

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

            PortScannerProfileViewModel portScannerProfileViewModel = new PortScannerProfileViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(this, customDialog);

                PortScannerProfileManager.RemoveProfile(SelectedProfile);

                PortScannerProfileInfo portScannerProfileInfo = new PortScannerProfileInfo
                {
                    Name     = instance.Name,
                    Hostname = instance.Hostname,
                    Ports    = instance.Ports,
                    Group    = instance.Group
                };

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

            customDialog.Content = new PortScannerProfileDialog
            {
                DataContext = portScannerProfileViewModel
            };

            await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }