protected override void SaveInternal()
        {
            if (!Modified)
            {
                return;
            }

            if (cbShellIntegration.Checked != SuiteRegistrationSupport.IsContextMenuHandlerRegistered())
            {
                if (cbShellIntegration.Checked)
                {
                    SuiteRegistrationSupport.RegisterContextMenuHandler();
                }
                else
                {
                    SuiteRegistrationSupport.UnregisterContextMenuHandler();
                }
            }

            SaveFileTypes(pnlAudioFiles);
            SaveFileTypes(pnlVideoFiles);
            SaveFileTypes(pnlPlaylists);

            ProTONEConfig.ExplorerLaunchType =
                (cmbExplorerLaunchType.SelectedItem as ExplorerLaunchType).CommandType.ToString();


            SuiteRegistrationSupport.ReloadFileAssociations();
        }
        public FileTypesPanel() : base()
        {
            this.Title = "TXT_S_FILETYPES";

            InitializeComponent();

            hdrAudio.Image     = ImageProcessing.AudioFile16;
            hdrVideo.Image     = ImageProcessing.VideoFile16;
            hdrPlaylists.Image = ImageProcessing.Playlist16;

            Translator.TranslateControl(this, DesignMode);
            ThemeManager.SetFont(btnSelAllAudio, FontSizes.Small);
            ThemeManager.SetFont(btnSelAllPlaylists, FontSizes.Small);
            ThemeManager.SetFont(btnSelAllVideo, FontSizes.Small);
            ThemeManager.SetFont(btnUnselAllAudio, FontSizes.Small);
            ThemeManager.SetFont(btnUnselAllPlaylists, FontSizes.Small);
            ThemeManager.SetFont(btnUnselAllVideo, FontSizes.Small);

            cbShellIntegration.Checked = SuiteRegistrationSupport.IsContextMenuHandlerRegistered();

            ActivateShellIntegration();
            FillExplorerLaunchTypes();

            this.Enabled = AppConfig.CurrentUserIsAdministrator;

            this.HandleCreated += new EventHandler(FileTypesPanel_HandleCreated);
        }
        public static bool ProcessCommandLine(bool testForShellExec)
        {
            string[] cmdLineArgs = Environment.GetCommandLineArgs();

            if (testForShellExec && cmdLineArgs.Length > 1 && cmdLineArgs[1].ToLowerInvariant() == "launch")
            {
                List <string> files = new List <string>();
                for (int i = 2; i < cmdLineArgs.Length; i++)
                {
                    files.Add(cmdLineArgs[i]);
                }

                try
                {
                    CommandType cmdType = (CommandType)Enum.Parse(typeof(CommandType),
                                                                  ProTONEConfig.ExplorerLaunchType);

                    if (SuiteRegistrationSupport.IsContextMenuHandlerRegistered() &&
                        (cmdType == CommandType.PlayFiles || cmdType == CommandType.EnqueueFiles))
                    {
                        if (RemoteControlHelper.IsPlayerRunning())
                        {
                            // There is another player instance that is running.
                            // Just pass the command to that instance and exit.
                            RemoteControlHelper.SendPlayerCommand(cmdType, files.ToArray());
                        }
                        else
                        {
                            // There is no other player instance.
                            // This instance needs to process the command itself.

                            // Note: when player is launched like this - clear previous playlist first.
                            _commandQueue.Add(BasicCommand.Create(CommandType.ClearPlaylist));

                            _commandQueue.Add(BasicCommand.Create(cmdType, files.ToArray()));

                            return(false); // Don't exit
                        }
                    }
                }
                catch (Exception ex)
                {
                    ErrorDispatcher.DispatchError(ex, false);
                }

                return(true);
            }

            return(false);
        }