Пример #1
0
        public string SaveFile(string title, string initialDirectory, string defaultFileName = null, DialogFilterPair filter = null, IntPtr?owner = null)
        {
            var builder = new CommonSaveDialogBuilder()
                          .Initialize(title, initialDirectory)
                          .SetDefaults(defaultFileName, filter.ExtensionsList)
                          .AddFilter(filter);

            return(Save(builder, owner));
        }
Пример #2
0
        public string Save(CommonSaveDialogBuilder builder, IntPtr?owner = null)
        {
            string result = null;

            using (var dialog = builder.Dialog)
            {
                if (dialog.ShowDialog(GetOwnerHandle(owner)) == CommonFileDialogResult.Ok)
                {
                    result = dialog.FileName;
                }
            }
            return(result);
        }
Пример #3
0
        public string Save(CommonSaveDialogBuilder builder)
        {
            string result = null;

            using (var dialog = builder.Dialog)
            {
                if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    result = dialog.FileName;
                }
            }
            return(result);
        }
Пример #4
0
        public string SaveFile(string title, string initialDirectory, string defaultFileName, DialogFilterPair filter)
        {
            var builder = new CommonSaveDialogBuilder()
                          .Initialize(title, initialDirectory)
                          .SetDefaults(defaultFileName, filter.ExtensionsList)
                          .AddFilter(filter);

            string result = null;

            using (var dialog = builder.Build())
            {
                if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    result = dialog.FileName;
                }
            }
            return(result);
        }