public void SetUp() { _view = Substitute.For<IEditUserView>(); _clientMessenger = Substitute.For<IClientMessenger>(); _uut = new EditUserViewController(_view, _clientMessenger); _view.Controller = _uut; }
/*================================================================================================= * PROPERTIES *================================================================================================*/ /*PUBLIC******************************************************************************************/ /*PRIVATE*****************************************************************************************/ /*================================================================================================= * CONSTRUCTORS *================================================================================================*/ public EditUserPresenter(IEditUserView editUserView, IPasswordService passwordService) { _editUserView = editUserView; _passwordService = passwordService; _editUserView.ModifyAccountEvent += ModifyUserInformation; _editUserView.RequestUserEvent += GetUserInformation; }
public EditUserPresenter(IEditUserView view, int userId) { this.View = view; this.Load(userId); }
public EditUserPresenter(IEditUserView view) { this.View = view; }
/*================================================================================================= * CONSTRUCTORS *================================================================================================*/ public MainView(ILoginView loginView, IChangePasswordView changePasswordView, IEditUserView editUserView) { _loginView = loginView ?? throw new ArgumentNullException(nameof(loginView)); _changePasswordView = changePasswordView ?? throw new ArgumentNullException(nameof(changePasswordView)); _editUserView = editUserView ?? throw new ArgumentNullException(nameof(editUserView)); _loginView.LoginSuccessfulEvent += DisplayLoginSuccessful; _dgvPasswordList = new BindingList <Password>(); InitializeComponent(); #region UI // Configure form UI BackColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); FormBorderStyle = FormBorderStyle.None; // Configure labels label1.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); label1.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); label2.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); label2.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); label3.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); label3.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); label4.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); label4.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); label5.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); label5.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); label6.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); label6.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); filterLabel.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); filterLabel.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); // Configure menu strip menuStrip.BackColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); menuStrip.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); menuStrip.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); menuStrip.MenuItemSelectedColor = UIHelper.GetColorFromCode(UIColors.ControlHighLightColor); menuStrip.MenuItemBackgroundColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); loginToolStripMenuItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); loginToolStripMenuItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); loginToolStripMenuItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); accountToolStripMenuItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); accountToolStripMenuItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); accountToolStripMenuItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); editToolStripMenuItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); editToolStripMenuItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); editToolStripMenuItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); editToolStripMenuItem.Enabled = false; deleteToolStripMenuItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); deleteToolStripMenuItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); deleteToolStripMenuItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); deleteToolStripMenuItem.Enabled = false; changePasswordToolStripMenuItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); changePasswordToolStripMenuItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); changePasswordToolStripMenuItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); changePasswordToolStripMenuItem.Enabled = false; // Configure buttons addButton.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); addButton.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); addButton.FlatStyle = FlatStyle.Flat; addButton.Font = UIHelper.GetFont(UIFontSizes.ButtonFontSize); addButton.FlatAppearance.BorderColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); addButton.FlatAppearance.BorderSize = 1; deleteButton.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); deleteButton.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); deleteButton.FlatStyle = FlatStyle.Flat; deleteButton.Font = UIHelper.GetFont(UIFontSizes.ButtonFontSize); deleteButton.FlatAppearance.BorderColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); deleteButton.FlatAppearance.BorderSize = 1; editButton.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); editButton.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); editButton.FlatStyle = FlatStyle.Flat; editButton.Font = UIHelper.GetFont(UIFontSizes.ButtonFontSize); editButton.FlatAppearance.BorderColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); editButton.FlatAppearance.BorderSize = 1; editCancelButton.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); editCancelButton.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); editCancelButton.FlatStyle = FlatStyle.Flat; editCancelButton.Font = UIHelper.GetFont(UIFontSizes.ButtonFontSize); editCancelButton.FlatAppearance.BorderColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); editCancelButton.FlatAppearance.BorderSize = 1; editCancelButton.Enabled = false; editCancelButton.Visible = false; closeButton.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); closeButton.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); closeButton.Font = UIHelper.GetFont(UIFontSizes.CloseButtonFontSize); minimizeButton.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); minimizeButton.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); minimizeButton.Font = UIHelper.GetFont(UIFontSizes.CloseButtonFontSize); // Configure textbox applicationTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); applicationTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); applicationTextBox.BorderStyle = BorderStyle.FixedSingle; applicationTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); usernameTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); usernameTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); usernameTextBox.BorderStyle = BorderStyle.FixedSingle; usernameTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); emailTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); emailTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); emailTextBox.BorderStyle = BorderStyle.FixedSingle; emailTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); descriptionTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); descriptionTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); descriptionTextBox.BorderStyle = BorderStyle.FixedSingle; descriptionTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); passphraseTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); passphraseTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); passphraseTextBox.BorderStyle = BorderStyle.FixedSingle; passphraseTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); websiteTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); websiteTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); websiteTextBox.BorderStyle = BorderStyle.FixedSingle; websiteTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); filterTextBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); filterTextBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); filterTextBox.BorderStyle = BorderStyle.FixedSingle; filterTextBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); // Configure combo box filterComboBox.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); filterComboBox.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); filterComboBox.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); filterComboBox.DataSource = Enum.GetValues(typeof(PasswordFilterOption)); filterComboBox.DropDownStyle = ComboBoxStyle.DropDownList; filterComboBox.HighlightColor = UIHelper.GetColorFromCode(UIColors.ControlHighLightColor); filterComboBox.BorderColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); // Configure status strip statusStrip1.BackColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); statusStrip1.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); statusStrip1.Font = UIHelper.GetFont(UIFontSizes.TextBoxFontSize); // Confgiure data grid view passwordDataGridView.BorderStyle = BorderStyle.None; passwordDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; passwordDataGridView.MultiSelect = false; passwordDataGridView.ReadOnly = true; passwordDataGridView.BackgroundColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); passwordDataGridView.RowsDefaultCellStyle.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); passwordDataGridView.RowsDefaultCellStyle.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); passwordDataGridView.RowsDefaultCellStyle.BackColor = Color.FromArgb(65, 65, 65); passwordDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(85, 85, 85); passwordDataGridView.CellBorderStyle = DataGridViewCellBorderStyle.RaisedHorizontal; passwordDataGridView.AllowUserToOrderColumns = true; passwordDataGridView.DefaultCellStyle.SelectionBackColor = Color.DarkGray; passwordDataGridView.DefaultCellStyle.SelectionForeColor = Color.WhiteSmoke; passwordDataGridView.EnableHeadersVisualStyles = false; passwordDataGridView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; passwordDataGridView.ColumnHeadersDefaultCellStyle.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); passwordDataGridView.ColumnHeadersDefaultCellStyle.BackColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); passwordDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); passwordDataGridView.ColumnHeadersDefaultCellStyle.SelectionBackColor = UIHelper.GetColorFromCode(UIColors.DefaultBackgroundColor); passwordDataGridView.ColumnHeadersDefaultCellStyle.SelectionForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); passwordDataGridView.ScrollBars = ScrollBars.None; passwordDataGridView.MouseWheel += PasswordDataGridView_MouseWheel; // Configure context menu passwordContextMenuStrip = new AdvancedContextMenuStrip(); var copyUsernameToolStripItem = new ToolStripMenuItem("Copy Username"); copyUsernameToolStripItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); copyUsernameToolStripItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); copyUsernameToolStripItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); copyUsernameToolStripItem.Image = Bitmap.FromFile(Path.Combine(Environment.CurrentDirectory, @"Resources\icons8-copy-48.png")); passwordContextMenuStrip.Items.Add(copyUsernameToolStripItem); var copyPasswordToolStripItem = new ToolStripMenuItem("Copy Password"); copyPasswordToolStripItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); copyPasswordToolStripItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); copyPasswordToolStripItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); copyPasswordToolStripItem.Image = Bitmap.FromFile(Path.Combine(Environment.CurrentDirectory, @"Resources\icons8-copy-48.png")); passwordContextMenuStrip.Items.Add(copyPasswordToolStripItem); var websiteToolStripItem = new ToolStripMenuItem("Visit Website"); websiteToolStripItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); websiteToolStripItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); websiteToolStripItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); websiteToolStripItem.Image = Bitmap.FromFile(Path.Combine(Environment.CurrentDirectory, @"Resources\icons8-link-100.png")); passwordContextMenuStrip.Items.Add(websiteToolStripItem); var showPasswordToolStripItem = new ToolStripMenuItem("Show Password"); showPasswordToolStripItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); showPasswordToolStripItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); showPasswordToolStripItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); showPasswordToolStripItem.Image = Bitmap.FromFile(Path.Combine(Environment.CurrentDirectory, @"Resources\icons8-show-property-60.png")); passwordContextMenuStrip.Items.Add(showPasswordToolStripItem); var editToolStripItem = new ToolStripMenuItem("Edit"); editToolStripItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); editToolStripItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); editToolStripItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); editToolStripItem.Image = Bitmap.FromFile(Path.Combine(Environment.CurrentDirectory, @"Resources\icons8-edit-48.png")); passwordContextMenuStrip.Items.Add(editToolStripItem); var deleteToolStripItem = new ToolStripMenuItem("Delete"); deleteToolStripItem.Font = UIHelper.GetFont(UIFontSizes.DefaultFontSize); deleteToolStripItem.BackColor = UIHelper.GetColorFromCode(UIColors.ControlBackgroundColor); deleteToolStripItem.ForeColor = UIHelper.GetColorFromCode(UIColors.DefaultFontColor); deleteToolStripItem.Image = Bitmap.FromFile(Path.Combine(Environment.CurrentDirectory, @"Resources\icons8-delete-60.png")); passwordContextMenuStrip.Items.Add(deleteToolStripItem); passwordContextMenuStrip.Items[0].Click += CopyUser_Click; passwordContextMenuStrip.Items[1].Click += CopyPass_Click; passwordContextMenuStrip.Items[2].Click += Website_Click; passwordContextMenuStrip.Items[3].Click += ShowPassword_Click; passwordContextMenuStrip.Items[4].Click += EditButton_Click; passwordContextMenuStrip.Items[5].Click += DeleteButton_Click; #endregion userStatusLabel.Text = "Not logged in."; }
public EditUserViewController(IEditUserView view, IClientMessenger clientMessenger = null) { _view = view; _clientMessenger = clientMessenger; }