Inheritance: System.Windows.Forms.UserControl
Exemple #1
0
        /// <summary>
        ///   Handle various button click events
        /// </summary>
        /// <param name = "sender"></param>
        /// <param name = "e"></param>
        private void TagsTabButton_Executed(object sender, CommandExecutedEventArgs e)
        {
            // If no Rows are selected, select ALL of them and do the necessary action
              if (!TracksGridView.CheckSelections(true))
              {
            return;
              }

              switch (e.Command.Name)
              {
            case "FileNameToTag":
              FileNameToTag.FileNameToTag dlgFileNameToTag = new FileNameToTag.FileNameToTag(this);
              ShowDialogInDetailPanel(dlgFileNameToTag);
              break;

            case "IdentifyFiles":
              TracksGridView.IdentifyFiles();
              break;

            case "TagFromInternet":
              InternetLookup.InternetLookup lookup = new InternetLookup.InternetLookup(this);
              lookup.SearchForAlbumInformation();
              tagEditControl.FillForm();
              SetGalleryItem();
              break;

            case "GetCoverArt":
              TracksGridView.GetCoverArt();
              break;

            case "GetLyrics":
              TracksGridView.GetLyrics();
              break;

            case "AutoNumber":
              TracksGridView.AutoNumber();
              break;

            case "RemoveComment":
              TracksGridView.RemoveComments();
              break;

            case "RemoveCoverArt":
              TracksGridView.RemovePictures();
              break;

            case "OrganiseFiles":
              OrganiseFiles dlgOrganise = new OrganiseFiles(this);
              ShowDialogInDetailPanel(dlgOrganise);
              break;

            case "RenameFiles":
              TagToFileName.TagToFileName dlgTagToFile = new TagToFileName.TagToFileName(this, true);
              break;

            case "RenameFileOptions":
              TagToFileName.TagToFileName dlgTagToFileOptions = new TagToFileName.TagToFileName(this, false);
              ShowDialogInDetailPanel(dlgTagToFileOptions);
              break;

            case "CaseConversion":
              CaseConversion.CaseConversion dlgCaseConversion = new CaseConversion.CaseConversion(this, true);
              dlgCaseConversion.CaseConvertSelectedTracks();
              break;

            case "CaseConversionOptions":
              CaseConversion.CaseConversion dlgCaseConversionOptions = new CaseConversion.CaseConversion(this);
              ShowDialogInDetailPanel(dlgCaseConversionOptions);
              break;

            case "DeleteAllTags":
              TracksGridView.DeleteTags(TagTypes.AllTags);
              break;

            case "DeleteID3v1":
              TracksGridView.DeleteTags(TagTypes.Id3v1);
              break;

            case "DeleteID3v2":
              TracksGridView.DeleteTags(TagTypes.Id3v2);
              break;

            case "ScriptExecute":
              if (comboBoxScripts.SelectedIndex < 0)
            return;

              Item tag = (Item)comboBoxScripts.SelectedItem;
              TracksGridView.ExecuteScript((string)tag.Value);
              break;

            case "AddToBurner":
              TracksGridView.tracksGrid_AddToBurner(sender, new EventArgs());
              break;

            case "AddToConversion":
              TracksGridView.tracksGrid_AddToConvert(sender, new EventArgs());
              break;

            case "AddToPlaylist":
              TracksGridView.tracksGrid_AddToPlayList(sender, new EventArgs());
              break;

            case "Find":
              FindReplace findDlg = new FindReplace(this);
              findDlg.Replace = false;
              ShowCenteredForm(findDlg);
              break;

            case "Replace":
              FindReplace replaceDlg = new FindReplace(this);
              replaceDlg.Replace = true;
              ShowCenteredForm(replaceDlg);
              break;

            case "ValidateSong":
              if (!gridViewControl.CheckSelections(true))
            break;
              gridViewControl.ValidateMP3File();
              gridViewControl.View.ClearSelection();
              break;

            case "FixSong":
              if (!gridViewControl.CheckSelections(true))
            break;
              gridViewControl.FixMP3File();
              break;
              }
        }
Exemple #2
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;
        }