示例#1
0
        private void OnInterfaceListChanged(string newName, string oldName)
        {
            //validate the interface list by remove interfaces that are not listed and duplicated entries
            implementedInterfaces = implementedInterfaces.Where(i => InterfaceList.Contains(i.Name)).Distinct().ToList();

            //also check for error
            string[] s = InterfaceList.Replace(" ", "").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            showInterfaceError.target =
                IsInterfacesExist(s, ref interfaceListError) ? 0 : 1;
            new Thread(() =>
            {
                try
                {
                    //search for suggestion based on the last listed interface name
                    if (s.HasElement())
                    {
                        string suggest       = s[s.Length - 1];
                        interfaceSuggesstion = SearchInterfaces(suggest);
                        forceRepaint         = true;
                    }
                }
                catch (Exception e)
                {
                    Debug.Log(e.ToString());
                }
            }).Start();
        }
示例#2
0
        private void RefreshInterfaceListExecute()
        {
            IPNetworkInterface prevSelectedAddress = SelectedInterface;

            InterfaceList.Clear();
            GetInterfaces();

            if (InterfaceList.Contains(prevSelectedAddress))
            {
                SelectedInterface = prevSelectedAddress;
            }
            else if (InterfaceList.Count > 0)
            {
                SelectedInterface = InterfaceList[0];
            }
            else
            {
                SelectedInterface = null;
            }

            RaisePropertyChanged("SelectedInterface");
        }