private async void AddProfileAction() { CustomDialog customDialog = new CustomDialog() { Title = Application.Current.Resources["String_Header_AddProfile"] as string }; NetworkInterfaceProfileViewModel networkInterfaceProfileViewModel = new NetworkInterfaceProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); NetworkInterfaceProfileInfo networkInterfaceProfileInfo = new NetworkInterfaceProfileInfo { Name = instance.Name, EnableStaticIPAddress = instance.EnableStaticIPAddress, IPAddress = instance.IPAddress, Subnetmask = instance.SubnetmaskOrCidr, Gateway = instance.Gateway, EnableStaticDNS = instance.EnableStaticDNS, PrimaryDNSServer = instance.PrimaryDNSServer, SecondaryDNSServer = instance.SecondaryDNSServer, Group = instance.Group }; NetworkInterfaceProfileManager.AddProfile(networkInterfaceProfileInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, NetworkInterfaceProfileManager.GetProfileGroups(), new NetworkInterfaceProfileInfo() { EnableStaticIPAddress = ConfigEnableStaticIPAddress, IPAddress = ConfigIPAddress, Subnetmask = ConfigSubnetmaskOrCidr, Gateway = ConfigGateway, EnableStaticDNS = ConfigEnableStaticDNS, PrimaryDNSServer = ConfigPrimaryDNSServer, SecondaryDNSServer = ConfigSecondaryDNSServer }); customDialog.Content = new NetworkInterfaceProfileDialog { DataContext = networkInterfaceProfileViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
private async void EditProfileAction() { CustomDialog customDialog = new CustomDialog() { Title = LocalizationManager.GetStringByKey("String_Header_EditProfile") }; NetworkInterfaceProfileViewModel networkInterfaceProfileViewModel = new NetworkInterfaceProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); NetworkInterfaceProfileManager.RemoveProfile(SelectedProfile); NetworkInterfaceProfileInfo networkInterfaceProfileInfo = new NetworkInterfaceProfileInfo { Name = instance.Name, EnableStaticIPAddress = instance.EnableStaticIPAddress, IPAddress = instance.IPAddress, Subnetmask = instance.SubnetmaskOrCidr, Gateway = instance.Gateway, EnableStaticDNS = instance.EnableStaticDNS, PrimaryDNSServer = instance.PrimaryDNSServer, SecondaryDNSServer = instance.SecondaryDNSServer, Group = instance.Group }; NetworkInterfaceProfileManager.AddProfile(networkInterfaceProfileInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, NetworkInterfaceProfileManager.GetProfileGroups(), SelectedProfile); customDialog.Content = new NetworkInterfaceProfileDialog { DataContext = networkInterfaceProfileViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }