예제 #1
0
        private void btn_login_Click(object sender, RoutedEventArgs e)
        {
            string username = txt_username.Text;
            string passkey  = txt_passkey.Text;

            if (AreLoginCredsAuthorized(username, passkey))
            {
                CurrentUser = username;
                JenkinsCredentials creds = new JenkinsCredentials(username, passkey);
                sentinel.SetCredentials(creds);
                this.Title = String.Format("Jenkins Sentinel - [{0}]", username);
                LoadAndUpdateAllJobs(false);
                sentinel.StartWatching();
                if (check_save_login.IsChecked.Value)
                {
                    StoreCredentials(creds);
                }

                panel_login.Visibility   = Visibility.Collapsed;
                panel_jobs.Visibility    = Visibility.Visible;
                menu_jobs.IsEnabled      = true;
                menu_templates.IsEnabled = true;
            }
            else
            {
                MessageBox.Show("Login credentials are not valid!");
            }
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();
            persistor = Persistor.GetInstance();

            if (File.Exists(Persistor.CredentialsFileName))
            {
                JenkinsCredentials creds = persistor.ReadCredentials();
                txt_username.Text = creds.Username;
                txt_passkey.Text  = creds.Password;
            }

            sentinel = new Sentinel(CHECK_PERIOD, this);
            if (File.Exists(Persistor.SentinelFileName))
            {
                Sentinel sentinelSave = persistor.ReadJobs();
                sentinel.Jobs             = sentinelSave.Jobs;
                sentinel.LastIndex        = sentinelSave.LastIndex;
                sentinel.WindowTopmost    = sentinelSave.WindowTopmost;
                sentinel.DefaultCloud     = sentinelSave.DefaultCloud;
                sentinel.InspectFrequency = sentinelSave.InspectFrequency;
            }

            this.Topmost = sentinel.WindowTopmost;
            sentinel.AddReportListener(ShowNotification);
        }
예제 #3
0
 private void StoreCredentials(JenkinsCredentials Creds)
 {
     persistor.PersistCredentials(Creds);
 }