private void btFaces_ItemClick(object sender, ItemClickEventArgs e) { foreach (BarItem barItem in barManager1.Items) { try { ((BarBaseButtonItem)barItem).Down = false; } catch { } } (e.Item as BarLargeButtonItem).Down = true; if (_faceForm == null || _faceForm.IsDisposed) { _faceForm = new FrmFaces(); _faceForm.MdiParent = this; } else { _faceForm.Dispose(); _faceForm = new FrmFaces(); _faceForm.MdiParent = this; } foreach (Form form in MdiChildren) { form.Hide(); form.ControlBox = false; } _faceForm.Icon = _mainIcon; _faceForm.Show(); _faceForm.ControlBox = false; Activate(); }
public MainForm() { InitializeComponent(); try { FrmFaces frmFaces = new FrmFaces(); frmFaces.MdiParent = this; _faceForm = frmFaces; } catch (Exception ex) { int num = (int)MessageBox.Show(ex.Message + "-3"); } }
private void EmplooyersForm_Load(object sender, EventArgs e) { try { Bitmap bitmap = new Bitmap(1, 1); Graphics.FromImage(bitmap).FillRectangle(Brushes.Transparent, new Rectangle(0, 0, 1, 1)); _mainIcon = Icon.FromHandle(bitmap.GetHicon()); } catch { } AuthorizationForm authorizationForm = new AuthorizationForm("CascadeManager", new Messages()); if (authorizationForm.ShowDialog() != DialogResult.OK) { _allowClose = true; Close(); } else { CurrentUser = authorizationForm.User; if (CurrentUser.Role == 2) { btUsers.Enabled = true; } else { btUsers.Enabled = false; } int[] actions = CurrentUser.GetActions(); for (int index = 0; index < actions.Length; ++index) { if (actions[index] == 8) { btObjects.Enabled = true; } if (actions[index] == 7) { btSettings.Enabled = true; } if (actions[index] == 0) { btFaces.Enabled = true; if (_faceForm == null || _faceForm.IsDisposed) { _faceForm = new FrmFaces(); _faceForm.MdiParent = this; } _faceForm.Icon = _mainIcon; _faceForm.Show(); } if (actions[index] == 12) { btStatistic.Enabled = true; } if (actions[index] == 13) { btResults.Enabled = true; } if (actions[index] == 10) { btCategories.Enabled = true; } if (actions[index] == 11) { btWorkStations.Enabled = true; } if (actions[index] == 6) { btSearch.Enabled = true; } if (actions[index] == 17) { btLogSearch.Enabled = true; } if (actions[index] == 4) { btQueryTemplates.Enabled = true; } } } }