示例#1
0
 /// <summary>
 /// Start kontrolera. Przygotowuje dostępne akcje w formularzu w zależności od roli użytkownika
 /// </summary>
 public void Start()
 {
     if (AuthManager.GetInstance().UserRoles.Exists((string el) => { return(el == "admin"); }))
     {
         _roles = _httpConnector.GetRoles();
         string errorMessage = _httpConnector.LastErrorMessage;
         if (errorMessage == null)
         {
             _accountForm.DataSource = _httpConnector.GetUsers();
             errorMessage            = _httpConnector.LastErrorMessage;
             if (errorMessage == null)
             {
                 _accountForm.SetActions(AddUser, UpdateUser, DeleteUser);
                 _accountForm.ShowDialog();
             }
         }
         if (errorMessage != null)
         {
             MessageBox.Show(errorMessage);
         }
     }
     else
     {
         MessageBox.Show("Brak uprawnień");
     }
 }
示例#2
0
 public void Start()
 {
     if (AuthManager.GetInstance().UserRoles.Exists((string el) => { return(el == "admin"); }))
     {
         _roles = _httpConnector.GetRoles();
         string errorMessage = _httpConnector.LastErrorMessage;
         if (errorMessage == null)
         {
             _accountForm.Roles      = _roles;
             _accountForm.DataSource = _httpConnector.GetUsers();
             errorMessage            = _httpConnector.LastErrorMessage;
             if (errorMessage == null)
             {
                 _accountForm.EnableUserView = true;
             }
         }
         if (errorMessage != null)
         {
             MessageBox.Show(errorMessage);
         }
     }
     _accountForm.SetActions(ChangePassword, AddUser, UpdateUser, DeleteUser);
     _passwordForm.FormClosing += SavePassword;
     _accountForm.ShowDialog();
 }
 private void TimerShowForm_Load(object sender, EventArgs e)
 {
     try
     {
         if (cn != null && cn.State != ConnectionState.Closed)
         {
             CloseAll();
         }
         AccountForm af = new AccountForm(String.Empty, true);
         af.ShowDialog();
         if (af.ExitPressed || String.IsNullOrEmpty(af.ConnectionString))
         {
             this.Close();
         }
         cn = new SqlConnection(af.ConnectionString);
         cn.Open();
         this.timerControl.ConnectionString = cn.ConnectionString;
         try
         {
             BoulderTimer.Properties.Settings set = BoulderTimer.Properties.Settings.Default;
             this.timerControl.Font = new Font(set.FontFamily, set.FontSize);
         }
         catch { }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка соединения:\r\n" + ex.Message);
         this.Close();
     }
 }
        private void AddAccountButton_Click(object sender, EventArgs e)
        {
            AccountForm newAccount = new AccountForm("");

            if (newAccount.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                BlueVex2.Properties.Settings.Default.Accounts.Add(newAccount.Username + "," + newAccount.Password + "," + newAccount.CharSlot + "," + newAccount.Master + "," + newAccount.Realm);
                PopulateAccountsListView();
            }
        }
 private void ShowAccount(Settings settings)
 {
     using (var accountForm = new AccountForm(new OAuthHelper(settings)))
     {
         var dialogResult = DialogResult.Retry;
         while (dialogResult != DialogResult.Cancel)
         {
             dialogResult = accountForm.ShowDialog(snagitWindow);
         }
     }
 }
示例#6
0
        private void dgvAbiturient_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int i = 0;

            while (i < dgvAbiturient.Rows.Count)
            {
                if (dgvAbiturient.Rows[i].Cells[4].Selected)
                {
                    AccountForm frmAccount = new AccountForm(dgvAbiturient.Rows[i]);
                    frmAccount.ShowDialog();
                }
                i++;
            }
        }
 private void EditAccountButton_Click(object sender, EventArgs e)
 {
     if (this.AccountsListView.SelectedItems.Count > 0)
     {
         string      itemString = this.AccountsListView.SelectedItems[0].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[1].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[2].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[3].Text + "," + this.AccountsListView.SelectedItems[0].SubItems[4].Text;
         AccountForm newAccount = new AccountForm(itemString);
         if (newAccount.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             BlueVex2.Properties.Settings.Default.Accounts.Remove(itemString);
             BlueVex2.Properties.Settings.Default.Accounts.Add(newAccount.Username + "," + newAccount.Password + "," + newAccount.CharSlot + "," + newAccount.Master + "," + newAccount.Realm);
             PopulateAccountsListView();
         }
     }
 }
示例#8
0
 /// <summary>
 /// Called when Button is clicked.
 /// </summary>
 protected override void OnClick()
 {
     try
     {
         // Show the Account Form
         AccountForm frm = new AccountForm();
         frm.Username = DataHubConfiguration.Current.UserName;
         frm.Password = DataHubConfiguration.Current.Password;
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             //Set the Username and Password
             DataHubConfiguration.Current.UserName = frm.Username;
             DataHubConfiguration.Current.Password = frm.Password;
             DataHubConfiguration.Current.Save();
         }
     }
     catch (Exception ex)
     {
         DataHubExtension.ShowError(ex);
     }
 }
示例#9
0
        private void btnAccount_Click(object sender, EventArgs e)
        {
            AccountForm Form = new AccountForm();

            Form.ShowDialog();
        }
示例#10
0
        private void configurationButton_Click(object sender, RoutedEventArgs e)
        {
            AccountForm accountForm = new AccountForm();

            accountForm.ShowDialog();
        }
示例#11
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            AccountForm f = new AccountForm();

            f.ShowDialog();
        }