private void Form1_Load(object sender, System.EventArgs e) { this.Opacity = 0; Splash = new frmSplash(); Splash.lblVersion.Text = VERSION; Splash.lblStatus.Text = "Loading Login Screen..."; Splash.Show(); Login1 L = new Login1(); System.Windows.Forms.DialogResult LDR = L.ShowDialog(this); if(LDR != DialogResult.OK) { Application.Exit(); return; } else { Splash.Msg("Loading User data..."); OSystem = L.OSystem; LoginUser = L.LoginUser; g_COMPORT = L.g_COMPORT; g_LoginDenied = OSystem.SystemAdminLoginDenied; } // if(this.Tag is PassOysterLogin) // { // // PassOysterLogin POL = (PassOysterLogin)this.Tag; // OSystem = POL.OSystem; // LoginUser = POL.LoginUser; // g_COMPORT = POL.COMPORT; // g_LoginDenied = OSystem.SystemAdminLoginDenied; // this.Tag = null; // } // else // return; //ReadMediaBufferServerLocalAddress(); g_Obj = new System.Object(); try { CardSwipe = new CARDSCAN.SerialPortScanClass(); //MHClient = new MHCOM.MediaHawkClientClass(); } catch(Exception Err) { MessageBox.Show(Err.Message,"Application Closing.."); Application.Exit(); return; } gLogTime = new DateTime(); gLogTime = System.DateTime.Now; gLastActivity = System.DateTime.Now; StatusTimer.Enabled = true; ActivityTimer.Enabled = true; HighestSectionType = LoginUser.HighestAuthorityLevel; MainSystemSection = OSystem.CurrentSystemSection("6419DC43-84B9-43e2-89FE-BB8C96D5CF6F"); menuItem1.Visible = false; menuItem3.Visible = false; mnuSystem.Visible = false; mnuHelp.Visible = false; //For Oakland Permissions if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.ID) { menuItem3.Visible = true; mnuSystem.Visible = true; menuItem1.Visible = true; } else if(HighestSectionType.ID == OSystem.SectionTypeSysAdmin.NextSectionTypeID) { mnuSystem.Visible = true; menuItem3.Visible = true; menuItem1.Visible = true; } else { foreach(OysterClassLibrary.Permission P in HighestSectionType.CanShareRecordings) { string peek = P.TargetSectionTypeId.ToString(); menuItem1.Visible = true; break; } } ShowDisplay(ShowUserInfo); Splash.Msg("Building Users Hierarchy..."); Status(LoginUser.Description + " logged in..."); BuildUserHierarchy(); BuildCameraView(); treeView1.Focus(); if(treeView1.SelectedNode != null) { if(treeView1.SelectedNode.Tag is OysterClassLibrary.Section) { } else { treeView1.SelectedNode = treeView1.Nodes[0]; } } else { treeView1.SelectedNode = treeView1.Nodes[0]; } treeView1_MouseUp(treeView1,new MouseEventArgs(MouseButtons.Left,1,0,0,0)); Splash.Msg("Completed..exiting Splash Screen"); Splash.Dispose(); this.Opacity = 100; }
// /// <summary> // /// The main entry point for the application. // /// </summary> // [STAThread] // static void Main() // { // Application.Run(new Login1()); // } private void Login1_Load(object sender, System.EventArgs e) { FrmParent = (frmSplash)this.Owner; try { CardSwipe = new CARDSCAN.SerialPortScanClass(); } catch(Exception Err) { MessageBox.Show(Err.Message,"Application Closing.."); this.DialogResult = DialogResult.Abort; return; } FrmParent.Msg("Loading Card Reader Information..."); // //Retrieve the last known COMPORT VALUE RK = Registry.CurrentUser.OpenSubKey("Software\\Carver Lab\\Oyster V2.0\\Data"); if(RK == null) { RK = Registry.CurrentUser.OpenSubKey("Software",true); RK.CreateSubKey("Carver Lab\\Oyster V2.0\\Data"); } ConnectionString = RK.GetValue("ConnectionString","").ToString(); g_COMPORT = (string)RK.GetValue("COMPORT","COM1"); //RETRIEVE ALL COMPORTS ON THIS COMPUTER RK = Registry.LocalMachine.OpenSubKey("HARDWARE\\DEVICEMAP\\SERIALCOMM"); string[] COM_PORTS = RK.GetSubKeyNames(); int length = COM_PORTS.Length; COM_PORTS = RK.GetValueNames(); length = COM_PORTS.Length; string nosey = ""; if(length == 0) { cbConfigureCardScan.Items.Add("NO COMPORTS"); g_COMPORT = ""; NOCOM = true; btnLoginCardScan.Enabled = false; // btnScanIdCard.Enabled = false; } else { for(int i = 0; i < COM_PORTS.Length;i++) { nosey = (string)RK.GetValue(COM_PORTS[i].ToString()); cbConfigureCardScan.Items.Add(nosey); if(g_COMPORT == nosey) cbConfigureCardScan.Text = nosey; nosey = COM_PORTS[i].ToString(); } } FrmParent.Msg("Please enter Login information."); }