Ejemplo n.º 1
0
        private void NavigateToProfileEditor(object sender, RoutedEventArgs e)
        {
            // Navigate to IP Profile Editor
            IpProfile selectedProfile = (IpProfile)this.profilesListBox.SelectedItem;

            if (selectedProfile != null)
            {
                IpManEditor profileEditorPage = new IpManEditor(selectedProfile);
                this.NavigationService.Navigate(profileEditorPage);
            }
            else
            {
                MessageBox.Show("Bitte wählen Sie ein Profil aus, welches editiert werden soll");
            }
        }
Ejemplo n.º 2
0
        public IpManEditor(IpProfile ipProfile) : this()
        {
            // Bind to injected data
            this.DataContext = ipProfile;
            List <string> nicNames = ipMan.GetInterfaceNames();

            foreach (string name in nicNames)
            {
                Interface_Selection.Items.Add(name);
                if (ipProfile.GetInterfaceName() == name)
                {
                    Interface_Selection.SelectedItem = name;
                }
            }
            if (!ipProfile.GetDynamicIp())
            {
                DynamicDNS_Input.IsEnabled = false;
            }
        }
Ejemplo n.º 3
0
        private void SetSelectedProfile(object sender, RoutedEventArgs e)
        {
            IpProfile profile = (IpProfile)this.profilesListBox.SelectedItem;

            if (profile != null)
            {
                try
                {
                    ipMan.ApplyProfile(profile);
                    (this.Parent as Window).WindowState = WindowState.Minimized;
                }
                catch (KeyNotFoundException)
                {
                    MessageBox.Show("Bitte verbinden Sie die Schnittstelle mit einem Netzwerk und stelle sicher, dass IPv4 eingeschaltet ist.");
                }
            }
            else
            {
                MessageBox.Show("Bitte wählen Sie ein Profil aus, welches angewendet werden soll");
            }
        }
Ejemplo n.º 4
0
 // save changes to profile
 private void SaveChangedProfile(object sender, RoutedEventArgs e)
 {
     if (Interface_Selection.SelectedItem != null)
     {
         IpProfile oldProfile = (IpProfile)this.DataContext;
         IpProfile newProfile = new IpProfile(oldProfile.GetGuid(), ProfileName_Input.Text, Interface_Selection.SelectedItem.ToString(), (bool)DynamicIP_Input.IsChecked, IPAddress_Input.Text, SubnetMask_Input.Text, DefaultGateway_Input.Text, (bool)DynamicDNS_Input.IsChecked, new List <string>()
         {
             Nameserver1_Input.Text, Nameserver2_Input.Text
         });
         if (newProfile.IsValid())
         {
             ipMan.UpdateProfile(newProfile);
             NavigationService.Navigate(new IpManHome());
         }
         else
         {
             MessageBox.Show("Bitte überprüfen Sie Ihre eingaben.");
         }
     }
     else
     {
         MessageBox.Show("Bitte wählen Sie einen Netzwerkadapter aus.");
     }
 }