예제 #1
0
        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(); }
        }
예제 #2
0
        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; }
        }