Example #1
0
        public ServerListViewModelDesignData()
        {
            Servers.Add("net.tcp://localhost:9876/TetriNET");
            Servers.Add("net.tcp://somehost:9876/TetriNET");

            LatestServers.Add("net.tcp://localhost:9876/TetriNET");
        }
Example #2
0
        private void AddServerToLatestInner(string address)
        {
            if (LatestServers.Any(x => x == address)) // reorder list if already in list
            {
                LatestServers.Remove(address);        // remove from list, will be inserted on head in next statement
            }
            LatestServers.Insert(0, address);
            if (LatestServers.Count > MaxLatestServerCount) // No more than 5 servers in list
            {
                LatestServers.RemoveAt(MaxLatestServerCount);
            }
            StringCollection latestServers = new StringCollection();

            latestServers.AddRange(LatestServers.ToArray());
            Settings.Default.LatestServers = latestServers;
            Settings.Default.Save();
        }
Example #3
0
        public ServerListViewModel()
        {
            IsProgressBarVisible   = false;
            IsScanForServerEnabled = true;

            ScanForServerCommand = new AsyncRelayCommand(ScanForServer);
            //ScanForServerCommand = new AsyncRelayCommand2( async _ => await Task.Run(() => ScanForServer()));
            SelectServerCommand       = new RelayCommand(SelectServer);
            SelectLatestServerCommand = new RelayCommand(SelectLatestServer);

            StringCollection latestServers = Settings.Default.LatestServers;

            if (latestServers != null)
            {
                LatestServers.Clear();
                foreach (string s in latestServers)
                {
                    LatestServers.Add(s);
                }
            }
        }