예제 #1
0
        protected override void OnClosing(CancelEventArgs e)
        {
            if (Model.AllowExit)
            {
                UserSettings settings = new UserSettings {
                    Servers = new List <SavedJenkinsServers>()
                };
                foreach (ServerViewModel server in Model.Servers)
                {
                    List <SavedJob> jobs = server.Jobs.Where(x => x.IsSubscribed).Select(x => new SavedJob {
                        Name = x.Name
                    }).ToList();
                    settings.Servers.Add(new SavedJenkinsServers {
                        DomainUrl = server.DomainUrl, Jobs = jobs
                    });
                }

                PersistedUserSettings.Save(settings);
                Settings.Default.ViewMode = Model.ViewMode.ToString();
                Settings.Default.Servers  = new StringCollection();
                Settings.Default.Servers.AddRange(Model.Servers.Select(x => x.DomainUrl).ToArray());
                Settings.Default.Save();
            }
            else
            {
                e.Cancel    = true;
                WindowState = WindowState.Minimized;
            }
            base.OnClosing(e);
        }
예제 #2
0
        public void SaveSettings()
        {
            if (m_servers.Any(x => !x.IsValid) || !HasInternetConnection)
            {
                return;
            }

            UserSettings settings = new UserSettings {
                Servers = new List <SavedJenkinsServers>()
            };

            foreach (ServerViewModel server in Servers)
            {
                List <SavedJob> jobs = server.Jobs.Where(x => x.IsSubscribed).Select(x => new SavedJob {
                    Name = x.Name
                }).ToList();
                settings.Servers.Add(new SavedJenkinsServers {
                    DomainUrl = server.DomainUrl, Jobs = jobs, RequiresAuthentication = server.RequiresAuthentication
                });
            }

            PersistedUserSettings.Save(settings);
            Settings.Default.ViewMode          = ViewMode.ToString();
            Settings.Default.JobUpdateInterval = UpdateTimerInterval;
            Settings.Default.Servers           = new StringCollection();
            Settings.Default.Servers.AddRange(Servers.Select(x => x.DomainUrl).ToArray());
            Settings.Default.Save();
        }
예제 #3
0
        public void SaveSettings()
        {
            UserSettings settings = new UserSettings {
                Servers = new List <SavedJenkinsServers>()
            };

            foreach (ServerViewModel server in Servers)
            {
                List <SavedJob> jobs = server.Jobs.Where(x => x.IsSubscribed).Select(x => new SavedJob {
                    Name = x.Name
                }).ToList();
                settings.Servers.Add(new SavedJenkinsServers {
                    DomainUrl = server.DomainUrl, Jobs = jobs, RequiresAuthentication = server.RequiresAuthentication
                });
            }

            PersistedUserSettings.Save(settings);
            Settings.Default.ViewMode = ViewMode.ToString();
            Settings.Default.Servers  = new StringCollection();
            Settings.Default.Servers.AddRange(Servers.Select(x => x.DomainUrl).ToArray());
            Settings.Default.Save();
        }