Exemplo n.º 1
0
        private void frmUserMainScreen_Load(object sender, EventArgs e)
        {
            crtUserMenu.UserMenuClickEvent -= crtUserMenu_UserMenuClickEvent;
            crtUserMenu.Upload_Click -= crtUserMenu_Upload_Click;

            crtUserMenu.UserMenuClickEvent += crtUserMenu_UserMenuClickEvent;
            crtUserMenu.Upload_Click += crtUserMenu_Upload_Click;
            if (this.InitialGoToUpload)
            {

                uploadForm = new frmUploadForm();
                uploadForm.Dock = DockStyle.Fill;
                uploadForm.ShowButtonForUpload -= uploadForm_ShowButtonForUpload;
                uploadForm.ShowButtonForUpload += uploadForm_ShowButtonForUpload;
                uploadForm.TopLevel = false;
                uploadForm_ShowButtonForUpload(sender, e, true);
                pnlPlaceHolder.Controls.Add(uploadForm);

                BindUserControl(InitialUploadPath);
                //uploadForm.SearchForVideos();
                uploadForm.Show();

            }
            else
            {
                frmArchive = new frmArchiveForm();
                frmArchive.TopLevel = false;
                pnlPlaceHolder.Controls.Add(frmArchive);
                frmArchive.Width = pnlPlaceHolder.Width;
                //frmArchive.WindowState = FormWindowState.Maximized;
                //frmArchive.Refresh();
                //frmArchive.PerformAutoScale();
                //frmArchive.
                //pnlPlaceHolder.Refresh();
                frmArchive.Show();
            }
            this.FormBorderStyle = FormBorderStyle.Sizable;
            this.WindowState = FormWindowState.Maximized;
        }
Exemplo n.º 2
0
        void crtUserMenu_UserMenuClickEvent(object sender, EventArgs e, string menuItem)
        {

            //while (pnlPlaceHolder.Controls.Count > 0)
            //    pnlPlaceHolder.Controls.RemoveAt(0);

            pnlPlaceHolder.Controls.Clear();

            switch (menuItem)
            {
                case "Archive":
                    frmArchive = new frmArchiveForm();
                    frmArchive.Dock = DockStyle.Fill;
                    frmArchive.TopLevel = false;
                    //frmArchive.BackColor = Color.Transparent;
                    pnlPlaceHolder.Controls.Add(frmArchive);
                    frmArchive.Show();
                    //frmArchive.Width = pnlPlaceHolder.Width;
                    //frmArchive.WindowState = FormWindowState.Maximized;
                    //frmArchive.Refresh();
                    //frmArchive.PerformAutoScale();
                    //frmArchive.
                    //pnlPlaceHolder.Refresh();
                    break;
                case "Upload":
                    uploadForm = new frmUploadForm();
                    uploadForm.Dock = DockStyle.Fill;
                    uploadForm.ShowButtonForUpload += uploadForm_ShowButtonForUpload;
                    uploadForm.TopLevel = false;
                    //uploadForm.BackColor = Color.Transparent;
                    uploadForm.Width = pnlPlaceHolder.Width;
                    pnlPlaceHolder.Controls.Add(uploadForm);
                    //uploadForm.SearchForVideos();
                    //uploadForm.CheckForMediaOnGoProDevice();
                    if(!Context.CheckForGoProDevice())
                    {
                        MessageBox.Show(this, "GoPro camera not detected. Please connect your camera and try again.","Info",MessageBoxButtons.OK,MessageBoxIcon.Information);
                    }
                    uploadForm.Show();
                    break;
                case "Users":
                    Administration.frmUsers frmUsers = new Administration.frmUsers();
                    frmUsers.Dock = DockStyle.Fill;
                    frmUsers.TopLevel = false;                    
                    pnlPlaceHolder.Controls.Add(frmUsers);
                    frmUsers.Show();
                    break;
                case "Settings":
                    Administration.frmSettings frmSettings = new Administration.frmSettings();
                    frmSettings.Dock = DockStyle.Fill;
                    frmSettings.TopLevel = false;
                    pnlPlaceHolder.Controls.Add(frmSettings);
                    frmSettings.Show();
                    break;
                case "Audit":
                    Administration.frmAuditLog frmAudit = new Administration.frmAuditLog();
                    frmAudit.Dock = DockStyle.Fill;
                    frmAudit.TopLevel = false;
                    pnlPlaceHolder.Controls.Add(frmAudit);
                    frmAudit.Show();                    
                    break;
				case "StorageOption":
					Administration.StorageOption frmStorgeOption = new Administration.StorageOption();
					frmStorgeOption.Dock = DockStyle.Fill;
					frmStorgeOption.TopLevel = false;
					pnlPlaceHolder.Controls.Add(frmStorgeOption);
					frmStorgeOption.Show();
					break;
                default: // LOGOUT
                    isClosingFromLogout = true;
                    List<Form> openedForms = Application.OpenForms.Cast<Form>().ToList();
                    foreach (Form frmOpened in openedForms)
                    {
                        if (frmOpened.Name == "DetectorForm") continue;
                        if (frmOpened.Name == "frmLogIn")
                        {
                            frmOpened.Show();
                            ((frmLogIn)frmOpened).ContextMenuItems(false);
                            continue;
                        }
						if (frmOpened.Name == "frmProgressStatus")
						{
							if (((frmProgressStatus)frmOpened).hasUploadCompleted)
							{
								frmOpened.Close();
							}
							else
							{
								((frmProgressStatus)frmOpened).DisableCancelButtonsOnLogout(true);
							}
							continue;
						}
						else if (frmOpened.Name == this.Name)
						{
							frmOpened.Close();
							continue;
						}
                        //frmOpened.Close();
                    }

                    LoginAudit.WriteLoginAudit(CodeITConstants.LOGOUT_SUCCESSFULL);
                    
					//this.Close();
					//this.Dispose();
					//Environment.Exit(0);              
                    break;

            }
        }