示例#1
0
 /// <summary>
 /// Presents a native dialog to the user which allows them to select a save
 /// location for the specified file.
 /// </summary>
 /// <param name="file">An instance of the <see cref="FileToSave"/> class
 /// which holds information about the file to be exported.</param>
 /// <param name="title">The title of the dialog. Note: The title is not
 /// shown on macOS 10.11 and above.</param>
 /// <param name="directory">The default directory in which file navigation
 /// should start. If this value is empty, the panel will remember the
 /// last visited directory.</param>
 /// <param name="onCompletion">A callback for when the presented dialog
 /// has been dismissed. The first parameter of the callback specifies whether
 /// a path was selected or the selection was cancelled.</param>
 public void SelectSavePath(FileToSave file,
                            string title,
                            string directory,
                            Action <bool, string> onCompletion)
 {
     nativeFileSO.SelectSavePath(file, title, directory, onCompletion);
 }
示例#2
0
        /// <summary>
        /// Presents a native dialog to the user which allows them to select a save
        /// location for the specified file and copies the file to that location.
        /// </summary>
        /// <remarks>
        /// See <see cref="NativeFileSO.SaveFile(FileToSave)"/> for more information
        /// on the usage of this method.
        /// </remarks>
        /// <param name="file">An instance of the <see cref="FileToSave"/> class
        /// which holds information about the file to be exported.</param>
        public void SaveFile(FileToSave file)
        {
            if (isBusy)
            {
                return;
            }

            isBusy = true;
            nativeFileSO.SaveFile(file);
        }
        public void SelectSavePath(FileToSave file,
                                   string title,
                                   string directory,
                                   Action <bool, string> onCompletion)
        {
            var path = SelectSavePathSync(file, title, directory);

            if (onCompletion != null)
            {
                onCompletion(path != null, path);
            }
        }
示例#4
0
        public void SaveFile(FileToSave file, string title, string directory)
        {
            if (isBusy)
            {
                return;
            }
            isBusy = true;

            pluginSetCallback(DidSelectPathForSaveCB);

            _cachedFileToSave = file;
            pluginSaveFile(file.Name, file.Extension, title, directory);
        }
示例#5
0
        public string SelectSavePathSync(FileToSave file,
                                         string title,
                                         string directory)
        {
            if (isBusy)
            {
                return(null);
            }
            isBusy = true;

            var pathPtr = pluginSaveFileSync(file.Name, file.Extension, title, directory);

            pluginFreeMemory();
            isBusy = false;

            return(Marshal.PtrToStringAnsi(pathPtr));
        }
示例#6
0
        public void SelectSavePath(FileToSave file,
                                   string title, string directory,
                                   Action <bool, string> onCompletion)
        {
            if (isBusy)
            {
                return;
            }
            isBusy = true;

            pluginSetCallback(DidSelectPathsForPathsCB);

            _pathsCallback = delegate(bool selected, string[] paths) {
                var path = paths.Length > 0 ? paths[0] : null;
                onCompletion(selected, path);
            };
            _cachedFileToSave = file;
            pluginSaveFile(file.Name, file.Extension, title, directory);
        }
        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();
        }
示例#8
0
 public void SaveFile(FileToSave file)
 {
     pluginSaveFile(file.SrcPath, file.Name);
 }
 public void SaveFile(FileToSave file)
 {
     SaveFile(file, "", "");
 }
示例#10
0
 public void SaveFile(FileToSave file)
 {
     SaveFile(file, null, null);
 }
示例#11
0
 public void SaveFile(FileToSave file)
 {
     JavaNativeSO.CallStatic("SaveFile", Activity, file.SrcPath, file.MimeType);
 }
示例#12
0
 /// <summary>
 /// Presents a native dialog to the user which allows them to select an export
 /// location for the specified file and exports/copies the file to that location.
 /// </summary>
 /// <example>
 /// The following example demonstrates how to export a file using a native interface.
 /// <code>
 /// // We have a text file that we want to export
 /// string path = "path/to/existing/fileToSave.txt";
 /// string newFilename = "ExportedFile.txt";
 ///
 /// FileToSave file = new FileToSave(path, newFilename, SupportedFileType.PlainText);
 ///
 /// // Allows the user to choose a save location and saves the
 /// // file to that location
 /// NativeFileSO.shared.SaveFile(file);
 /// </code>
 /// </example>
 /// <param name="file">An instance of the <see cref="FileToSave"/> class
 /// which holds information about the file to be exported.</param>
 public void SaveFile(FileToSave file)
 {
     nativeFileSO.SaveFile(file);
 }
示例#13
0
 /// <summary>
 /// Copies the specified file to the given path.
 /// </summary>
 /// <param name="file">The file to be saved/copied.</param>
 /// <param name="path">The full save path denoting the new file location.</param>
 public static void SaveFileToPath(FileToSave file, string path)
 {
     File.Copy(file.SrcPath, path, true);
 }
示例#14
0
 /// <summary>
 /// Presents a native dialog to the user which allows them to select a save
 /// location for the specified file.
 /// </summary>
 /// <returns>The selected save location. Returns <c>null</c> if no path was selected.</returns>
 /// <param name="file">An instance of the <see cref="FileToSave"/> class
 /// which holds information about the file to be exported.</param>
 /// <param name="title">The title of the dialog. Note: The title is not
 /// shown on macOS 10.11 and above.</param>
 /// <param name="directory">The default directory in which file navigation
 /// should start. If this value is empty, the panel will remember the
 /// last visited directory.</param>
 public string SelectSavePathSync(FileToSave file,
                                  string title,
                                  string directory)
 {
     return(nativeFileSO.SelectSavePathSync(file, title, directory));
 }
示例#15
0
 /// <summary>
 /// Presents a native dialog to the user which allows them to select a save
 /// location for the specified file and copies the file to that location.
 /// </summary>
 /// <param name="file">An instance of the <see cref="FileToSave"/> class
 /// which holds information about the file to be exported.</param>
 /// <param name="title">The title of the dialog. Note: The title is not
 /// shown on macOS 10.11 and above.</param>
 /// <param name="directory">The default directory in which file navigation
 /// should start. If this value is empty, the panel will remember the
 /// last visited directory.</param>
 public void SaveFile(FileToSave file, string title, string directory)
 {
     nativeFileSO.SaveFile(file, title, directory);
 }