Exemplo n.º 1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            try
            {
                ListViewItem item = lvButtons.SelectedItems.Count > 0 ?
                                    lvButtons.SelectedItems[0] : null;

                if (item != null && item.Tag is RCCServiceConfig.RemoteButtonsRow)
                {
                    ButtonConfigForm dlg = new ButtonConfigForm();
                    dlg.Config        = _config;
                    dlg.RemoteControl = _remoteControl;
                    dlg.Button        = item.Tag as RCCServiceConfig.RemoteButtonsRow;

                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        dlg.Button.AcceptChanges();
                        DisplayButtonsData();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
Exemplo n.º 2
0
 private void tsbDeleteRemote_Click(object sender, EventArgs e)
 {
     try
     {
         TreeNode node = tvRemotes.SelectedNode;
         if (node != null)
         {
             if (node.Tag is RCCServiceConfig.RemoteControlRow &&
                 MessageDisplay.Query(Translator.Translate("TXT_CONFIRMDELETEREMOTE"),
                                      Translator.Translate("TXT_CONFIRM"), MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 _config.RemoteControl.RemoveRemoteControlRow(node.Tag as RCCServiceConfig.RemoteControlRow);
                 _config.RemoteControl.AcceptChanges();
                 DisplayRemotes();
             }
             else if (node.Tag is RCCServiceConfig.RemoteButtonsRow &&
                      MessageDisplay.Query(Translator.Translate("TXT_CONFIRMDELETEBUTTON"),
                                           Translator.Translate("TXT_CONFIRM"), MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 _config.RemoteButtons.RemoveRemoteButtonsRow(node.Tag as RCCServiceConfig.RemoteButtonsRow);
                 _config.RemoteButtons.AcceptChanges();
                 DisplayRemotes();
             }
         }
     }
     catch (Exception ex)
     {
         ErrorDispatcher.DispatchError(ex, false);
     }
 }
        public void InvokeCommand(IntPtr pici)
        {
            try
            {
                CMINVOKECOMMANDINFO ici = (CMINVOKECOMMANDINFO)Marshal.PtrToStructure(
                    pici, typeof(CMINVOKECOMMANDINFO));

                int cmd = (ici.verb.ToInt32()) & 0xffff;

                switch (cmd)
                {
                case (int)CommandType.PlayFiles:
                case (int)CommandType.EnqueueFiles:
                    RemoteControlHelper.SendPlayerCommand((CommandType)cmd, fileList.ToArray());
                    break;

                default:
                    Marshal.ThrowExceptionForHR(WinError.E_FAIL);
                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
Exemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                UseWaitCursor = true;

                while (true)
                {
                    ButtonConfigForm dlg = new ButtonConfigForm();
                    dlg.Config        = _config;
                    dlg.RemoteControl = _remoteControl;

                    DialogResult res = dlg.ShowDialog(this);
                    if (res == DialogResult.OK || res == DialogResult.Retry)
                    {
                        _config.RemoteButtons.AddRemoteButtonsRow(dlg.Button);
                        _config.RemoteButtons.AcceptChanges();
                        DisplayButtonsData();
                    }

                    if (res != DialogResult.Retry)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }

            UseWaitCursor = false;
        }
Exemplo n.º 5
0
        private void OnInstallAddons(object sender, EventArgs e)
        {
            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.Filter = Translator.Translate("TXT_INSTALLADDONFILTER");
            dlg.Title  = Translator.Translate("TXT_INSTALLADDONS");

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (dlg.FileName.ToLowerInvariant().Contains("builtin"))
                    {
                        ErrorDispatcher.DispatchError(Translator.Translate("TXT_CANT_INSTALL_BUILTIN"), false);
                    }
                    else if (!dlg.FileName.ToLowerInvariant().EndsWith("extension.dll"))
                    {
                        ErrorDispatcher.DispatchError(Translator.Translate("TXT_INVALID_NAME"), false);
                    }
                    else if (TestAssembly(dlg.FileName))
                    {
                        AddonsConfig.InstallAddonLibrary(dlg.FileName);
                        ReloadConfig();
                    }
                    else
                    {
                        ErrorDispatcher.DispatchError(Translator.Translate("TXT_INVALID_ADDON"), false);
                    }
                }
                catch (Exception ex)
                {
                    ErrorDispatcher.DispatchError(ex, false);
                }
            }
        }
Exemplo n.º 6
0
        void OnMediaRenderingException(RenderingExceptionEventArgs args)
        {
            string msg = args.RenderingException.ToString();

            ErrorDispatcher.DispatchError(msg, false);
            args.Handled = true;
        }
        void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (!_closedOnce)
                {
                    foreach (TabPage tp in tabOptions.TabPages)
                    {
                        BaseCfgPanel panel = tp.Controls[0] as BaseCfgPanel;
                        if (panel != null)
                        {
                            if (DialogResult == DialogResult.OK)
                            {
                                panel.Save();
                            }
                            else
                            {
                                panel.Discard();
                            }
                        }
                    }

                    _closedOnce = true;
                    return;
                }
            }
            catch (SettingsSaveException ex)
            {
                ErrorDispatcher.DispatchError(ex.Message, false);
            }

            e.Cancel = true;
        }
Exemplo n.º 8
0
        public static string Translate(string tag)
        {
            string retVal = tag;

            if (translate && !string.IsNullOrEmpty(tag) && tag.StartsWith("TXT_"))
            {
                string translatedTag = null;
                foreach (ResourceManager rm in _resManagers)
                {
                    try
                    {
                        translatedTag = rm.GetString(tag, Thread.CurrentThread.CurrentCulture);
                        if (translatedTag != null)
                        {
                            retVal = translatedTag;
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorDispatcher.DispatchError(ex);
                        retVal = tag;
                    }
                }
            }

            if (retVal == tag)
            {
                // Not translated
                //Logger.LogTranslationTrace(tag);
            }

            return(retVal);
        }
        private void OpenFileWithCheck(string fileName, bool openRecent)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            fileName = fileName.ToLowerInvariant();

            if (File.Exists(fileName))
            {
                LoadThemeFile(fileName);
            }
            else
            {
                if (_recentFiles.Contains(fileName))
                {
                    _recentFiles.Remove(fileName);
                }

                string mainMessage = Translator.Translate("TXT_FILE_NOT_FOUND", fileName);
                if (openRecent)
                {
                    mainMessage += "\r\n";
                    mainMessage += Translator.Translate("TXT_RECENT_FILE_REMOVED");
                }

                ErrorDispatcher.DispatchError(mainMessage, false);
            }
        }
Exemplo n.º 10
0
 private void OnMenuEnable(object sender, EventArgs e)
 {
     try
     {
         TreeNode node = tvRemotes.SelectedNode;
         if (node != null)
         {
             if (node.Tag is RCCServiceConfig.RemoteControlRow)
             {
                 bool enabled = (node.Tag as RCCServiceConfig.RemoteControlRow).Enabled;
                 (node.Tag as RCCServiceConfig.RemoteControlRow).Enabled = !enabled;
                 (node.Tag as RCCServiceConfig.RemoteControlRow).AcceptChanges();
                 DisplayRemotes();
             }
             else if (node.Tag is RCCServiceConfig.RemoteButtonsRow)
             {
                 bool enabled = (node.Tag as RCCServiceConfig.RemoteButtonsRow).Enabled;
                 (node.Tag as RCCServiceConfig.RemoteButtonsRow).Enabled = !enabled;
                 (node.Tag as RCCServiceConfig.RemoteButtonsRow).AcceptChanges();
                 DisplayRemotes();
             }
         }
     }
     catch (Exception ex)
     {
         ErrorDispatcher.DispatchError(ex, false);
     }
 }
        public static bool ReconfigureRCCService()
        {
            try
            {
                ServiceController sc = new ServiceController(
                    ProTONEConstants.RCCServiceShortName,
                    Environment.MachineName);

                if (sc.Status == ServiceControllerStatus.Running)
                {
                    sc.ExecuteCommand((int)ServiceCommand.Reconfigure);
                }
                else
                {
                    sc.Start();
                    sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
                }

                if (sc.Status != ServiceControllerStatus.Running)
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }

            return(false);
        }
Exemplo n.º 12
0
        private void tsbAddRemote_Click(object sender, EventArgs e)
        {
            try
            {
                UseWaitCursor = true;

                TreeNode node = tvRemotes.SelectedNode;

                if (node != null && (node.ImageIndex == 4 || node.Tag is RCCServiceConfig.RemoteButtonsRow))
                {
                    try
                    {
                        while (true)
                        {
                            ButtonConfigForm dlg = new ButtonConfigForm();
                            dlg.Config        = _config;
                            dlg.RemoteControl = (node.Tag is RCCServiceConfig.RemoteButtonsRow) ?
                                                _config.RemoteControl.FindByRemoteName((node.Tag as RCCServiceConfig.RemoteButtonsRow).RemoteName) :
                                                node.Tag as RCCServiceConfig.RemoteControlRow;

                            DialogResult res = dlg.ShowDialog(this);
                            if (res == DialogResult.OK || res == DialogResult.Retry)
                            {
                                _config.RemoteButtons.AddRemoteButtonsRow(dlg.Button);
                                _config.RemoteButtons.AcceptChanges();
                                DisplayRemotes();
                            }

                            if (res != DialogResult.Retry)
                            {
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorDispatcher.DispatchError(ex, false);
                    }
                }
                else
                {
                    RemoteControlConfigForm dlg = new RemoteControlConfigForm();
                    dlg.Config = _config;

                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        _config.RemoteControl.AddRemoteControlRow(dlg.RemoteControl);
                        _config.RemoteControl.AcceptChanges();
                        DisplayRemotes();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }

            UseWaitCursor = false;
            BringToFront();
        }
Exemplo n.º 13
0
        public void AddOnlineMediaItem(OnlineMediaItem omi)
        {
            try
            {
                if (omi is RadioStation)
                {
                    Add(new RadioStationPlaylistItem(omi as RadioStation));
                }
                else if (omi is DeezerTrackItem)
                {
                    Add(new DeezerTrackPlaylistItem(omi as DeezerTrackItem));
                }


                EventRaiser(Count - 1, -1, UpdateType.Added);
                SetupRandomSequence(-1);
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, true);
            }
            finally
            {
                Application.DoEvents();
            }
        }
Exemplo n.º 14
0
        private void AttemptUninstallAddon(AddonLibraryInfo ali)
        {
            try
            {
                if (ali.IsNative)
                {
                    ErrorDispatcher.DispatchError(Translator.Translate("TXT_CANT_UNINSTALL_BUILTIN"), false);
                    return;
                }

                string[] codebaseParts = ali.CodeBase.Split(new char[] { '|' });
                if (codebaseParts.Length > 0)
                {
                    ScheduleForUninstall(codebaseParts[0]);

                    if (_uninstallScheduled)
                    {
                        FindForm().DialogResult = DialogResult.OK;
                        FindForm().Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
Exemplo n.º 15
0
        private void OpenFileWithCheck(string fileName, bool openRecent)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            fileName = fileName.ToLowerInvariant();

            if (File.Exists(fileName))
            {
                _bwOpen.RunWorkerAsync(fileName);
                ShowWaitDialog("TXT_WAIT_LOADING_CATALOG");
            }
            else
            {
                if (_recentFiles.Contains(fileName))
                {
                    _recentFiles.Remove(fileName);
                }

                string mainMessage = Translator.Translate("TXT_FILE_NOT_FOUND", fileName);
                if (openRecent)
                {
                    mainMessage += "\r\n";
                    mainMessage += Translator.Translate("TXT_RECENT_FILE_REMOVED");
                }

                ErrorDispatcher.DispatchError(mainMessage, false);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Initialize all addons loaders.
        /// </summary>
        public void InitializeAddons()
        {
            bool errors = false;

            Logger.LogTrace("InitializeAddons() called ...");

            navAddonsLoader     = null;
            propAddonsLoader    = null;
            previewAddonsLoader = null;

            try
            {
                // Initialize navigation addons
                Logger.LogTrace("Loading navigation addons ...");
                navAddonsLoader = new NavAddonsLoader();
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
                navAddonsLoader = null;
                return; // navigations addons are critical; if they fail loading don't continue.
            }

            try
            {
                // Initialize property addons.
                Logger.LogTrace("Loading property addons ...");
                propAddonsLoader = new PropAddonsLoader();
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
                propAddonsLoader = null;
                errors           = true;
            }

            try
            {
                // Initialize preview addons.
                Logger.LogTrace("Loading preview addons ...");
                previewAddonsLoader = new PreviewAddonsLoader();
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
                previewAddonsLoader = null;
                errors = true;
            }

            if (errors)
            {
                ErrorDispatcher.DispatchError("Some errors were encountered while loading addons.\n" +
                                              "You can open Settings -> Addon Config to check which addons are operational.",
                                              false);
            }

            Logger.LogTrace("InitializeAddons() done.");
        }
        protected override bool ProcessInternal()
        {
            try
            {
                DateTime fileTimeStamp = DateTime.MinValue;
                string   filePath      = string.Empty;
                string   fileName      = "~" + _descName + ".frtmp";
                _pendingDownloadFile = Path.Combine(_repositoryPath, fileName);

                using (WebFileRetriever downloader =
                           new WebFileRetriever(_ns, _downloadUrl, _pendingDownloadFile, false))
                {
                }

                string ext = PathUtils.GetExtension(_downloadUrl);

                if (!AreFilesIdentical(GetLatestFileInRepository(), _pendingDownloadFile))
                {
                    string newFileName = StringUtils.GetUniqueFileName();
                    string newFilePath = Path.Combine(_repositoryPath, newFileName + ext);
                    File.Move(_pendingDownloadFile, newFilePath);

                    if (NewFileRetrieved != null)
                    {
                        NewFileRetrieved(newFilePath, true, string.Empty);
                    }
                }

                DeleteFile(_pendingDownloadFile);
                _pendingDownloadFile = string.Empty;
            }
            catch (ThreadAbortException)
            {
                if (!string.IsNullOrEmpty(_pendingDownloadFile) && File.Exists(_pendingDownloadFile))
                {
                    EventDispatch.DispatchEvent(EventNames.ShowMessageBox, "Download cancelled.", _descName, MessageBoxIcon.Warning);

                    _retriever.Dispose();
                    _retriever = null;

                    DeleteFile(_pendingDownloadFile);
                    _pendingDownloadFile = string.Empty;
                }

                return(false);
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }

            // DownloadInterval is in seconds
            Thread.Sleep(_downloadInterval * 1000);

            return(true);
        }
 private void DeleteFile(string path)
 {
     try
     {
         File.Delete(path);
     }
     catch (Exception ex)
     {
         ErrorDispatcher.DispatchError(ex, false);
     }
 }
 public ShellIntegrationSuport()
 {
     try
     {
         hBitmap = Resources.player.GetHbitmap();
     }
     catch (Exception ex)
     {
         ErrorDispatcher.DispatchError(ex, false);
         hBitmap = IntPtr.Zero;
     }
 }
Exemplo n.º 20
0
        internal void LoadBookmarks(bool raiseEvent, bool throwException)
        {
            _bookmarks.Clear();

            try
            {
                if (File.Exists(_path) == false)
                {
                    return;
                }

                using (StreamReader sr = new StreamReader(_path))
                {
                    string line = sr.ReadLine();
                    while (line != null)
                    {
                        if (!line.StartsWith("#"))
                        {
                            Bookmark bmk = Bookmark.FromString(line);
                            if (bmk != null)
                            {
                                if (_bookmarks.ContainsKey(bmk.PlaybackTime))
                                {
                                    _bookmarks[bmk.PlaybackTime] = bmk;
                                }
                                else
                                {
                                    _bookmarks.Add(bmk.PlaybackTime, bmk);
                                }
                            }
                        }

                        line = sr.ReadLine();
                    }
                }

                if (raiseEvent && BookmarkCollectionChanged != null)
                {
                    BookmarkCollectionChanged(null, null);
                }
            }
            catch (Exception ex)
            {
                if (throwException)
                {
                    ErrorDispatcher.DispatchError(ex, false);
                }
                else
                {
                    Logger.LogException(ex);
                }
            }
        }
Exemplo n.º 21
0
        public virtual void AddItem(string itemPath)
        {
            try
            {
                bool added = false;
                Uri  uri   = null;
                try
                {
                    uri = new Uri(itemPath, UriKind.Absolute);
                }
                catch
                {
                    uri = null;
                }

                if (uri != null)
                {
                    if (uri.IsFile)
                    {
                        itemPath = uri.LocalPath;
                    }
                    else
                    {
                        Add(new UrlPlaylistItem(itemPath));
                        added = true;
                    }
                }

                if (!added)
                {
                    if (DvdMedia.FromPath(itemPath) != null)
                    {
                        Add(new DvdPlaylistItem(itemPath));
                    }
                    else
                    {
                        Add(new PlaylistItem(itemPath, false));
                    }
                }

                EventRaiser(Count - 1, -1, UpdateType.Added);
                SetupRandomSequence(-1);
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, true);
            }
            finally
            {
                Application.DoEvents();
            }
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        private void FillDriveList()
        {
            try
            {
                if (!Directory.Exists(this.InitialDirectory))
                {
                    this.InitialDirectory =
                        Environment.GetFolderPath(Environment.SpecialFolder.Desktop, Environment.SpecialFolderOption.Create);
                }

                System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();

                foreach (System.IO.DriveInfo di in drives)
                {
                    try
                    {
                        string path = di.RootDirectory.FullName.ToUpperInvariant();

                        string title = di.Name;
                        if (di.IsReady)
                        {
                            title += $" [{di.VolumeLabel}]";
                        }

                        OPMToolStripButton btn = new OPMToolStripButton(title);
                        btn.Name                  = title;
                        btn.Image                 = ImageProvider.GetIcon(path, true);
                        btn.ToolTipText           = path;
                        btn.TextAlign             = ContentAlignment.MiddleLeft;
                        btn.ImageAlign            = System.Drawing.ContentAlignment.TopCenter;
                        btn.ImageScaling          = System.Windows.Forms.ToolStripItemImageScaling.SizeToFit;
                        btn.ImageTransparentColor = System.Drawing.Color.Magenta;
                        btn.AutoSize              = true;
                        btn.Tag = path;
                        btn.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;

                        tsSpecialFolders.Items.Add(btn);
                    }
                    catch (Exception ex)
                    {
                        Logger.LogException(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
Exemplo n.º 24
0
 private void LoadM3UPlaylist(string fileName)
 {
     try
     {
         string text = File.ReadAllText(fileName);
         if (string.IsNullOrEmpty(text) == false)
         {
             LoadM3UPlaylistFromString(text, fileName);
         }
     }
     catch (Exception ex)
     {
         ErrorDispatcher.DispatchError(ex, false);
     }
 }
Exemplo n.º 25
0
 private bool DoSaveProperties()
 {
     foreach (ITaggedMediaFileInfo tmfi in pgProperties.SelectedObjects)
     {
         try
         {
             tmfi.Save();
         }
         catch (Exception ex)
         {
             ErrorDispatcher.DispatchError(ex, false);
         }
     }
     return(true);
 }
        static AddonsConfig()
        {
            IsInitialConfig = false;

            try
            {
                UninstallMarkedItems();

                _navAddons     = ReadAddonConfig("NavigationAddons");
                _previewAddons = ReadAddonConfig("PreviewAddons");
                _propAddons    = ReadAddonConfig("PropertyAddons");
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
 private void RunTask()
 {
     try
     {
         if (InitTask())
         {
             ExecuteTask();
         }
     }
     catch (Exception ex)
     {
         ErrorDispatcher.DispatchError(ex, false);
     }
     finally
     {
         CleanupTask();
     }
 }
Exemplo n.º 28
0
        private void cmsTree_Opening(object sender, CancelEventArgs e)
        {
            try
            {
                ListViewItem item = lvButtons.SelectedItems.Count > 0 ?
                                    lvButtons.SelectedItems[0] : null;

                if (item != null && item.Tag is RCCServiceConfig.RemoteButtonsRow)
                {
                    bool enabled = (item.Tag as RCCServiceConfig.RemoteButtonsRow).Enabled;
                    tsmiEnable.Text = Translator.Translate(enabled ? "TXT_DISABLE" : "TXT_ENABLE");
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
Exemplo n.º 29
0
        private void tsbModifyRemote_Click(object sender, EventArgs e)
        {
            try
            {
                UseWaitCursor = true;

                TreeNode node = tvRemotes.SelectedNode;
                if (node != null)
                {
                    if (node.Tag is RCCServiceConfig.RemoteControlRow)
                    {
                        RemoteControlConfigForm dlg = new RemoteControlConfigForm();
                        dlg.Config        = _config;
                        dlg.RemoteControl = node.Tag as RCCServiceConfig.RemoteControlRow;

                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            dlg.RemoteControl.AcceptChanges();
                            DisplayRemotes();
                        }
                    }
                    else if (node.Tag is RCCServiceConfig.RemoteButtonsRow)
                    {
                        ButtonConfigForm dlg = new ButtonConfigForm();
                        dlg.Button        = node.Tag as RCCServiceConfig.RemoteButtonsRow;
                        dlg.Config        = _config;
                        dlg.RemoteControl = _config.RemoteControl.FindByRemoteName(dlg.Button.RemoteName);

                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {
                            dlg.Button.AcceptChanges();
                            DisplayRemotes();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }

            UseWaitCursor = false;
            BringToFront();
        }
        internal static void InstallAddonLibrary(string fileName)
        {
            try
            {
                List <string> filesToCopy = new List <string>();

                Assembly asm = Assembly.LoadFrom(fileName);
                if (asm != null)
                {
                    filesToCopy.Add(asm.Location.ToLowerInvariant());

                    foreach (CultureInfo ci in AppConfig.SupportedCultures)
                    {
                        try
                        {
                            Assembly satAsm = asm.GetSatelliteAssembly(ci);
                            if (satAsm != null)
                            {
                                string path = satAsm.Location.ToLowerInvariant();
                                if (!filesToCopy.Contains(path))
                                {
                                    filesToCopy.Add(path.ToLowerInvariant());
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.LogException(ex);
                        }
                    }

                    foreach (string file in filesToCopy)
                    {
                        CopyToRunLocation(file.ToLowerInvariant(),
                                          Path.GetDirectoryName(fileName.ToLowerInvariant()));
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }