Exemplo n.º 1
0
 private void btPrevious_Click(object sender, EventArgs e)
 {
     Action action = new Action();
       action.ID = Action.ActionType.ACTION_PREVFILE;
       OnAction(action);
 }
Exemplo n.º 2
0
        private bool OnAction(Action action)
        {
            if (action == null)
            return false;

              bool handled = true;
              int curRow = -1;
              switch (action.ID)
              {
            case Action.ActionType.ACTION_PAGEDOWN:
              // Scrolls the Tab Pages forward
              if (tabControlTagEdit.SelectedTabPage == tabControlTagEdit.TabPages[tabControlTagEdit.TabPages.Count - 1])
              {
            tabControlTagEdit.SelectFirstTab();
              }
              else
              {
            tabControlTagEdit.SelectNextTab();
              }
              break;

            case Action.ActionType.ACTION_PAGEUP:
              // Scrolls the Tab Pages backwards
              if (tabControlTagEdit.SelectedTabPage == tabControlTagEdit.TabPages[0])
              {
            tabControlTagEdit.SelectLastTab();
              }
              else
              {
            tabControlTagEdit.SelectPreviousTab();
              }
              break;

            case Action.ActionType.ACTION_NEXTFILE:
              if (main.TracksGridView.View.SelectedRows.Count == 1)
              {
            curRow = main.TracksGridView.View.SelectedRows[0].Index;
            _selectedRowIndex = main.TracksGridView.View.SelectedRows[0].Index;
            if ((curRow + 1) < main.TracksGridView.View.RowCount)
            {
              btApply_Click(null, new EventArgs());
              main.TracksGridView.View.Rows[curRow].Selected = false;
              main.TracksGridView.View.Rows[curRow + 1].Selected = true;
            }
              }
              break;

            case Action.ActionType.ACTION_PREVFILE:
              if (main.TracksGridView.View.SelectedRows.Count == 1)
              {
            curRow = main.TracksGridView.View.SelectedRows[0].Index;
            _selectedRowIndex = main.TracksGridView.View.SelectedRows[0].Index;
            if ((curRow - 1) >= 0)
            {
              btApply_Click(null, new EventArgs());
              main.TracksGridView.View.Rows[curRow].Selected = false;
              main.TracksGridView.View.Rows[curRow - 1].Selected = true;
            }
              }
              break;
              }
              return handled;
        }
Exemplo n.º 3
0
 private void btNext_Click(object sender, EventArgs e)
 {
     Action action = new Action();
       action.ID = Action.ActionType.ACTION_NEXTFILE;
       OnAction(action);
 }
Exemplo n.º 4
0
        /// <summary>
        ///   A Key has been pressed
        /// </summary>
        /// <param name = "e"></param>
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Enter)   // Handle Enter key as default Apply Button
              {
            btApply_Click(null, new EventArgs());
            return true;
              }

              if (keyData == Keys.Escape)  // Handle Escape to clear the form
              {
            ClearForm();
            return true;
              }

              if (keyData == (Keys.Control | Keys.C))  // Handle Copy. This would else be consumed by the grid
              {
            var ctrl = this.ActiveControl as TextBoxBase;
            if (ctrl != null)
            {
              ctrl.Copy();
              return true;
            }
              }

              Action newaction = new Action();
              if (ServiceScope.Get<IActionHandler>().GetAction(1, keyData, ref newaction))
              {
            if (OnAction(newaction))
            {
              return true;
            }
              }

              return base.ProcessCmdKey(ref msg, keyData);
        }
Exemplo n.º 5
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            // Handle the key press, if the keyvalue field is focused in Preferences
              if (tbKeyValue.Focused)
              {
            tbKeyValue.Text = Enum.GetName(typeof(Keys), keyData);
            return true;
              }

              _keyHandled = false;
              Action newaction = new Action();
              if (ServiceScope.Get<IActionHandler>().GetAction(0, keyData, ref newaction))
              {
            if (OnAction(newaction))
            {
              _keyHandled = true;

              if (_showForm && _dialog != null)
            ShowModalDialog(_dialog);

              _showForm = false;
              _dialog = null;
            }
              }
              return _keyHandled;
        }
Exemplo n.º 6
0
        private bool OnAction(Action action)
        {
            if (action == null)
            return false;

              object dialog = null;
              _dialog = null;
              _showForm = false;
              bool handled = true;
              switch (action.ID)
              {
            case Action.ActionType.ACTION_HELP:
              Process.Start(Options.HelpLocation);
              break;

            case Action.ActionType.ACTION_EXIT:
              Application.Exit();
              break;

            case Action.ActionType.ACTION_SAVE:
              gridViewControl.Save();
              break;

            case Action.ActionType.ACTION_SAVEALL:
              gridViewControl.SaveAll();
              break;

            case Action.ActionType.ACTION_FILENAME2TAG:
              if (!gridViewControl.CheckSelections(true))
            break;

              dialog = new FileNameToTag.FileNameToTag(this);
              ShowDialogInDetailPanel(dialog);
              _showForm = false;
              break;

            case Action.ActionType.ACTION_TAG2FILENAME:
              if (!gridViewControl.CheckSelections(true))
            break;

              dialog = new TagToFileName.TagToFileName(this);
              ShowDialogInDetailPanel(dialog);
              _showForm = false;
              break;

            case Action.ActionType.ACTION_IDENTIFYFILE:
              if (!gridViewControl.CheckSelections(true))
            break;

              gridViewControl.IdentifyFiles();
              break;

            case Action.ActionType.ACTION_TAGFROMINTERNET:
              if (!gridViewControl.CheckSelections(true))
            break;

              InternetLookup.InternetLookup lookup = new InternetLookup.InternetLookup(this);
              lookup.SearchForAlbumInformation();
              tagEditControl.FillForm();
              SetGalleryItem();
              break;

            case Action.ActionType.ACTION_ORGANISE:
              if (!gridViewControl.CheckSelections(true))
            break;

              dialog = new OrganiseFiles(this);
              ShowDialogInDetailPanel(dialog);
              _showForm = false;
              break;

            case Action.ActionType.ACTION_GETCOVERART:
              if (gridViewControl.CheckSelections(true))
            gridViewControl.GetCoverArt();
              break;

            case Action.ActionType.ACTION_GETLYRICS:
              if (gridViewControl.CheckSelections(true))
            gridViewControl.GetLyrics();
              break;

            case Action.ActionType.ACTION_OPTIONS:
              this.backstageView.Visible = true;
              this.backstageView.CurrentPage = backstageViewPageOptions;
              break;

            case Action.ActionType.ACTION_SELECTALL:
              TreeNodePath node = treeViewControl.TreeView.SelectedNode as TreeNodePath;
              if (node != null)
            gridViewControl.View.SelectAll();
              break;

            case Action.ActionType.ACTION_COPY:
              if (gridViewControl.View.CurrentCell != null)
              {
            Clipboard.SetDataObject(gridViewControl.View.CurrentCell.Value);
              }
              break;

            case Action.ActionType.ACTION_SCRIPTEXECUTE:
              ApplicationCommands.ScriptExecute.Execute();
              //ribbon.ribbonButtonScriptExecute_Click(this, new EventArgs());
              break;

            case Action.ActionType.ACTION_TREEREFRESH:
              treeViewControl.RefreshFolders();
              break;

            case Action.ActionType.ACTION_FOLDERDELETE:
              if (!_treeViewSelected)
            break;

              treeViewControl.DeleteFolder();
              break;

            case Action.ActionType.ACTION_CASECONVERSION:
              if (!gridViewControl.CheckSelections(true))
            break;

              dialog = new CaseConversion.CaseConversion(this);
              ShowDialogInDetailPanel(dialog);
              break;

            case Action.ActionType.ACTION_REFRESH:
              RefreshTrackList();
              break;

            case Action.ActionType.ACTION_DELETE:
              // Don't handle the Delete key, if the user edits directly the cell
              // let the grid control handle it
              if (gridViewControl.View.IsCurrentCellInEditMode)
              {
            handled = false;
            break;
              }

              if (_treeViewFolderSelected)
              {
            MessageBox.Show(localisation.ToString("message", "DeleteFolders"), "", MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);
            break;
              }

              // Don't handle the delete key, if the view is not focused
              // So that delete may be used on other controls as well
              if (!gridViewControl.View.Focused)
              {
            handled = false;
            break;
              }

              gridViewControl.DeleteTracks();
              break;

            case Action.ActionType.ACTION_TOGGLESTREEVIEWSPLITTER:
              splitterLeft.ToggleState();
              break;

            case Action.ActionType.ACTION_TOGGLEDATABASESPLITTER:
              splitterTop.ToggleState();
              break;

            case Action.ActionType.ACTION_TOGGLEQUICKEDIT:
              splitterBottom.ToggleState();
              break;

            case Action.ActionType.ACTION_TOGGLEMISCFILES:
              splitterRight.ToggleState();
              break;

            case Action.ActionType.ACTION_REMOVECOMMENT:
              if (!gridViewControl.CheckSelections(true))
            break;
              gridViewControl.RemoveComments();
              break;

            case Action.ActionType.ACTION_REMOVEPICTURE:
              if (!gridViewControl.CheckSelections(true))
            break;
              gridViewControl.RemovePictures();
              break;

            case Action.ActionType.ACTION_VALIDATEMP3:
              if (!gridViewControl.CheckSelections(true))
            break;
              gridViewControl.ValidateMP3File();
              gridViewControl.View.ClearSelection();
              break;

            case Action.ActionType.ACTION_FIXMP3:
              if (!gridViewControl.CheckSelections(true))
            break;
              gridViewControl.FixMP3File();
              break;

            case Action.ActionType.ACTION_FIND:
              _dialog = new FindReplace(this);
              (_dialog as FindReplace).Replace = false;
              ShowCenteredForm(_dialog);
              _showForm = false; // Don't show the dialog in the Keypress event
              break;

            case Action.ActionType.ACTION_REPLACE:
              _dialog = new FindReplace(this);
              (_dialog as FindReplace).Replace = true;
              ShowCenteredForm(_dialog);
              _showForm = false; // Don't show the dialog in the Keypress event
              break;
              }

              return handled;
        }
Exemplo n.º 7
0
        /// <summary>
        ///   A Key has been pressed
        /// </summary>
        /// <param name = "e"></param>
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            Action newaction = new Action();
              if (ServiceScope.Get<IActionHandler>().GetAction(1, keyData, ref newaction))
              {
            if (OnAction(newaction))
            {
              return true;
            }
              }

              if ((int)keyData == 13)   // Handle Enter key as default Apply Button
              {
            btApply_Click(null, new EventArgs());
            return true;
              }
              else if ((int)keyData == 27)  // Handle Escape to clear the form
              {
            ClearForm();
            return true;
              }

              return base.ProcessCmdKey(ref msg, keyData);
        }