示例#1
0
        public static ContainerBuilder SaveExportedFilesTo(this ContainerBuilder builder, string fileName)
        {
            var fileChooser = Substitute.For <IFileSaveChooser>();

            fileChooser.GetFileSaveLocation().Returns(Task.FromResult(ExportResult.Success(fileName)));
            builder.Register(_ => fileChooser).As <IFileSaveChooser>();
            return(builder);
        }
示例#2
0
        private ExportResult GetValue()
        {
            using (var dialog = new SaveFileDialog
            {
                Filter = "Excel spreadsheet|*.xlsx;*.xls;|All files|*.*"
            })
            {
                shower.ShowDialog(dialog);

                if (!String.IsNullOrWhiteSpace(dialog.FileName))
                {
                    return(ExportResult.Success(dialog.FileName));
                }

                return(ExportResult.Incomplete());
            }
        }