public SmartSearchLibUC(APPLICATION_DATA appData, ABORT_CLOSE giveup) { InitializeComponent(); m_AppData = appData; m_AppData.AddOnClosing(OnClose,APPLICATION_DATA.CLOSE_ORDER.FIRST); m_Log = (ErrorLog)m_AppData.Logger; GiveUp = giveup; m_PathManager= (PATHS) m_AppData.PathManager ; textBoxMinMatch.Text = "0"; m_SearchTool = new SearchLib(m_AppData); this.Text = "Smart Search"; m_ZoomTrackLock = new object(); trackBarZoomControl.Minimum = 0; trackBarZoomControl.Maximum = 1000; buttonUndoDelete.Enabled = false; dataGridView1.KeyDown += new KeyEventHandler(dataGridView1_KeyDown); dataGridView1.CellClick +=new DataGridViewCellEventHandler(dataGridView1_CellContentClick); // mouse click on cell dataGridView1.SelectionChanged += new EventHandler(dataGridView1_SelectionChanged); // support cell selection changes by keyboard (i.e. not by mouse click) dataGridView1.Columns["time"].DefaultCellStyle.Format = m_AppData.TimeFormatStringForDisplay;// "dd MMM yyyy, HH: mm: ss: ffff"; m_SearchStatusDisplay = new SearchStatusDisplayUC(m_AppData, UserCanceledSearch); m_SearchStatusDisplay.Location = new Point(594, 55); this.Controls.Add(m_SearchStatusDisplay); }
public SearchLib(APPLICATION_DATA appData) { m_SearchStopped = true; m_AppData = appData; m_PathManager =(PATHS) m_AppData.PathManager; m_EventLogs = new EventLogFiles.EventLogFiles(m_AppData); }
public EventLogFiles(APPLICATION_DATA appData) { m_AppData = appData; m_PathManager =(PATHS) m_AppData.PathManager; lineFields = new string[6]; m_FileLock = new object(); }
public ImportImageDrive(APPLICATION_DATA appData) { InitializeComponent(); m_AppData = appData; m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.MIDDLE); m_Log = (ErrorLog)m_AppData.Logger; m_PathManager = (PATHS)m_AppData.PathManager; m_DVR = (DVR)m_AppData.DVR; m_CancelMove = new CancelObject(); m_CancelMove.cancel = false; }
public Player(APPLICATION_DATA appData) { InitializeComponent(); m_AppData = appData; m_AppData.AddOnClosing(Stop,APPLICATION_DATA.CLOSE_ORDER.FIRST); m_Paths = (PATHS)m_AppData.PathManager; jpegArrayLock = new object(); dateTimeStartTime.Format = DateTimePickerFormat.Custom; dateTimeStartTime.CustomFormat = m_timeFormat; dateTimeEndTime.Format = DateTimePickerFormat.Custom; dateTimeEndTime.CustomFormat = m_timeFormat; listBoxSelectImageStore.SelectedIndexChanged += new EventHandler(listBoxSelectImageStore_SelectedIndexChanged); listBoxSelectImageStore.Click += new EventHandler(listBoxSelectImageStore_Click); listBoxSelectPSS.SelectedIndexChanged += new EventHandler(listBoxSelectPSS_SelectedIndexChanged); listBoxSelectSource.SelectedIndexChanged += new EventHandler(listBoxSelectSource_SelectedIndexChanged); trackBar1.SetRange(0, 100); }
public AnalystsWorkstationMainForm() { InitializeComponent(); m_LPRCore = new LPRServiceEntryPoint(); m_AppData = m_LPRCore.GetAppData(); this.Text = "First Evidence Plate Analysts Workstation, version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); /// /// enable LPR Diagnostics /// if (Application.ExecutablePath.Contains("Visual Studio")) // assumes I am debugging on Vista { m_AppData.LPRDiagEnabled = true; } else { m_AppData.LPRDiagEnabled = false; } m_AppData.LPRDiagEnabled = false; // Remove Diagnostic tabs if not in diag mode if (!m_AppData.LPRDiagEnabled) { tabControlMain.TabPages.Remove(tabPageLPRDiagnostics); tabControlMain.TabPages.Remove(tabPageOCRLib); } else { OCRSourceFolder = UserSettings.Get(UserSettingTags.AW_OCRLibSourceDirectory); labelOCRSourceFolder.Text = OCRSourceFolder; OCRDestinationFolder = UserSettings.Get(UserSettingTags.AW_OCRLibDestinationDirectory); labelOCRDestinationFolder.Text = OCRDestinationFolder; } //// need some channel names assigned as place holders, off-line processing simulates hardware channels to the rest of the chain //for (int i = 0; i < m_AppData.MAX_VIRTUAL_CHANNELS; i++) // UserSettings.Set(UserSettingTags.ChannelNames.Name(i), i.ToString()); // allow parallel processing based on the number of cores. The ProcessorCount returns the number of cores m_AppData.MAX_VIRTUAL_CHANNELS = Math.Min(Environment.ProcessorCount,m_AppData.MAX_PHYSICAL_CHANNELS); m_DataGridRowIndex = new ThreadSafeHashTable(m_AppData.MAX_MOVIE_FILES_TO_LOAD); m_AppData.MoviePlayerParentForm = (object)this; m_AppData.RunninAsService = false; m_LPRCore.Start(m_AppData.RunninAsService); m_LPREngine = (LPREngine)m_AppData.LPREngine; m_LPREngine.OnNewFilteredPlateGroupEvent += new LPREngine.NewPlateEvent(m_LPREngine_OnNewPlateEvent); m_Log = (ErrorLog)m_AppData.Logger; m_FrameGenerator = (FrameGenerator)m_AppData.FrameGenerator; this.FormClosing += new FormClosingEventHandler(AnalystsWorkstationMainForm_FormClosing); m_PathManager = (PATHS)m_AppData.PathManager; m_DVR = (DVR)m_AppData.DVR; m_SmartSearchUC = new SmartSearchLibUC(m_AppData, OnSearchFatalError); m_SmartSearchUC.Location = new Point(0, 0); m_SmartSearchUC.Dock = DockStyle.Fill; CreateBatchModeVideoDisplayPanels(); m_FrameGenerator.MovieFileController.DisplayPanels = m_VideoDisplayPanels; m_FrameGenerator.MovieFileController.OnStatusUpdateFromPlayerEvent += new MovieFiles.OnStatusUpdateFromPlayer(MovieFileController_OnStatusUpdateFromPlayerEvent); tabPageSearch.Controls.Add(m_SmartSearchUC); InitMainContainerGrid(dataGridViewFilesInProcess, new System.Drawing.Size(761, 200), new System.Drawing.Point(273, 483)); m_EditModePictureSelectionViewer = new ListView(); m_EditModePictureSelectionViewer.Location = new Point(219, 200); m_EditModePictureSelectionViewer.View = View.LargeIcon; m_EditModePictureSelectionViewer.Size = new Size(this.Size.Width - 275, this.Size.Height - 300); m_EditModePictureSelectionViewer.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(m_EditModePictureSelectionViewer_ItemSelectionChanged); buttonListViewVisible.Text = m_ShowThumbNails; m_EditModePictureSelectionViewer.Enabled = false; m_EditModePictureSelectionViewer.Visible = false; m_EditModePictureSelectionViewer.SendToBack(); tabPageEditMode.Controls.Add(m_EditModePictureSelectionViewer); tabControlLPRResults.TabPages.Clear(); // get DVR storage mode for the batch and edit mode processing string sm = UserSettings.Get(UserSettingTags.DVR_StorageMode); if (sm != null) { if (sm.Contains(UserSettingTags.DVR_StorageModeValueStoreOnMotion)) { m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_MOTION; radioButtonStoreOnMotion.Checked = true; radioButtonStoreOnPlate.Checked = false; } else { radioButtonStoreOnMotion.Checked = false; radioButtonStoreOnPlate.Checked = true; m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_PLATE_FOUND; } } else { radioButtonStoreOnMotion.Checked = false; radioButtonStoreOnPlate.Checked = true; m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_PLATE_FOUND; } // by default, store batch outputs to repository radioToRepository.Checked = true; radioButtonToUserSpecifiedStorage.Checked = false; m_AppData.DVR_StoreToUserSpecifiedFolder = false; // now see if the user has previously chosen to store to specific folder -- get the user specified (if present) storage path for batch and edit mode processing string p = UserSettings.Get(UserSettingTags.DVR_UserSpecifiedStoragePath); if (p != null) { if (p.Contains(UserSettingTags.BOOL_TRUE)) { // the user want the batch processing results to go to a special folder and not the repository radioToRepository.Checked = false; string s = UserSettings.Get(UserSettingTags.DVR_UserSpecifiedStoragePath); if (s == null) { // error condition, the config setting says use userspecfifiedstorage, but the path is not there UserSettings.Set(UserSettingTags.DVR_StoreToUserSpecifiedFolder, UserSettingTags.BOOL_FALSE); radioButtonToUserSpecifiedStorage.Checked = false; string drive = null; if (m_PathManager.Drive == null) drive = "No repository found"; else drive = m_PathManager.Drive; textBoxUserSpecifiedStorageLocation.Text = drive; } else { // the good condition, all as it should be m_AppData.DVR_UserSpecifiedStoragePath = s; textBoxUserSpecifiedStorageLocation.Text = s; } } else { // the auto condition, use the DVRSTORAGE default storage area to put images and results into radioButtonToUserSpecifiedStorage.Checked = false; string drive = null; if (m_PathManager.Drive == null) { // if the user has configured a standard repository, then create one in the default user data folder string dirPath = Application.UserAppDataPath + "\\DVRSTORAGE"; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(Application.UserAppDataPath + "\\DVRSTORAGE"); } drive = m_PathManager.Drive; } else { drive = m_PathManager.Drive; } textBoxUserSpecifiedStorageLocation.Text = drive; } } // display to the user the time stamps from the processed images so that user has a clue where to find // this images when searching in the search tool { int consumerID = ((FrameGenerator)m_AppData.FrameGenerator).GetNewConsumerID(); int maxChannels = ((FrameGenerator)m_AppData.FrameGenerator).GetNumberOfPhysicalChannels(); for (int c = 0; c < maxChannels; c++) ((FrameGenerator)m_AppData.FrameGenerator).RegisterToConsumeChannel(consumerID, c, OnReceiveNewFrameToExtractTimeStamp); // get callback on new frames m_ToDisplayProcessedTimeStampsQ = new ThreadSafeQueue<FRAME>(240); // store the frames into a Q when calledback. m_DisplayBatchTimeStampsThread = new Thread(DisplayBatchTimeStampsLoop); // empty the Q with this thread, dump to the listbox for user display m_DisplayBatchTimeStampsThread.Start(); } // install the user control to allow the user to import images from a field drive m_ImportImageDrive = new ImportImageDrive(m_AppData); tabPageImportImages.Controls.Add(m_ImportImageDrive); // show the results of LPR strings to the user m_LPRResultsToPostQ = new ThreadSafeQueue<LPR_RESULT_TO_POST>(100); m_LPRPostResultsThread = new Thread(LPRPostResultsLoop); m_LPRPostResultsThread.Start(); // keep tabs on the repository - find one and keep checking for lost drives m_CheckRepositoryStatusThread = new Thread(CheckRepositoryLoop); m_CheckRepositoryStatusThread.Start(); // m_LPRCore.OnSelfDestruct += CloseThis; }
/// <summary> /// handles status updates from PATHS.GetAllJpegsInRange() /// </summary> /// <param name="getStatus"></param> void HandleDumpAllJpegsProgressUpdate(PATHS.PATHS_GET_STATUS getStatus) { SEARCH_STATUS status = new SEARCH_STATUS(); status.phase = SEARCH_PHASE.FINDING_ITEMS_IN_TIME_RANGE; status.currentCount = 0; status.totalCount = 0; status.currentTime = getStatus.currentTime; status.endTime = m_SearchEndTime; status.startTime = m_SearchStartTime; status.errorString = getStatus.errors; if (getStatus.errors != null) { status.errorCode = SEARCH_ERROR_CODES.LOG_FILE_PARSE_ERROR; } m_SearchProgressCB(status); }
// constructor public DVR(APPLICATION_DATA appData) { try { m_AppData = appData; m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.MIDDLE); m_Log = (ErrorLog)m_AppData.Logger; PauseFlag = new PAUSE_FLAG(); PauseFlag.Pause = true; FileAccessControl = new FILE_SYSTEM_ACCESS(PauseFlag, m_AppData); try { Paths = new PATHS(m_AppData.ThisComputerName, true, m_AppData); m_AppData.PathManager = (object)Paths; } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } m_EventLogFile = new EventLogFiles.EventLogFiles(m_AppData); // PRE MOTION BUFFER LENGHT m_NumberOfFramesToPrePostBuffer = 30; // this many frames before and after moton event, if too small, files may be erased before motion is detected because of processing lag //////// m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_DriveName].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_DriveReady].boolean.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_FreeSpace].SnapshotDouble.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_UsedSpace].SnapshotDouble.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.DVR.DVR_DriveHotSwap].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Drive].StatString.SetValue = "No drive "; m_FrameGenerator = (FrameGenerator)m_AppData.FrameGenerator; m_DriveManager = new DriveManager(m_AppData, OnExternalDriveChange, Paths.StorageDir); // alway use external storage if ( m_AppData.RunninAsService) { int count = 0; Paths.Drive = m_DriveManager.GetDrive(ref count); PauseFlag.DriveExists = true; if (count > 1) { PauseFlag.Pause = true; m_Log.Log("Too many external drives on start", ErrorLog.LOG_TYPE.FATAL); //m_MessageBoxMessage = "Too many external drives on start. Please connect only one external drive and re-start the LPR Service."; //RunMessageBoxDialog(); } else if (Paths.Drive == null) { PauseFlag.Pause = true; m_Log.Log("External Drive not found", ErrorLog.LOG_TYPE.FATAL); // m_MessageBoxMessage = "External drive not found. Please connect one external drive"; PauseFlag.DriveExists = false; // RunMessageBoxDialog(); } } m_ConsumerID = m_FrameGenerator.GetNewConsumerID(); m_NewFrameQ = new ThreadSafeQueue<FRAME>(240, "QueueOverruns_DVR_NewFrameQ", m_AppData); m_MotionDetectedQ = new ThreadSafeQueue<FRAME>(240, "QueueOverruns_DVR_MotionDetectedQ", m_AppData); m_DirectyToStorageQ = new ThreadSafeQueue<FRAME>(240, "QueueOverruns_DVR_DirectyToStorageQ", m_AppData); m_NewLPRRecordQ = new ThreadSafeQueue<FRAME>(m_LPRRecordQueLen, "QueueOverruns_DVR_NewLPRRecordQ", m_AppData); m_TempFileList = new ThreadSafeList<TEMPFILES>(120); m_NumSourceChannels = (m_AppData.RunninAsService) ? m_AppData.MAX_PHYSICAL_CHANNELS : m_AppData.MAX_VIRTUAL_CHANNELS; m_PreMotionRecords = new PRE_MOTION_RECORDS[m_NumSourceChannels]; m_DVRLoopThread = new Thread(DVRLoop); m_ReportDVRStats = new Thread(ReportDVRStatusLoop); m_TempFileCleanUpThread = new Thread(TempFilesCleanUpLoop); m_MaintainFileSystemSizeLimit = new Thread(MaintainFileSystemSizeLimitLoop); } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }
/// <summary> /// Given an image source file path, merge it into a destination file system /// used to import files from a field drive and merge them into a central repository /// </summary> /// <param name="sourcePath"></param> /// <param name="destPath"></param> /// <param name="fd"></param> public void MoveMergeFileToDVRStorage(PATHS.IMAGE_FILE_DATA srcFd, PATHS.IMAGE_FILE_DATA destFd) { if (PauseFlag.Pause) return; try { FileInfo fi = new FileInfo(srcFd.completePath); if (!FileAccessControl.DirectoryExists( destFd.dirOnly )) { char[] seperator = { '\\', '\\' }; string[] branches = destFd.dirOnly.Split(seperator); string path = null; for (int i = 0; i < branches.Count()-1; i++) // the last string in the array is the file name { if (branches[i].Length < 1) continue; path += (branches[i] + "\\"); if ( ! FileAccessControl.DirectoryExists(path)) { FileAccessControl.CreateDirectory(path); } } } Paths.AccumulatedSize += fi.Length; FileAccessControl.FileMove( srcFd.completePath , destFd.completePath); } catch (Exception ex) { m_Log.Log("CopyFileToDVRStorage ex :" + ex.Message, ErrorLog.LOG_TYPE.FATAL); } }