Пример #1
0
        public override bool Equals(object obj)
        {
            SimpleServerItem item2 = obj as SimpleServerItem;

            if (item2 == null)
            {
                return(false);
            }
            return(ServerName == item2.ServerName && ServerIpAndPort == item2.ServerIpAndPort);
        }
        public void LoadFromSettings()
        {
            SimpleServerItem initialServer = null;

            try
            {
                UseDecal      = Properties.Settings.Default.InjectDecal;
                AccountName   = Properties.Settings.Default.SimpleLaunch_Username;
                Password      = Properties.Settings.Default.SimpleLaunch_Password;
                initialServer = _servers.SourceCollection.OfType <SimpleServerItem>().FirstOrDefault(
                    x => x.GetHashCode() == Properties.Settings.Default.SimpleLaunch_ServerHashCode);
            }
            catch
            {
            }
            SelectedServer = initialServer;
        }
Пример #3
0
 private void ServerList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.NewItems != null)
     {
         foreach (var serverObject in e.NewItems)
         {
             var serverModel  = serverObject as ServerModel;
             var simpleServer = new SimpleServerItem(serverModel);
             _servers.Add(simpleServer);
         }
     }
     if (e.OldItems != null)
     {
         foreach (var serverObject in e.OldItems)
         {
             var serverModel       = serverObject as ServerModel;
             var simpleServerModel = _servers.FirstOrDefault(qq => qq.ServerItem.ServerId == serverModel.ServerId);
             if (simpleServerModel != null)
             {
                 _servers.Remove(simpleServerModel);
             }
         }
     }
 }