public MainHandler(MainControl view) { control = view; // Shadow box control.shadowBoxCancelButton.Click += shadowBoxCancel_Click; // Media control.mediaStatusBar.Background = Defaults.Brushes.Highlight; MediaBoxStatic.OnBoxChange += onMediaBoxChange; control.mediaVolumeControl.volumeSlider.ValueChanged += mediaVolumeControl_ValueChanged; control.mediaCloseButton.Click += mediaBoxCloseButton_Click; // Signal control.signalStatusBar.Background = Defaults.Brushes.Highlight; control.signalSettingsButton.Click += signalSettingsButton_Click; control.signalStatsButton.Click += signalStatsButton_Click; control.signalStatusDimComboBox.SelectionChanged += signalDimComboBox_SelectionChanged; control.signalStatusDimComboBox.SelectionChanged += signalDimComboBox_SelectionChanged; control.signalVolumeControl.volumeSlider.ValueChanged += signalVolumeControl_ValueChanged; control.signalCloseButton.Click += signalTrackCloseButton_Click; SignalTrackStatic.OnTrackChange += onSignalTrackChange; control.signalAndAnnoGrid.MouseDown += signalAndAnnoGrid_MouseDown; // Anno control.annoStatusBar.Background = Defaults.Brushes.Highlight; control.annoCloseButton.Click += annoTierCloseButton_Click; control.annoSettingsButton.Click += annoSettingsButton_Click; control.annoListControl.annoDataGrid.SelectionChanged += annoList_SelectionChanged; control.annoListControl.editButton.Click += annoListEdit_Click; control.annoListControl.editTextBox.KeyDown += annoListEdit_KeyDown; control.annoListControl.editTextBox.GotMouseCapture += annoListEdit_Focused; AnnoTierStatic.OnTierChange += onAnnoTierChange; AnnoTierStatic.OnTierSegmentChange += changeAnnoTierSegmentHandler; control.annoTierControl.MouseDown += annoTierControl_MouseDown; control.annoTierControl.MouseMove += annoTierControl_MouseMove; control.annoTierControl.MouseUp += annoTierControl_MouseRightButtonUp; control.annoLiveModeCheckBox.Checked += annoLiveMode_Changed; control.annoLiveModeCheckBox.Unchecked += annoLiveMode_Changed; control.annoLiveModeActivateMouse.Checked += annoLiveModeActiveMouse_Checked; control.annoLiveModeActivateMouse.Unchecked += annoLiveModeActiveMouse_Unchecked; // Geometric control.geometricListControl.editButton.Click += geometricListEdit_Click; control.geometricListControl.editTextBox.GotMouseCapture += geometricListEdit_Focused; control.geometricListControl.copyButton.Click += geometricListCopy_Click; control.geometricListControl.selectAllButton.Click += geometricListSelectAll_Click; control.geometricListControl.geometricDataGrid.SelectionChanged += geometricList_Selection; control.geometricListControl.MenuItemDeleteClick.Click += geometricListDelete; control.geometricListControl.KeyDown += geometricKeyDown; control.geometricListControl.Visibility = Visibility.Collapsed; // Menu control.menu.MouseEnter += tierMenu_MouseEnter; control.annoSaveMenu.Click += annoSave_Click; control.annoNewMenu.Click += navigatorNewAnno_Click; control.annoSaveAsFinishedMenu.Click += annoSaveAsFinished_Click; control.annoReloadMenu.Click += annoReload_Click; control.annoReloadBackupMenu.Click += annoReloadBackup_Click; control.annoExportMenu.Click += annoExport_Click; control.annoSaveAllMenu.Click += annoSaveAll_Click; control.loadFilesMenu.Click += loadFiles_Click; control.fileSaveProjectMenu.Click += fileSaveProject_Click; control.fileLoadProjectMenu.Click += fileLoadProject_Click; control.exportSamplesMenu.Click += exportSamples_Click; control.exportToGenie.Click += exportToGenie_Click; control.exportAnnoToCSVMenu.Click += exportAnnoToCSV_Click; control.exportAnnoToXPSMenu.Click += exportAnnoToXPS_Click; control.exportAnnoToPNGMenu.Click += exportAnnoToPNG_Click; control.exportSignalToCSVMenu.Click += exportSignalToCSV_Click; control.exportSignalToXPSMenu.Click += exportSignalToXPS_Click; control.exportSignalToPNGMenu.Click += exportSignalToPNG_Click; control.convertAnnoContinuousToDiscreteMenu.Click += convertAnnoContinuousToDiscrete_Click; control.convertAnnoToSignalMenu.Click += convertAnnoToSignal_Click; control.convertSignalToAnnoContinuousMenu.Click += convertSignalToAnnoContinuous_Click; control.removeRemainingSegmentsMenu.Click += removeRemainingSegmentsMenu_Click; control.databaseLoadSessionMenu.Click += databaseLoadSession_Click; control.databaseCMLCompleteStepMenu.Click += databaseCMLCompleteStep_Click; control.databaseCMLFusionMenu.Click += databaseCMLFusion_Click; control.databaseCMLFusionMenuPredict.Click += databaseCMLFusionPredict_Click; control.databaseCMLExtractFeaturesMenu.Click += databaseCMLExtractFeatures_Click; control.databaseCMLMergeFeaturesMenu.Click += databaseCMLMergeFeatures_Click; control.databaseCMLTrainAndPredictMenu.Click += databaseCMLTrainAndPredict_Click; control.databaseManageUsersMenu.Click += databaseManageUsers_Click; control.databaseManageDBsMenu.Click += databaseManageDBs_Click; control.databaseManageSessionsMenu.Click += databaseManageSessions_Click; control.databaseManageAnnotationsMenu.Click += databaseManageAnnotations_Click; control.databaseCMLMergeAnnotationsMenu.Click += databaseCMLMergeAnnotations_Click; control.showSettingsMenu.Click += showSettings_Click; control.helpDocumentationMenu.Click += helpDocumentationMenu_Click; control.helpShortcutsMenu.Click += helpShortcutsMenu_Click; control.updateApplicationMenu.Click += updateApplication_Click; control.updateCMLMenu.Click += updateCML_Click; control.updatePythonMenu.Click += updatePython_Click; control.aboutMenu.Click += aboutMenu_Click; //PYTHON if (ENABLE_PYTHON) { startExplainableThread(); } control.explanationWindow.Click += explanationWindow_Click; control.explanationWindowInnvestigate.Click += explanationWindowInnvestigate_Click; control.XAIMenu.Visibility = control.updatePythonMenu.Visibility = (MainHandler.ENABLE_PYTHON ? Visibility.Visible : Visibility.Collapsed); // Navigator control.navigator.newAnnoButton.Click += navigatorNewAnno_Click; control.navigator.clearButton.Click += navigatorClearSession_Click; control.navigator.jumpFrontButton.Click += navigatorJumpFront_Click; control.navigator.playButton.Click += navigatorPlay_Click; control.navigator.jumpEndButton.Click += navigatorJumpEnd_Click; control.navigator.fastForwardButton.Click += fastForwardButton_Click; control.navigator.fastBackwardButton.Click += fastBackwardButton_Click; // Timeline timeline = new Timeline(); timeline.SelectionInPixel = control.signalAndAnnoAdorner.ActualWidth; control.signalAndAnnoAdorner.SizeChanged += signalAndAnnoControlSizeChanged; control.timeLineControl.rangeSlider.OnTimeRangeChanged += control.timeLineControl.timeTrack.TimeRangeChanged; control.timeLineControl.rangeSlider.OnTimeRangeChanged += control.timeLineControl.timeTrackSelection.TimeRangeChanged; control.timeLineControl.rangeSlider.OnTimeRangeChanged += Time.TimelineChanged; control.timeLineControl.rangeSlider.Update(); //Gamepad connectController(); // Database control.databaseUpdateMenu.Click += DatabaseUpdateMenu_Click; control.databaseConnectMenu.Click += DatabaseConnectMenu_Click; control.databasePasswordMenu.Click += DatabasePassMenu_Click; if (Properties.Settings.Default.DatabaseAutoLogin) { databaseConnect(); } else { updateNavigator(); } // Mouse control.MouseWheel += (sender, args) => { if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { if (args.Delta > 0) { control.timeLineControl.rangeSlider.MoveAndUpdate(true, 0.2f); } else if (args.Delta < 0) { control.timeLineControl.rangeSlider.MoveAndUpdate(false, 0.2f); } } }; // Player playTimer = new DispatcherTimer(); playTimer.Tick += PlayTimer_Tick; // Cursor initCursor(); // Update bool alreadycheckedcmlupdate = false; if (Properties.Settings.Default.CheckUpdateOnStart && Properties.Settings.Default.LastUpdateCheckDate.Date != DateTime.Today.Date) { alreadycheckedcmlupdate = true; Properties.Settings.Default.LastUpdateCheckDate = DateTime.Today.Date; Properties.Settings.Default.Save(); checkForUpdates(true); checkForCMLUpdates(true); } //Download Hardware Video Acceleration Library, if not present yet. string hardwareAcceleratorLibrary = "EVRPresenter64.dll"; string hardwareAcceleratorLibraryPath = AppDomain.CurrentDomain.BaseDirectory + hardwareAcceleratorLibrary; if (!(File.Exists(hardwareAcceleratorLibraryPath))) { DownloadFile("https://github.com/hcmlab/nova/raw/master/" + hardwareAcceleratorLibrary, hardwareAcceleratorLibraryPath); } string cmltrainexe = "cmltrain.exe"; string cmltrainexePath = AppDomain.CurrentDomain.BaseDirectory + cmltrainexe; if (!(File.Exists(cmltrainexePath)) && !alreadycheckedcmlupdate) { checkForCMLUpdates(true); } if (Properties.Settings.Default.DatabaseDirectory == "") { Properties.Settings.Default.DatabaseDirectory = Directory.GetCurrentDirectory() + "\\data"; Properties.Settings.Default.Save(); Directory.CreateDirectory(Properties.Settings.Default.DatabaseDirectory); } if (Properties.Settings.Default.CMLDirectory == "") { Properties.Settings.Default.CMLDirectory = Directory.GetCurrentDirectory() + "\\cml"; Properties.Settings.Default.Save(); Directory.CreateDirectory(Properties.Settings.Default.CMLDirectory); } // Clear clearSignalInfo(); clearAnnoInfo(); clearMediaBox(); // allow drag and drop control.Drop += controlDrop; }
public MainHandler(MainControl view) { control = view; control.Drop += controlDrop; control.shadowBoxCancelButton.Click += shadowBoxCancel_Click; control.mediaVideoControl.RemoveMedia += new EventHandler <MediaRemoveEventArgs>(removeMedia); control.signalTrackControl.RemoveSignal += new EventHandler <SignalRemoveEventArgs>(removeSignal); control.annoListControl.annoDataGrid.SelectionChanged += annoList_SelectionChanged; control.annoListControl.editButton.Click += annoListEdit_Click; control.annoListControl.editTextBox.KeyDown += annoListEdit_KeyDown; control.annoListControl.editTextBox.GotMouseCapture += annoListEdit_Focused; control.closeAnnoTierButton.Click += closeAnnoTier_Click; // Menu control.clearSessionMenu.Click += navigatorClearSession_Click; control.saveSessionMenu.Click += saveSession_Click; control.saveProjectMenu.Click += saveProject_Click; control.showSettingsMenu.Click += showSettings_Click; control.updateApplicationMenu.Click += updateApplication_Click; control.tierMenu.MouseEnter += tierMenu_Click; control.helpMenu.Click += helpMenu_Click; control.saveAnnoMenu.Click += saveAnno_Click; control.exportSamplesMenu.Click += exportSamples_Click; control.exportTierToXPSMenu.Click += exportTierToXPS_Click; control.exportTierToPNGMenu.Click += exportTierToPNG_Click; control.exportSignalToXPSMenu.Click += exportSignalToXPS_Click; control.exportSignalToPNGMenu.Click += exportSignalToPNG_Click; control.exportAnnoToCSVMenu.Click += exportAnnoToCSV_Click; control.exportAnnoContinuousToDiscreteMenu.Click += exportAnnoContinuousToDiscrete_Click; control.exportAnnoToSignalMenu.Click += exportAnnoToSignal_Click; control.exportAnnoDiscreteToContinuouMenu.Click += exportSignalToContinuous_Click; control.exportAnnoToFrameWiseMenu.Click += exportAnnoToFrameWiseMenu_Click; control.databaseSaveSessionMenu.Click += databaseSaveSession_Click; control.databaseSaveSessionAndMarkAsFinishedMenu.Click += databaseSaveSessionAndMarkAsFinished_Click; control.databaseLoadSessionMenu.Click += databaseLoadSession_Click; control.databaseShowDownloadDirectoryMenu.Click += databaseShowDownloadDirectory_Click; control.databaseChangeDownloadDirectoryMenu.Click += databaseChangeDownloadDirectory_Click; control.databaseCMLCompleteStepMenu.Click += databaseCMLCompleteStep_Click; control.databaseCMLTransferStepMenu.Click += databaseCMLTransferStep_Click; control.databaseCMLExtractFeaturesMenu.Click += databaseCMLExtractFeatures_Click; control.databaseManageMenu.Click += databaseManage_Click; control.navigator.newAnnoButton.Click += navigatorNewAnno_Click; control.navigator.clearButton.Click += navigatorClearSession_Click; control.navigator.jumpFrontButton.Click += navigatorJumpFront_Click; control.navigator.playButton.Click += navigatorPlay_Click; control.navigator.fastForwardButton.Click += navigatorFastForward_Click; control.navigator.fastBackwardButton.Click += navigatorFastBackward_Click; control.navigator.jumpEndButton.Click += navigatorJumpEnd_Click; control.navigator.followAnnoCheckBox.Unchecked += navigatorFollowAnno_Unchecked; control.navigator.correctionModeCheckBox.Click += navigatorCorrectionMode_Click; AnnoTierStatic.OnTierChange += changeAnnoTierHandler; AnnoTierStatic.OnTierSegmentChange += changeAnnoTierSegmentHandler; SignalTrackStatic.OnChange += changeSignalTrackHandler; SignalTrackEx.OnChange += changeSignalTrackHandler; timeline = new Timeline(); timeline.SelectionInPixel = control.signalAndAnnoControl.ActualWidth; control.signalAndAnnoControl.SizeChanged += signalAndAnnoControlSizeChanged; control.timeLineControl.rangeSlider.OnTimeRangeChanged += control.timeLineControl.timeTrack.TimeRangeChanged; control.timeLineControl.rangeSlider.OnTimeRangeChanged += control.timeLineControl.timeTrackSelection.TimeRangeChanged; control.timeLineControl.rangeSlider.OnTimeRangeChanged += Time.TimelineChanged; control.timeLineControl.rangeSlider.Update(); mediaList.OnMediaPlay += mediaPlayHandler; control.MouseWheel += (sender, args) => { if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { if (args.Delta > 0) { control.timeLineControl.rangeSlider.MoveAndUpdate(true, 0.2f); } else if (args.Delta < 0) { control.timeLineControl.rangeSlider.MoveAndUpdate(false, 0.2f); } } }; initCursor(); if (Properties.Settings.Default.CheckUpdateOnStart) { checkForUpdates(true); } }