public CourseUseView(CourseUseViewModel viewModel)
        {
            InitializeComponent();

            _viewModel = viewModel;
            this.DataContext = _viewModel;
            _currentDispatcher = Dispatcher.CurrentDispatcher;
            notesGrid.Loaded += new RoutedEventHandler(notesGrid_Loaded);

            //mediaElement.MediaPlayer = viewModel.VlcPlayer;
            //mediaElement.Source = new Uri(@"C:\stuff\series\Bloodline.S01E01.WEBRip.x264-2HD.mp4");
            //mediaElement.Play();

            mediaElement.OnMouseDoubleClick += mediaElement_OnMouseDoubleClick;

            mediaElement.Attach();
        }
        public static void HandleWindowKeypressForBothViews(object sender, KeyEventArgs e, Dispatcher _currentDispatcher, NotesGridControl notesGrid, CourseUseViewModel _viewModel, bool IsVisible, Action<ShowMessage> SendShowMessage)
        {
            var matches = SettingManager.CheckHotkey(e);

            if (null != matches && matches.Count > 0)
            {
                foreach (var match in matches)
                {
                    switch (match.Function)
                    {
                        case HotkeyFunction.NoteEditBegin:
                            if (notesGrid.IsEditing)
                            {
                                notesGrid.UpdateLayout();
                                notesGrid.CommitEdit();
                            }

                            SendShowMessage(new ShowMessage() { Show = true, Source = ShowSource.Hotkey });

                            notesGrid.BeginEditNewNote();
                            e.Handled = true;
                            break;
                        case HotkeyFunction.NoteEditCommit:
                            //commit the current edit, and hide the controls
                            if (notesGrid.IsEditing)
                            {
                                notesGrid.UpdateLayout();
                                notesGrid.CommitEdit();
                            }
                            notesGrid.UpdateLayout();
                            SendShowMessage(new ShowMessage() { Show = false, Source = ShowSource.Hotkey });
                            e.Handled = true;
                            break;
                        case HotkeyFunction.NoteEditCancel:
                            //cancel the current edit, and hide the controls
                            if (notesGrid.IsEditing)
                            {
                                notesGrid.CancelEdit();
                            }
                            notesGrid.UpdateLayout();
                            SendShowMessage(new ShowMessage() { Show = false, Source = ShowSource.Hotkey });
                            e.Handled = true;
                            break;
                        case HotkeyFunction.NoteSetStartTime:
                            if (IsVisible)
                            {
                                Note currentNote = notesGrid.CurrentSelectedNote;
                                bool isDirty = currentNote.IsDirty;
                                if (false == isDirty)
                                {
                                    currentNote.BeginEdit();
                                }
                                _viewModel.SetNoteStartTimeCommand.Execute(currentNote);
                                if (false == isDirty)
                                {
                                    currentNote.EndEdit();
                                }

                                e.Handled = true;
                            }
                            break;
                        case HotkeyFunction.NoteRating:
                            if (IsVisible)
                            {
                                Note currentNote = notesGrid.CurrentSelectedNote;
                                bool isDirty = currentNote.IsDirty;
                                if (false == isDirty)
                                {
                                    currentNote.BeginEdit();
                                }
                                if (currentNote.Rating == match.Rating)
                                {
                                    currentNote.Rating = null;
                                }
                                else
                                {
                                    currentNote.Rating = match.Rating;
                                }
                                if (false == isDirty)
                                {
                                    currentNote.EndEdit();
                                }

                                e.Handled = true;
                            }
                            break;
                        case HotkeyFunction.NoteDelete:
                            if (IsVisible)
                            {
                                //if it's not the placeholder row, get delete confirmation, and delete the note.
                                if (notesGrid.noteDataGrid.SelectedItem.ToString() != Constants.NEW_ITEM_PLACEHOLDER_NAME)
                                {
                                    MessageBoxResult result = MessageBox.Show("Are you sure you wish to delete the note?", "Note deletion confirmation", MessageBoxButton.YesNo);
                                    if (result == MessageBoxResult.Yes)
                                    {
                                        Note currentNote = notesGrid.CurrentSelectedNote;
                                        notesGrid.DeleteSelectedNote.Execute(currentNote);
                                    }
                                }
                                e.Handled = true;
                            }
                            break;
                        case HotkeyFunction.FindText:
                            notesGrid.OpenFindTextPanel();
                            break;
                    }
                }
            }
        }