コード例 #1
0
        private void OnChoosePath(object sender, EventArgs e)
        {
            OPMOpenFileDialog dlg = new OPMOpenFileDialog();
            dlg.Filter = Translator.Translate("TXT_PROGRAMS_FILTER");
            dlg.Title = Translator.Translate("TXT_CHOOSEPROGRAM");
            dlg.InitialDirectory = 
                string.IsNullOrEmpty(txtLaunchPath.Text) ? 
                PathUtils.CurrentDir : 
                Path.GetDirectoryName(txtLaunchPath.Text);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                txtLaunchPath.Text = dlg.FileName;
            }
        }
コード例 #2
0
ファイル: AddonPanel.cs プロジェクト: rraguso/protone-suite
        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);
            }
        }
コード例 #3
0
ファイル: AddonPanel.cs プロジェクト: rraguso/protone-suite
        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");
                }
            }
        }
コード例 #4
0
ファイル: AddonPanel.cs プロジェクト: rraguso/protone-suite
        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);
            }
        }
コード例 #5
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, "");
                        }
                    }
                }
            }
        }
コード例 #6
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"),
                            Translator.Translate("TXT_CAUTION"));
                    }
                    else if (!dlg.FileName.ToLowerInvariant().EndsWith("extension.dll"))
                    {
                        ErrorDispatcher.DispatchError(Translator.Translate("TXT_INVALID_NAME"),
                            Translator.Translate("TXT_CAUTION"));
                    }
                    else if (TestAssembly(dlg.FileName))
                    {
                        AddonsConfig.InstallAddonLibrary(dlg.FileName);
                        ReloadConfig();
                    }
                    else
                    {
                        ErrorDispatcher.DispatchError(Translator.Translate("TXT_INVALID_ADDON"),
                            Translator.Translate("TXT_CAUTION"));
                    }
                }
                catch (Exception ex)
                {
                    ErrorDispatcher.DispatchError(ex);
                }
            }
        }
コード例 #7
0
        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
                {
                    FileInfo fi = new FileInfo(dlg.FileNames[0]);
                    ProTONEConfig.LastOpenedFolder = fi.DirectoryName;
                }
                catch
                {
                    ProTONEConfig.LastOpenedFolder = dlg.InitialDirectory;
                }
            }

            CursorHelper.ShowWaitCursor(this, false);
            Wizard.CanMoveNext = lvFiles.Items.Count > 0;
        }
コード例 #8
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 = Resources.btnLoadPlaylist.ToIcon((uint)Color.White.ToArgb());

            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
                {
                    FileInfo fi = new FileInfo(dlg.FileName);
                    ProTONEConfig.PL_LastOpenedFolder = fi.DirectoryName;
                }
                catch
                {
                    ProTONEConfig.PL_LastOpenedFolder = dlg.InitialDirectory;
                }
            }
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: rraguso/protone-suite
        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);
            }
        }
コード例 #10
0
ファイル: MediaPlayer.cs プロジェクト: rraguso/protone-suite
        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)
                    {
                        FileInfo fi = fsi as FileInfo;
                        if (fi != null && fi.Name.ToUpperInvariant().EndsWith("CDA"))
                        {
                            CDAFileInfo cdfi = MediaFileInfo.FromPath(fsi.FullName) as CDAFileInfo;
                            if (cdfi != null)
                                return cdfi.DisplayName;
                        }

                        return fsi.Name;
                    }

                    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
                {
                    FileInfo fi = new FileInfo(dlg.FileNames[0]);
                    ProTONEConfig.LastOpenedFolder = fi.DirectoryName;
                }
                catch
                {
                    ProTONEConfig.LastOpenedFolder = dlg.InitialDirectory;
                }
            }
        }