コード例 #1
0
ファイル: Form1.cs プロジェクト: mattvaughan/Twitch-Sub
 private void BrowseButton_Click(object sender, EventArgs e)
 {
     if (FileLocationDialog.ShowDialog() == DialogResult.OK)
     {
         FileLocationField.Text = FileLocationDialog.FileName;
     }
 }
コード例 #2
0
        public virtual void Export(Document document, IEnumerable <ChartPage> charts)
        {
            if (document == null || charts == null)
            {
                throw new ArgumentNullException();
            }

            if (charts.IsEmpty())
            {
                return;
            }

            var documentType = DocumentType;

            if (documentType == null)
            {
                return;
            }

            if (charts.Count() > 1 && !SupportMultiCharts)
            {
                var dialog = new FolderBrowserDialog();
                dialog.Description = Lang.GetText("Select a folder to export charts");
                if (dialog.ShowDialog(Program.MainForm) == DialogResult.OK)
                {
                    ExportChartsToFolder(document, charts, dialog.SelectedPath);
                }
            }
            else
            {
                var dialog = new SaveFileDialog();
                dialog.Filter     = documentType.FileDialogFilter;
                dialog.DefaultExt = documentType.DefaultExtension;
                dialog.Title      = Lang.GetText("Export");
                dialog.FileName   = ST.EscapeFileName(document.Name);
                if (dialog.ShowDialog(Program.MainForm) == DialogResult.OK)
                {
                    if (ExportChartsToFile(document, charts, dialog.FileName))
                    {
                        var fld = new FileLocationDialog(dialog.FileName, dialog.FileName);
                        fld.Text = Lang.GetText("Export Success");
                        fld.ShowDialog(Program.MainForm);
                    }
                }
            }
        }