private void setUserServices() { //Set user services try { //Set menu states this.mMessageMgr.AddMessage("Setting services..."); this.msFileExit.Enabled = true; this.msViewFont.Enabled = this.tsFont.Enabled = RoleServiceGateway.IsSalesRep; this.msViewToolbar.Enabled = this.msViewStatusBar.Enabled = true; this.msHelpAbout.Enabled = true; ServiceInfo si = DataGateway.GetServiceInfo(); this.ssMain.SetOnlineStatus(OnlineIcon.On, si.Connection); } catch (Exception ex) { App.ReportError(ex, false); } finally { Application.DoEvents(); } }
private void OnFormLoad(object sender, System.EventArgs e) { //Load conditions this.Cursor = Cursors.WaitCursor; try { //Initialize controls Splash.Close(); this.Visible = true; this.mMessageMgr.AddMessage("Loading..."); Application.DoEvents(); #region Set user preferences try { this.WindowState = global::VS13.Properties.Settings.Default.WindowState; switch (this.WindowState) { case FormWindowState.Maximized: break; case FormWindowState.Minimized: break; case FormWindowState.Normal: this.Location = global::VS13.Properties.Settings.Default.Location; this.Size = global::VS13.Properties.Settings.Default.Size; break; } this.Font = this.msMain.Font = this.tsMain.Font = this.ssMain.Font = global::VS13.Properties.Settings.Default.Font; this.msViewToolbar.Checked = this.tsMain.Visible = global::VS13.Properties.Settings.Default.Toolbar; this.msViewStatusBar.Checked = this.ssMain.Visible = global::VS13.Properties.Settings.Default.StatusBar; App.CheckVersion(); } catch (Exception ex) { App.ReportError(ex, true); } #endregion //Set control defaults ServiceInfo si = DataGateway.GetServiceInfo(); this.ssMain.SetOnlineStatus(OnlineIcon.On, si.Connection); this.ssMain.User1Label.Width = 144; this.ssMain.User1Label.Text = RoleServiceGateway.GetRoleForCurrentUser(); this.ssMain.User1Label.ToolTipText = "User role"; } catch (Exception ex) { App.ReportError(ex, true); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
private void OnItemClick(object sender, System.EventArgs e) { //Event handler for menu selection try { ToolStripItem item = (ToolStripItem)sender; switch (item.Name) { case "csRefresh": //Refresh issues this.mIssues.Clear(); this.mIssues.Merge(DataGateway.GetIssues()); //Update reminder flags for (int i = 0; i < this.dgvMain.Rows.Count; i++) { int id = Convert.ToInt32(this.dgvMain.Rows[i].Cells["colID"].Value); if (this.mReminders.HasReminder(id, Environment.UserName)) { this.dgvMain.Rows[i].Cells["colReminder"].Value = this.mReminders.ReminderImage; } } break; case "csReminder": this.mReminders.AddReminder(Convert.ToInt32(this.dgvMain.SelectedRows[0].Cells["colID"].Value), this.dgvMain.SelectedRows[0].Cells["colSubject"].Value.ToString(), Environment.UserName); this.csRefresh.PerformClick(); break; case "csClearFlag": this.mReminders.RemoveReminder(Convert.ToInt32(this.dgvMain.SelectedRows[0].Cells["colID"].Value), Environment.UserName); this.csRefresh.PerformClick(); break; } } catch (Exception ex) { App.ReportError(ex, true); } finally { setUserServices(); this.Cursor = Cursors.Default; } }