private bool SaveThemeFileWithDialog()
        {
            if (_themeFile != null)
            {
                OPMSaveFileDialog dlg = new OPMSaveFileDialog();
                dlg.Title            = Translator.Translate("TXT_SAVETHEMEFILE");
                dlg.Filter           = Translator.Translate("TXT_THEMEFILE_FILTER");
                dlg.DefaultExt       = "thm";
                dlg.InitialDirectory = SkinBuilderConfiguration.LastOpenedFolder;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    SkinBuilderConfiguration.LastOpenedFolder = Path.GetDirectoryName(dlg.FileName);

                    string ext = PathUtils.GetExtension(dlg.FileName);

                    SaveThemeFile(dlg.FileName);

                    DisplayThemeFile();

                    return(true);
                }
            }

            return(false);
        }
        private void tsmiExportFull_Click(object sender, EventArgs e)
        {
            OPMSaveFileDialog dlg = new OPMSaveFileDialog();

            dlg.Filter     = Translator.Translate("TXT_CONFIG_FILES_FILTER");
            dlg.DefaultExt = "config";
            dlg.Title      = Translator.Translate("TXT_EXPORT_FULL");

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _config.WriteXml(dlg.FileName);
            }
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (lvPictures.SelectedItems.Count > 0)
            {
                PictureInfo pi = lvPictures.SelectedItems[0].Tag as PictureInfo;
                if (pi != null)
                {
                    OPMSaveFileDialog dlg = new OPMSaveFileDialog();
                    dlg.Filter = "All image files|*.bmp;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif;*.tif;*.tiff;*.png;*.ico;||";

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        ImageFormat imgFormat = ImageFormat.Bmp;
                        switch (PathUtils.GetExtension(dlg.FileName).ToLowerInvariant())
                        {
                        case "jpg":
                        case "jpeg":
                        case "jpe":
                            imgFormat = ImageFormat.Jpeg;
                            break;

                        case "gif":
                            imgFormat = ImageFormat.Gif;
                            break;

                        case "tif":
                        case "tiff":
                            imgFormat = ImageFormat.Tiff;
                            break;

                        case "png":
                            imgFormat = ImageFormat.Png;
                            break;

                        case "ico":
                            imgFormat = ImageFormat.Icon;
                            break;

                        case "bmp":
                        default:
                            imgFormat = ImageFormat.Bmp;
                            break;
                        }

                        pi.Picture.Save(dlg.FileName, imgFormat);
                    }
                }
            }
        }
Esempio n. 4
0
        internal void SavePlaylist()
        {
            string filter = string.Empty;

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

            OPMSaveFileDialog dlg = new OPMSaveFileDialog();

            dlg.Title            = Translator.Translate("TXT_SAVEPLAYLIST");
            dlg.Filter           = filter;
            dlg.DefaultExt       = "m3u";
            dlg.FilterIndex      = ProTONEConfig.PL_LastFilterIndex;
            dlg.InitialDirectory = ProTONEConfig.PL_LastOpenedFolder;

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

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

            dlg.ShowNewFolder = true;

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

                playlist.SavePlaylist(dlg.FileName);

                try
                {
                    string file = dlg.FileNames[0];
                    ProTONEConfig.PL_LastOpenedFolder = Path.GetDirectoryName(file);
                }
                catch
                {
                    ProTONEConfig.PL_LastOpenedFolder = dlg.InitialDirectory;
                }
            }
        }
Esempio n. 5
0
        private void SaveCatalogWithDialog()
        {
            OPMSaveFileDialog dlg = new OPMSaveFileDialog();

            dlg.Title            = Translator.Translate("TXT_SAVECATALOG");
            dlg.Filter           = Translator.Translate("TXT_CATALOG_FILTER");
            dlg.DefaultExt       = "ctx";
            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);
                _bwSave.RunWorkerAsync(dlg.FileName);
                ShowWaitDialog("TXT_WAIT_SAVING_CATALOG");
            }
        }
Esempio n. 6
0
        private void OnBrowseCatalog(object sender, EventArgs e)
        {
            OPMSaveFileDialog dlg = new OPMSaveFileDialog();

            dlg.Title            = Translator.Translate("TXT_SELECTCATALOG");
            dlg.Filter           = Translator.Translate("TXT_CATALOG_FILTER");
            dlg.DefaultExt       = "ctx";
            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);

                (BkgTask as Task).CatalogPath = dlg.FileName;
                lblCatalogPath.Text           = Translator.Translate("TXT_CATALOGPATH", dlg.FileName);

                ThreadPool.QueueUserWorkItem(new WaitCallback(DisplayCatalogContents));
            }
        }
        private void tsmiExportPartial_Click(object sender, EventArgs e)
        {
            try
            {
                string selRemoteName = string.Empty;

                TreeNode node = tvRemotes.SelectedNode;
                if (node != null)
                {
                    if (node.Tag is RCCServiceConfig.RemoteControlRow)
                    {
                        selRemoteName = (node.Tag as RCCServiceConfig.RemoteControlRow).RemoteName;
                    }
                    else if (node.Tag is RCCServiceConfig.RemoteButtonsRow)
                    {
                        selRemoteName = (node.Tag as RCCServiceConfig.RemoteButtonsRow).RemoteName;
                    }
                }

                RCCServiceConfig partialConfig = new RCCServiceConfig();

                var remote = (from rc in _config.RemoteControl
                              where rc.RemoteName == selRemoteName
                              select rc).FirstOrDefault();

                if (remote != null)
                {
                    partialConfig.RemoteControl.AddRemoteControlRow(selRemoteName,
                                                                    remote.InputPinName, remote.InputPinCfgData, remote.OutputPinName, remote.OutputPinCfgData, remote.Enabled);

                    var buttons = (from rb in _config.RemoteButtons
                                   where rb.RemoteName == selRemoteName
                                   select rb);

                    if (buttons != null)
                    {
                        foreach (var button in buttons)
                        {
                            partialConfig.RemoteButtons.AddRemoteButtonsRow(selRemoteName,
                                                                            button.InputData, button.OutputData, button.ButtonName, button.TargetWndName, button.Enabled, button.TimedRepeatRate);
                        }

                        partialConfig.RemoteButtons.AcceptChanges();
                    }

                    partialConfig.RemoteControl.AcceptChanges();

                    OPMSaveFileDialog dlg = new OPMSaveFileDialog();
                    dlg.Filter     = Translator.Translate("TXT_CONFIG_FILES_FILTER");
                    dlg.DefaultExt = "config";
                    dlg.Title      = Translator.Translate("TXT_EXPORT_PARTIAL");

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        partialConfig.WriteXml(dlg.FileName);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDispatcher.DispatchError(ex, false);
            }
        }
Esempio n. 8
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;
            }
        }