示例#1
0
        private void DidSelectPathForSave(bool pathsSelected, string[] paths)
        {
            isBusy = false;

            var toSave = _cachedFileToSave;

            if (toSave == null || !pathsSelected)
            {
                return;
            }

            var path = paths[0];

            NativeFileSOMacWin.SaveFileToPath(toSave, path);
        }
        public void SaveFile(FileToSave file, string title, string directory)
        {
            if (isBusy)
            {
                return;
            }
            isBusy = true;

            var dialog = new VistaSaveFileDialog();

            if (string.IsNullOrEmpty(directory))
            {
                dialog.RestoreDirectory = true;
                dialog.FileName         = file.Name;
            }
            else
            {
                dialog.FileName = CreateFilenameForSaveDialog(directory, file.Name);
            }

            dialog.DefaultExt = file.Extension;
            if (dialog.DefaultExt.Length > 0)
            {
                dialog.AddExtension = true;
                dialog.SupportMultiDottedExtensions = true;
            }
            if (file.FileType != null)
            {
                dialog.Filter = EncodeFilters(new [] { file.FileType });
            }

            dialog.Title = title;

            var result = dialog.ShowDialog(new Win32Window(GetActiveWindow()));

            isBusy = false;
            if (result == DialogResult.OK)
            {
                NativeFileSOMacWin.SaveFileToPath(file, dialog.FileName);
            }
            dialog.Dispose();
        }