private void btnOK_Click(object sender, EventArgs e) { if (!ValidateData()) { return; } int old_sess_id = _user != null ? _user.SessionId : -1; _user = new EIBUserConf(); _user.SessionId = old_sess_id; _user.Name = this.tbUserName.Text; _user.Password = this.tbmaskPassword.Text; _user.Priviliges = 0; if (this.cbReadAllowed.Checked) { _user.Priviliges |= EIBUsersConf.USER_POLICY_READ_ACCESS; } if (this.cbWriteAllowed.Checked) { _user.Priviliges |= EIBUsersConf.USER_POLICY_WRITE_ACCESS; } if (this.cbConsoleAccss.Checked) { _user.Priviliges |= EIBUsersConf.USER_POLICY_CONSOLE_ACCESS; } _user.SrcMask = ushort.Parse(this.tbSAMask.Text.Substring(2, this.tbSAMask.Text.Length - 2), System.Globalization.NumberStyles.HexNumber); _user.DstMask = ushort.Parse(this.tbDAMask.Text.Substring(2, this.tbDAMask.Text.Length - 2), System.Globalization.NumberStyles.HexNumber); }
private void UpdatSpecificeUserSettings(EIBUserConf user) { this.cbReadPolicy.Checked = ((user.Priviliges & EIBUsersConf.USER_POLICY_READ_ACCESS) != 0); this.cbWritePolicy.Checked = ((user.Priviliges & EIBUsersConf.USER_POLICY_WRITE_ACCESS) != 0); this.cbConsoleAccess.Checked = ((user.Priviliges & EIBUsersConf.USER_POLICY_CONSOLE_ACCESS) != 0); this.lbSrcMask.Text = "0x" + user.SrcMask.ToString("X4"); this.lblDstMask.Text = "0x" + user.DstMask.ToString("X4"); }
private void btnSaveUsers_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; EIBUsersConf conf = new EIBUsersConf(); foreach (ListViewItem item in this.lvUsers.Items) { EIBUserConf user = item.Tag as EIBUserConf; conf.List.Add(user); } bool res = ConsoleAPI.SetUsersList(conf); Cursor.Current = Cursors.Default; }
public AddUserForm(EIBUserConf user) { InitializeComponent(); _user = user; this.tbUserName.Text = _user.Name; this.tbmaskPassword.Text = _user.Password; this.tbmaskRetypePassword.Text = _user.Password; this.cbReadAllowed.Checked = (_user.Priviliges & EIBUsersConf.USER_POLICY_READ_ACCESS) != 0; this.cbWriteAllowed.Checked = (_user.Priviliges & EIBUsersConf.USER_POLICY_WRITE_ACCESS) != 0; this.cbConsoleAccss.Checked = (_user.Priviliges & EIBUsersConf.USER_POLICY_CONSOLE_ACCESS) != 0; this.tbSAMask.Text = "0x" + _user.SrcMask.ToString("X"); this.tbDAMask.Text = "0x" + _user.DstMask.ToString("X"); }
private void lvUsers_SelectedIndexChanged(object sender, EventArgs e) { if (this.lvUsers.SelectedIndices.Count != 1) { this.btnDeleteUser.Enabled = false; return; } EIBUserConf user = this.lvUsers.Items[this.lvUsers.SelectedIndices[0]].Tag as EIBUserConf; this.lblSrcMaskVal.Text = "0x" + user.SrcMask.ToString("X4"); this.lblDstMaskVal.Text = "0x" + user.DstMask.ToString("X4"); this.cbReadAllowed.Enabled = true; this.cbReadAllowed.Checked = (user.Priviliges & 1) != 0; this.cbWriteAllowed.Enabled = true; this.cbWriteAllowed.Checked = (user.Priviliges & 2) != 0; }
private void btnDeleteUser_Click(object sender, EventArgs e) { _dirty_flag = true; EIBUserConf user = (EIBUserConf)this.lvUsers.SelectedItems[0].Tag; int index = this.lvUsers.SelectedItems[0].Index; _users.List.Remove(user); UpdateListView(); if (this.lvUsers.SelectedItems.Count == 0 && this.lvUsers.Items.Count > 0) { if (index == 0) { this.lvUsers.Items[0].Selected = true; } else { this.lvUsers.Items[index - 1].Selected = true; } } }