private void BindUserControl(string driveLetter) { DirectoryInfo dirInfo = new DirectoryInfo(driveLetter); FileInfo[] allFiles = dirInfo.GetFiles("*.MP4", SearchOption.AllDirectories); List<CodeITDL.File> list = new List<CodeITDL.File>(); foreach (FileInfo fi in allFiles) { list.Add(new CodeITDL.File() { OriginalFileName = fi.Name, OriginalFileLocation = fi.FullName, NewFileName = Guid.NewGuid().ToString().Replace("-", string.Empty), OriginalFileDate = fi.CreationTime, isFromCard = false, UserName = fi.Name }); //list.Add(new demo() { Date = fi.CreationTime.ToString(), Name = fi.Name, UniqueId = string.Format("{0}_{1}", fi.Name, new Random().Next(1, 1000)), FullPath = fi.FullName, HasNote = false, isFromCard = false, Note = string.Empty }); } if (uploadForm == null) uploadForm = new frmUploadForm(); ucUserVideos uv = uploadForm.getUserVideosConrtol; uv.ContextMenuClick -= uv_ContextMenuClick; uv.ContextMenuClick += uv_ContextMenuClick; uv.lvItemsContainer.ContextMenu.Visibility = System.Windows.Visibility.Hidden; uv.lvItemsContainer.ContextMenu.IsOpen = false; uv.IsUpload = true; uv.lvItemsContainer.ItemsSource = list; }
public void DeviceDisconnected() { if (uploadForm == null) uploadForm = new frmUploadForm(); ucUserVideos uv = uploadForm.getUserVideosConrtol; uv.lvItemsContainer.ItemsSource = new List<string>(); //throw new NotImplementedException(); }
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; }
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; } }