Beispiel #1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            try
            {
                IsLoading = true;
                SplashScreen = (frmSplash)this.Owner; //new frmSplash();

                //SplashScreen.lblVersion.Text = "2.0.15.0";

                SplashScreen.lblStatus.Text = "Initializing Hard Copy resources...";

                SplashScreen.Refresh();
                UserLicense.OnTimedOut += new EventHandler(UserLicense_OnTimedOut);
                //Application.DoEvents();
                //Acquire the Custom Color
                CustomRed = lblAvailableSpace.ForeColor;
                //Variables used to get Video Information
                //ReadMediaBufferServerLocalAddress();

                cmdAddOne.Image = imgButtons.Images[16];
                cmdAddAll.Image = imgButtons.Images[12];
                cmdRemoveOne.Image = imgButtons.Images[8];
                cmdRemoveAll.Image = imgButtons.Images[4];
                cmdBurn.Image = imgButtons.Images[0];

                lstvMembersOfGroup = new ListView();
                CurrentUsersRecordings = new ListView();
                lblSizeOnDVD.Text = "Total File Size : 0" + " Bytes";

                string CarverLabDirectory = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), CarverLab.Utility.AppInfo.Title);
                MyGlobals.Logger.WriteLog("Carver Lab Folder: {0}", CarverLabDirectory);
                DefaultDirectory = Path.Combine(CarverLabDirectory, "DownloadFiles");
                MyGlobals.Logger.WriteLog("Downloaded files folder: {0}", DefaultDirectory);

                if (!Directory.Exists(DefaultDirectory))
                    Directory.CreateDirectory(DefaultDirectory);

                //Initialize Card Video System
                //CVOS = new CardVideoObjects.SystemClass();

                //Initialize MHCOM object
                //MHClient = new MHCOM.MediaHawkClientClass();
                //MHClient.ListVideo += new MHCOM._IMediaHawkClientEvents_ListVideoEventHandler(this.mhListVideo);
                Total_File_SizeMH = 0;
                Total_File_SizeDVD = 0;
                //this.MHClient.DownloadComplete = new MHCOM._IMediaHawkClientEvents_DownloadCompleteEventHandler(OnMHClient_DownloadComplete(string str, bool bb));
                //this.MHClient.DownloadProgress = new MHCOM._IMediaHawkClientEvents_DownloadProgressEventHandler(OnMHClient_DownloadProgress(string str, double d1, double d2));
                //			LoginUser();
                //			if(bLOGOFF == true)
                //			{
                //				//SplashScreen.Dispose();
                //				Application.Exit();
                //				return;
                //			}

                ListViewItem LV = new ListViewItem();
                // g_objUser = cvosUser;
                SelectedUser = LUser;
                //LV = lstvMembersOfGroup.Items.Add(cvosUser.Description);
                //LV.Tag = g_objUser;

                UserCollection = new OysterDictionary();

                UserCollection.Add(SelectedUser.Description,SelectedUser);

                //LV = lstvMembersOfGroup.Items.Add(SelectedUser.Description);
                //LV.Tag = SelectedUser;
                SplashScreen.lblStatus.Text = "Verifying login user's recordings...";
                //Application.DoEvents();
                SplashScreen.Refresh();
                cbUsers.Items.Add(SelectedUser.Description);
                cbUsers.Text = SelectedUser.Description;

                MyGlobals.Logger.WriteLog("Adding users to user collection...");

                OysterClassLibrary.Users ALLUSERSINHIERACHY = SelectedUser.AllMembersInHierarchy;
                int[] UO = OSystem.UnassignedIDs;
                foreach(OysterClassLibrary.User myUser in ALLUSERSINHIERACHY)
                {
                    if(myUser.ID != UO[0])
                    {
                        UserCollection.Add(myUser.Description,myUser);
                        cbUsers.Items.Add(myUser.Description);
                        LV.Tag = myUser;
                    }
                    //NOTE TO SELF:: MAY NEED TO ADD ALL USERS TO THE UserCollection Object
                }
                //            foreach(CardVideoObjects.Body BB in cvosUser.Bodys)
                //            {
                //                ListUserMembers(BB);
                //            }
                //Variables used in the following DVD Burner Info and Stats

                SplashScreen.lblStatus.Text = "Detecting connected devices...";
                //Application.DoEvents();
                SplashScreen.Refresh();
                short s = 0;
                short i =0;
                short first_burner = 0;
                bool first_pass = false;
                bool bBool = false;
                bool found_burner =false;
                found_burner = false;
                int Found_Count = 0;
                MyGlobals.Logger.WriteLog("Detecting writable drives ...");

                s = MCD.DeviceCount;
                Application.DoEvents();
                s = MCD.DeviceCount;
                MyGlobals.Logger.WriteLog("Found {0} drives.", s);

                MCDWriters = new Devices[s];
                for( i = 0; i <= (s - 1); i++)
                {
                    bBool = MCD.SelectDevice(i);
                    if (bBool)
                    {
                        if( MCD.DeviceIsBurner())
                        {
                            string deviceName = MCD.get_DeviceName(i);
                            MyGlobals.Logger.WriteLog("Adding optical drive {0} to the list.", deviceName);
                            cboBurners.Items.Add(deviceName);
                            found_burner = true;
                            MCDWriters[Found_Count].Description = deviceName;
                            MCDWriters[Found_Count].DeviceId = i;
                            MCDWriters[Found_Count].SetCount(Found_Count + 1);
                            int test = MCDWriters[Found_Count].Count();
                            Found_Count += 1;
                            if (first_pass == false)
                            {
                                first_burner = i;
                                first_pass = true;
                            }
                        }
                    }
                }
                //Checks to see if a burner was found
                if (!found_burner)
                {
                    //MessageBox.Show("No CD/DVD Burners found! Only Network Storage option is available.");
                    cboBurners.Items.Add(NETWORKDEVICENAME);
                    cboBurners.Text = NETWORKDEVICENAME;
                    lblAvailableSpace.Visible = false;
                    UseNetwork = true;
                }
                else //if a burner was found add the option to store on network drive
                {
                    cboBurners.Items.Add(NETWORKDEVICENAME);
                    //cboBurners.Text = GetSetting("Card Video Burner", "SAVE_DEVICES", "LAST_SELECTED", MCD.SelectDevice(1).ToString());
                    cboBurners.Text =(string) GetRegistryValue(MAJORSECTION,MINORSECTION,MINISECTION,KEYSECTION,"FIRSTTIME");
                    Application.DoEvents();
                    if( cboBurners.Text == "FIRSTTIME")//This means that there was no entry in registry--FIRST TIME APPLICATION RUN ONLY
                    {
                        MCD.SelectDevice(first_burner);
                        cboBurners.Text = MCD.get_DeviceName(first_burner);

                        lblAvailableSpace.Visible = true;
                        if (MCD.TestUnitReady() == false)
                        {
                            lblAvailableSpace.Text = "Disc not ready....";
                            lblAvailableSpace.Refresh();
                        }
                        else
                        {
                            if (cboBurners.Text != NETWORKDEVICENAME)
                            {
                                s = MCD.DeviceCount;
                                found_burner = false;
                                // Search to see if Device in registry is still attached to system
                                for(i = 0; i<=(s-1);i++)
                                {
                                    bBool = MCD.SelectDevice(i);
                                    if(bBool == true)
                                    {
                                        if( MCD.get_DeviceName(i) == cboBurners.Text)
                                        {
                                            found_burner = true;
                                        }
                                    }
                                }
                                //If the Device in the registry no longer exist then assign first device found.
                                if( found_burner == false)
                                {
                                    MCD.SelectDevice(first_burner);
                                }

                                lblAvailableSpace.Visible = true;
                                if( MCD.TestUnitReady() == false)
                                {
                                    lblAvailableSpace.Text = "Disc not ready....";
                                    lblAvailableSpace.Refresh();
                                }
                                else
                                {
                                    lblAvailableSpace.Visible = false;
                                    UseNetwork = true;
                                }
                            }
                        }
                    }
                }
                SplashScreen.lblStatus.Text = "Load completed. Launching Application..";
                //Application.DoEvents();
                SplashScreen.Refresh();
                IsLoading = false;
                cmdBurn.Enabled = false;
                CheckBurner = true;
                TMonitor_Disc = new System.Threading.Thread(new System.Threading.ThreadStart(CheckBurnerDevice));
                TMonitor_Disc.Start();
                //			RefreshScreen.Enabled = true;
            }
            catch (System.Exception ex)
            {
                MyGlobals.Logger.WriteLog("Exception: {0}", ex.ToString());
                MessageBox.Show(this,ex.Message,AppInfo.Title + ": Error");
            }
        }
Beispiel #2
0
		private void Login1_Load(object sender, System.EventArgs e)
		{
			MyGlobals.Logger.WriteLog("frmLogin loading");
			//Retrieve the last known COMPORT VALUE
            FrmParent = (frmSplash)this.Owner;
#if USE_CARDSCAN
			try
			{
				CardSwipe = new CARDSCAN.SerialPortScanClass();
                
			}
			catch(Exception Err)
			{
				MessageBox.Show(Err.Message,"Application Closing..");
				this.DialogResult = DialogResult.Abort;
				return;
			}
			
			RK = Registry.CurrentUser.OpenSubKey("Software\\" + sProductKey);
			if(RK == null)
			{
				RK = Registry.CurrentUser.OpenSubKey("Software",true);
				RK.CreateSubKey(sProductKey);
			}
			g_COMPORT = (string)RK.GetValue("COMPORT","COM1");

			FrmParent.Msg("Loading Card Reader Information...");

			//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();
				}
			}
#endif			
			FrmParent.Msg("Please enter Login information.");

			this.Focus();
			tbLoginName.Select();

		}