Beispiel #1
0
 private void ProcessPlaybackCommand(string[] args)
 {
     try
     {
         OPMShortcut cmd = (OPMShortcut)Enum.Parse(typeof(OPMShortcut), args[0]);
         ShortcutMapper.DispatchCommand(cmd);
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
Beispiel #2
0
        protected bool ProcessKeyDown(Control ctlSender, Keys key, Keys modifiers)
        {
            if (modifiers == Keys.None && AllowCloseOnKeyDown(key))
            {
                DialogResult = MapDialogResult(key);
                Close();
                return(false);
            }
            else
            {
                OPMShortcut cmd = ShortcutMapper.MapCommand(key);
                if (IsShortcutAllowed(cmd))
                {
                    ShortcutMapper.DispatchCommand(cmd);
                    return(false);
                }
            }

            return(true);
        }
        private void OnButtonPressed(object sender, EventArgs e)
        {
            ToolStripButton btn = sender as ToolStripButton;

            if (btn != null)
            {
                try
                {
                    OPMShortcut cmd = (OPMShortcut)btn.Tag;
                    ShortcutMapper.DispatchCommand(cmd);
                }
                catch (Exception ex)
                {
                    ErrorDispatcher.DispatchError(ex, false);
                }
                finally
                {
                    UpdateStateButtons();
                }
            }
        }
        private void OnSettingsChanged(object sender, EventArgs e)
        {
            try
            {
                Modified = true;

                if (sender == chkEnablePlaylistEvt)
                {
                    ShortcutMapper.DispatchCommand(OPMShortcut.CmdPlaylistEnd);
                }

                UnsubscribeAll();

                SystemScheduler.PlaylistEventEnabled = chkEnablePlaylistEvt.Checked;
                ManageVisibility();
            }
            finally
            {
                SubscribeAll();
            }
        }
Beispiel #5
0
        protected override void WndProc(ref Message m)
        {
            try
            {
                if (m.Msg == (int)Messages.WM_COMMAND)
                {
                    if (ThumbButton.Clicked == User32.HIWORD((long)m.WParam))
                    {
                        int id = User32.LOWORD((long)m.WParam);

                        if (!MainThread.AreModalFormsOpen)
                        {
                            ShortcutMapper.DispatchCommand((OPMShortcut)id);

                            // If an application processes this message, it should return zero.
                            m.Result = IntPtr.Zero;
                        }
                    }
                }
            }
            catch { }

            base.WndProc(ref m);
        }
 private void tXTAPPHELPToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ShortcutMapper.DispatchCommand(OPMShortcut.CmdOpenHelp);
 }
 private void btnSettings_Click(object sender, EventArgs e)
 {
     ShortcutMapper.DispatchCommand(OPMShortcut.CmdOpenSettings);
 }
Beispiel #8
0
        public void HandlePlaylistItemMenuClick(object sender, EventArgs e)
        {
            OPMToolStripMenuItem senderMenu = (sender as OPMToolStripMenuItem);

            if (senderMenu != null)
            {
                try
                {
                    senderMenu.Enabled = false;

                    if (senderMenu.Tag != null)
                    {
                        if (senderMenu.Tag is PlaylistSubItem)
                        {
                            if (senderMenu.Tag is DvdSubItem)
                            {
                                DvdSubItem            si   = senderMenu.Tag as DvdSubItem;
                                DvdRenderingStartHint hint =
                                    (si != null) ?
                                    si.StartHint as DvdRenderingStartHint : null;

                                if (hint != null && hint.IsSubtitleHint)
                                {
                                    MediaRenderer.DefaultInstance.SubtitleStream = hint.SID;
                                    return;
                                }
                            }

                            if (senderMenu.Tag is AudioCdSubItem)
                            {
                                CDAFileInfo cdfi = (senderMenu.Tag as AudioCdSubItem).Parent.MediaFileInfo as CDAFileInfo;
                                if (cdfi != null)
                                {
                                    cdfi.RefreshDisk();
                                    EventDispatch.DispatchEvent(LocalEventNames.UpdatePlaylistNames, true);
                                }
                            }
                            else
                            {
                                PlaylistSubItem psi = senderMenu.Tag as PlaylistSubItem;
                                if (psi != null && psi.StartHint != null)
                                {
                                    JumpToPlaylistSubItem(senderMenu.Tag as PlaylistSubItem);
                                }
                            }
                        }
                        else if (senderMenu.Tag is PlaylistItem)
                        {
                            JumpToPlaylistItem(senderMenu.Tag as PlaylistItem);
                        }
                        else
                        {
                            ShortcutMapper.DispatchCommand((OPMShortcut)senderMenu.Tag);
                        }
                    }
                }
                finally
                {
                    senderMenu.Enabled = true;
                }
            }
        }