private void loadIpInterfaceAddresses(string systemIp)
        {
            // Get host name
            string strHostName   = Dns.GetHostName();
            int    systemIPIndex = 0;
            bool   found         = false;

            // Find host by name
            //IPHostEntry iphostentry = Dns.GetHostByName(strHostName);

            IPHostEntry iphostentry = Dns.GetHostEntry(strHostName);

            List <IPAddress> addresses = new List <IPAddress>();

            // Enumerate IP addresses
            foreach (IPAddress ipaddress in iphostentry.AddressList)
            {
                if (ipaddress.AddressFamily == AddressFamily.InterNetwork)
                {
                    //find system ip if it it was given
                    addresses.Add(ipaddress);
                    if (!string.Equals(ipaddress.ToString(), systemIp))
                    {
                        if (!found)
                        {
                            systemIPIndex++;
                        }
                    }
                    else
                    {
                        found = true;
                    }
                }
            }

            combobox_system_ip.ItemsSource = addresses;
            if (!string.Equals(systemIp, "") && systemIp != null)
            {
                if (addresses.Count > 0)
                {
                    combobox_system_ip.SelectedIndex = systemIPIndex;
                    combobox_system_ip.IsEnabled     = false;

                    btn_connect.Background     = VMAXHelper.getColorBrush(VMAX_COLOR.GRADIENT_BLUE);
                    textblock_btn_connect.Text = "Disconnect";
                }
            }
        }
Example #2
0
        private void btn_connect_Click(object sender, RoutedEventArgs e)
        {
            if (_SysManager == null)
            {
                _SysManager = new SystemManager(_settings);
            }
            IPAddress ip = combobox_system_ip.SelectedItem as IPAddress;

            if (ip == null)
            {
                notifyUser("Please select a valid IP Address interface to continue", "Invalid IP Interface", MessageBoxImage.Warning);
                return;
            }
            _settings.SystemIp = ip.ToString();
            _SysManager.start();
            combobox_system_ip.IsEnabled = false;
            btn_connect.Background       = VMAXHelper.getColorBrush(VMAX_COLOR.GRADIENT_BLUE);
            textblock_btn_connect.Text   = "Disconnect";
        }