Exemple #1
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);
                }
            }
        }
        private void OpenTheme()
        {
            tsbOpen.HideDropDown();

            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.Title            = Translator.Translate("TXT_OPENTHEMEFILE");
            dlg.Filter           = Translator.Translate("TXT_THEMEFILE_FILTER");
            dlg.InitialDirectory = SkinBuilderConfiguration.LastOpenedFolder;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                SkinBuilderConfiguration.LastOpenedFolder = Path.GetDirectoryName(dlg.FileName);
                OpenFileWithCheck(dlg.FileName, false);
            }
        }
        private void tsmiImportReplace_Click(object sender, EventArgs e)
        {
            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.InitialDirectory = Path.Combine(Environment.CurrentDirectory, "Templates\\RemoteControl");
            dlg.Filter           = Translator.Translate("TXT_CONFIG_FILES_FILTER");
            dlg.Title            = Translator.Translate("TXT_IMPORT_FULL");

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _config = new RCCServiceConfig();
                _config.ReadXml(dlg.FileName);
                _config.AcceptChanges();

                DisplayRemotes(true);
            }
        }
Exemple #4
0
        private void OpenCatalog()
        {
            tsbOpen.HideDropDown();

            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.Title            = Translator.Translate("TXT_OPENCATALOG");
            dlg.Filter           = Translator.Translate("TXT_CATALOG_FILTER");
            dlg.InitialDirectory = BuiltinAddonConfig.MCLastOpenedFolder;

            dlg.FillFavoriteFoldersEvt += () => { return(ProTONEConfig.GetFavoriteFolders("FavoriteFolders")); };
            dlg.AddToFavoriteFolders   += (s) => { return(ProTONEConfig.AddToFavoriteFolders(s)); };
            dlg.ShowAddToFavorites      = true;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                BuiltinAddonConfig.MCLastOpenedFolder = Path.GetDirectoryName(dlg.FileName);
                OpenFileWithCheck(dlg.FileName, false);
            }
        }
Exemple #5
0
        internal void LoadPlaylist()
        {
            string filter = string.Empty;

            filter += MediaRenderer.DefaultInstance.PlaylistsFilter;
            filter += Translator.Translate("TXT_ALL_FILES_FILTER");
            filter  = filter.Replace("TXT_PLAYLISTS", Translator.Translate("TXT_PLAYLISTS"));

            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.Multiselect      = true;
            dlg.Title            = Translator.Translate("TXT_LOADPLAYLIST");
            dlg.Filter           = filter;
            dlg.FilterIndex      = ProTONEConfig.PL_LastFilterIndex;
            dlg.InitialDirectory = ProTONEConfig.PL_LastOpenedFolder;

            dlg.InheritAppIcon = false;
            dlg.Icon           = OPMedia.UI.Properties.Resources.Open16.ToIcon();

            dlg.FillFavoriteFoldersEvt += () => { return(ProTONEConfig.GetFavoriteFolders("FavoriteFolders")); };
            dlg.AddToFavoriteFolders   += (s) => { return(ProTONEConfig.AddToFavoriteFolders(s)); };
            dlg.ShowAddToFavorites      = true;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                ProTONEConfig.PL_LastFilterIndex = dlg.FilterIndex;

                Clear();
                playlist.LoadPlaylist(dlg.FileName);

                try
                {
                    string file = dlg.FileNames[0];
                    ProTONEConfig.PL_LastOpenedFolder = Path.GetDirectoryName(file);
                }
                catch
                {
                    ProTONEConfig.PL_LastOpenedFolder = dlg.InitialDirectory;
                }
            }
        }
Exemple #6
0
        private void MergeCatalog()
        {
            if (_cat != null && _cat.IsValid)
            {
                OPMOpenFileDialog dlg = new OPMOpenFileDialog();
                dlg.Title            = Translator.Translate("TXT_MERGECATALOG");
                dlg.Filter           = Translator.Translate("TXT_CATALOG_FILTER");
                dlg.InitialDirectory = BuiltinAddonConfig.MCLastOpenedFolder;

                dlg.FillFavoriteFoldersEvt += () => { return(ProTONEConfig.GetFavoriteFolders("FavoriteFolders")); };
                dlg.AddToFavoriteFolders   += (s) => { return(ProTONEConfig.AddToFavoriteFolders(s)); };
                dlg.ShowAddToFavorites      = true;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    BuiltinAddonConfig.MCLastOpenedFolder = Path.GetDirectoryName(dlg.FileName);
                    _bwMerge.RunWorkerAsync(dlg.FileName);
                    ShowWaitDialog("TXT_WAIT_MERGING_CATALOG");
                }
            }
        }
Exemple #7
0
        private void pbPicture_DoubleClick(object sender, EventArgs e)
        {
            if (lvPictures.SelectedItems.Count > 0)
            {
                PictureInfo pi = lvPictures.SelectedItems[0].Tag as PictureInfo;
                if (pi != null)
                {
                    OPMOpenFileDialog dlg = new OPMOpenFileDialog();
                    dlg.Filter = "All image files|*.bmp;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif;*.tif;*.tiff;*.png;*.ico;||";

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Image img = null;
                        try
                        {
                            img = Image.FromFile(dlg.FileName);
                        }
                        catch
                        {
                            img = null;
                        }

                        if (img != null)
                        {
                            Bitmap bmp = new Bitmap(ImageProvider.ScaleImage(img,
                                                                             new Size(200, 200 * img.Size.Height / img.Size.Width),
                                                                             false));
                            pi.Picture = bmp;

                            pi.MimeType = "image/" + PathUtils.GetExtension(dlg.FileName);

                            pbPicture.Image    = pi.Picture;
                            pbPicture.SizeMode = PictureBoxSizeMode.Zoom;

                            lvPictures.SelectedItems[0].SubItems[colImage.Index].Tag = new ExtendedSubItemDetail(pi.Picture, "");
                        }
                    }
                }
            }
        }
        private void btnAddFiles_Click(object sender, EventArgs e)
        {
            CursorHelper.ShowWaitCursor(this, true);

            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.Title            = Translator.Translate("TXT_SELECTTAGGEDFILES");
            dlg.Filter           = Translator.Translate("TXT_TAGGEDFILESFILTER");
            dlg.InitialDirectory = ProTONEConfig.LastOpenedFolder;
            dlg.Multiselect      = true;

            dlg.InheritAppIcon = false;
            dlg.Icon           = Resources.Tagging16.ToIcon();

            dlg.FillFavoriteFoldersEvt += () => { return(ProTONEConfig.GetFavoriteFolders("FavoriteFolders")); };
            dlg.AddToFavoriteFolders   += (s) => { return(ProTONEConfig.AddToFavoriteFolders(s)); };
            dlg.ShowAddToFavorites      = true;


            if (dlg.ShowDialog() == DialogResult.OK && dlg.FileNames.Length > 0)
            {
                foreach (string file in dlg.FileNames)
                {
                    AddFile(file);
                }

                try
                {
                    string file = dlg.FileNames[0];
                    ProTONEConfig.LastOpenedFolder = Path.GetDirectoryName(file);
                }
                catch
                {
                    ProTONEConfig.LastOpenedFolder = dlg.InitialDirectory;
                }
            }

            CursorHelper.ShowWaitCursor(this, false);
            Wizard.CanMoveNext = lvFiles.Items.Count > 0;
        }
Exemple #9
0
        private void LoadFiles()
        {
            OPMOpenFileDialog dlg = new OPMOpenFileDialog();

            dlg.Title       = Translator.Translate("TXT_LOADMEDIAFILES");
            dlg.Multiselect = true;

            dlg.InheritAppIcon = false;
            dlg.Icon           = Resources.btnLoad.ToIcon((uint)Color.White.ToArgb());

            string filter = string.Empty;

            filter += MediaRenderer.DefaultInstance.AvailableFileTypesFilter;
            filter += Translator.Translate("TXT_ALL_FILES_FILTER");

            filter = filter.Replace("TXT_AUDIO_FILES", Translator.Translate("TXT_AUDIO_FILES"));
            filter = filter.Replace("TXT_VIDEO_FILES", Translator.Translate("TXT_VIDEO_FILES"));
            filter = filter.Replace("TXT_VIDEO_HD_FILES", Translator.Translate("TXT_VIDEO_HD_FILES"));
            filter = filter.Replace("TXT_PLAYLISTS", Translator.Translate("TXT_PLAYLISTS"));

            dlg.Filter = filter;

            dlg.FilterIndex      = ProTONEConfig.LastFilterIndex;
            dlg.InitialDirectory = ProTONEConfig.LastOpenedFolder;

            dlg.FillFavoriteFoldersEvt += () => { return(ProTONEConfig.GetFavoriteFolders("FavoriteFolders")); };
            dlg.AddToFavoriteFolders   += (s) => { return(ProTONEConfig.AddToFavoriteFolders(s)); };

            dlg.QueryDisplayName += (fsi) =>
            {
                if (fsi != null)
                {
                    if (fsi.ToUpperInvariant().EndsWith("CDA"))
                    {
                        CDAFileInfo cdfi = MediaFileInfo.FromPath(fsi) as CDAFileInfo;
                        if (cdfi != null)
                        {
                            return(cdfi.DisplayName);
                        }
                    }

                    return(Path.GetFileName(fsi));
                }

                return(string.Empty);
            };

            dlg.ShowAddToFavorites = true;

            dlg.OpenDropDownOptions = new List <OpenOption>(new OpenOption[]
            {
                new MediaPlayerOpenOption(CommandType.PlayFiles),
                new MediaPlayerOpenOption(CommandType.EnqueueFiles)
            });

            if (dlg.ShowDialog() == DialogResult.OK && dlg.FileNames.Length > 0)
            {
                CommandType openOption = CommandType.PlayFiles;
                try
                {
                    openOption = (CommandType)dlg.OpenOption;
                }
                catch
                {
                    openOption = CommandType.PlayFiles;
                }

                if (openOption == CommandType.EnqueueFiles)
                {
                    EnqueueFiles(dlg.FileNames);
                }
                else
                {
                    LoadFiles(dlg.FileNames);
                }

                ProTONEConfig.LastFilterIndex = dlg.FilterIndex;

                try
                {
                    string file = dlg.FileNames[0];
                    ProTONEConfig.LastOpenedFolder = Path.GetDirectoryName(file);
                }
                catch
                {
                    ProTONEConfig.LastOpenedFolder = dlg.InitialDirectory;
                }
            }
        }
Exemple #10
0
        private void HandleAction(ToolAction action)
        {
            if (!IsToolActionEnabled(action))
            {
                return;
            }

            switch (action)
            {
            case ToolAction.ToolActionNew:
                _sub = Subtitle.Empty;
                lvSubtitles.Subtitle = _sub;
                break;

            case ToolAction.ToolActionOpen:
            {
                OPMOpenFileDialog dlg = CommonDialogHelper.NewOPMOpenFileDialog();
                dlg.Title            = Translator.Translate("TXT_OPEN_SUBTITLE");
                dlg.Filter           = "Subtitle files (*.srt, *.sub)|*.srt;*.sub||";//Translator.Translate("TXT_CATALOG_FILTER");
                dlg.InitialDirectory = AppSettings.SUB_LastOpenedFolder;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    _sub = new Subtitle(dlg.FileName);

                    AppSettings.SUB_LastOpenedFolder = Path.GetDirectoryName(dlg.FileName);

                    lvSubtitles.Subtitle = _sub;

                    List <string> items = new List <string>();
                    items.Add(dlg.FileName);

                    base.RaiseNavigationAction(NavActionType.ActionDoubleClickFile, items, _sub);

                    if (_sub.Elements != null && _sub.Elements.Count > 0)
                    {
                        lvSubtitles.Select();
                        lvSubtitles.Focus();
                        lvSubtitles.Items[0].Selected = true;
                        //base.RaiseNavigationAction(NavActionType.ActionReloadPreview, items, _sub.Elements[0]);
                    }
                }
            }
            break;

            case ToolAction.ToolActionSave:
                if (_sub.IsEmpty)
                {
                    goto saveas;
                }
                else
                {
                    _sub.Save();
                }
                break;

            case ToolAction.ToolActionSaveAs:
saveas:
                {
                    OPMSaveFileDialog dlg = CommonDialogHelper.NewOPMSaveFileDialog();
                    dlg.Title            = Translator.Translate("TXT_SAVE_SUBTITLE");
                    dlg.Filter           = "Subtitle files (*.srt, *.sub)|*.srt;*.sub||";//Translator.Translate("TXT_CATALOG_FILTER");
                    dlg.AddExtension     = true;
                    dlg.DefaultExt       = "srt";
                    dlg.InitialDirectory = AppSettings.SUB_LastOpenedFolder;

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        _sub.SaveToFile(dlg.FileName);

                        AppSettings.SUB_LastOpenedFolder = Path.GetDirectoryName(dlg.FileName);
                    }
                }
                break;

            case ToolAction.ToolActionDelete:
                break;

            case ToolAction.ToolActionBack:
                break;

            case ToolAction.ToolActionFwd:
                break;

            case ToolAction.ToolActionSearch:
                break;

            case ToolAction.ToolActionRename:
                break;
            }
        }