private void loadFilms() { if (txtDirectory.Text.Length <= 0) { MessageBox.Show("You must enter a start directory first.", "No Directory Found", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDirectory.Focus(); return; } var dirSelected = new DirectoryInfo(txtDirectory.Text); if (!dirSelected.Exists) { MessageBox.Show("The directory you selected does not exist.", "Directory does not Exist", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDirectory.Focus(); return; } resetForm(); lblInfo.Text = "Loading Films...please be patient"; lblInfo.Visible = true; ConnectionStringSettings setting = ConfigurationManager.ConnectionStrings["CoreContext"]; var data = new cDataAccess(setting.ConnectionString); Cursor.Current = Cursors.WaitCursor; lsvSessions.BeginUpdate(); try { if (mTree.SelectedNode != null) { if (mTree.SelectedNode.GetType() != typeof(DirectoryNode)) { MessageBox.Show("You cannot select a file from the treeview. Select a directory and try again.", "No Dir Found", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var node = (DirectoryNode)mTree.SelectedNode; if (!node.UserSecurity.canRead()) { MessageBox.Show("Your User Account Control does not allow you to read files in the selected directory. Remove UAC or contact your system Administrator.", "No Access", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!node.UserSecurity.canWrite()) { MessageBox.Show("Your User Account Control does not allow you to write to files in the selected directory. Remove UAC or contact your system Administrator.", "No Access", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //create the entry here for calling the new camera methods in a dll //getdevelopablefilms will need to accept new paramter - path mPhysicalStudio.Path = node.FullPath; List <cFilm> films = chkFilter.Checked ? mPhysicalStudio.GetDevelopableFilms(dateTimePickerFilterAfter.Value) : mPhysicalStudio.GetDevelopableFilms(null); if (films.Count == 0) { var sb = new StringBuilder(); sb.Append("The system could not decrypt files in the selected path."); sb.Append(Environment.NewLine); sb.Append("Possible Reasons:"); sb.Append(Environment.NewLine); sb.Append("1. No Files could be found, check the filter or if the path contains files."); sb.Append(Environment.NewLine); sb.Append("2. The files exists but are corrupted and cannot be decrypted."); sb.Append(Environment.NewLine); sb.Append("3. Invalid deskey or deskey not found."); MessageBox.Show(sb.ToString(), "No pictures found.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (cFilm film in films) { ListViewItem item = new ListViewItem(film.pGroup); item.SubItems.Add(film.pCreationTime != null ? film.pCreationTime.Value.ToString("yyyy-MM-dd") : "*Cannot Read Date"); item.SubItems.Add(film.pCameraDriver.pName + " " + film.pCameraDriver.pVersion); item.SubItems.Add(film.pHasErrors ? "Yes" : "No"); if (mUserId > 0) { int result; data.checkLoggedSessions(film, out result); item.BackColor = result == 1 ? Color.Purple : Color.Green; } else { item.BackColor = Color.Orange; } item.Tag = film; lsvSessions.Items.Add(item); } } } finally { lsvSessions.EndUpdate(); lblInfo.Visible = false; Cursor.Current = Cursors.Default; } }
private ListView GetUnLoggedDirectoryList() { string CameraFilePath = ConfigurationManager.AppSettings["CameraFilePath"]; if (CameraFilePath.Length <= 0) { errorWriting.WriteErrorLog("Camera File path is not properly configured in config file"); return(null); } var dirSelected = new DirectoryInfo(CameraFilePath); if (!dirSelected.Exists) { errorWriting.WriteErrorLog(CameraFilePath + ": This Camera File path does not exist."); return(null); } ListView unloggedList = new ListView(); try { mPhysicalStudio.Path = CameraFilePath; List <cFilm> films = mPhysicalStudio.GetDevelopableFilms(null); if (films.Count == 0) { var sb = new StringBuilder(); sb.Append("The system could not decrypt files in the selected path."); sb.Append(Environment.NewLine); sb.Append("Possible Reasons:"); sb.Append(Environment.NewLine); sb.Append("1. No Files could be found, check the filter or if the path contains files."); sb.Append(Environment.NewLine); sb.Append("2. The files exists but are corrupted and cannot be decrypted."); sb.Append(Environment.NewLine); sb.Append("3. Invalid deskey or deskey not found."); errorWriting.WriteErrorLog(sb.ToString()); return(null); } foreach (cFilm film in films) { ListViewItem item = new ListViewItem(film.pGroup); int result; dataAccess.checkLoggedSessions(film, out result); if (result != 1) { if (!RemoveOldFiles(film.pPath)) { item.Tag = film; item.SubItems.Add(film.pPath); errorWriting.WriteErrorLog(string.Format("File directory: {0} on machine: {1} is ready to be processed.", film.pPath, Environment.MachineName)); unloggedList.Items.Add(item); } } else { //Lets delete old directories here RemoveOldFiles(film.pPath); } } return(unloggedList); } finally { } }