private void EditServer(object cp)
        {
            if (!(cp is ConnectionProfile))
            {
                throw new ArgumentException("connProfile is not of type ConnectionProfile.", "connProfile");
            }
            var connProfile = (ConnectionProfile)cp;

            ConnectionProfiles[ConnectionProfiles.IndexOf(connProfile)] = connProfile;
        }
Exemplo n.º 2
0
        private void updateProfiles()
        {
            if (CPService != null)
            {
                ConnectionProfiles = CPService.getAvailableProfiles();
                SelectedProfile    = 0;
            }

            ConnectionProfile currentProfile = null;

            if (UserOptions != null)
            {
                var currentOptions = UserOptions.getOptions();
                if (currentOptions != null)
                {
                    currentProfile = currentOptions.CurrentConnection;
                    Options        = currentOptions;
                }
                else
                {
                    Options = new DiversityUserOptions();
                }
            }

            if (ConnectionProfiles != null && currentProfile != null)
            {
                var selectedIndices = from profile in ConnectionProfiles
                                      where profile.CompareTo(currentProfile) == 0
                                      select ConnectionProfiles.IndexOf(profile);

                if (selectedIndices.Count() > 0)
                {
                    SelectedProfile = selectedIndices.First();
                }
            }
        }