示例#1
0
 /// <summary>
 /// Gets the name of the current file for a save operation.  If no file is
 /// defined the save dialog box will be shown and that result will be returned.
 /// </summary>
 /// <param name="fileChosenCb">A function that is called when a file is chosen with the name of the chosen file.</param>
 public void saveFile(FileChosen fileChosenCb)
 {
     if (currentFile == null)
     {
         saveFileAs(fileChosenCb);
     }
     else
     {
         fileChosenCb(currentFile);
     }
 }
示例#2
0
        /// <summary>
        /// This will show the save file dialog and will return the newly chosen file.
        /// </summary>
        /// <param name="parent">The parent window.</param>
        /// <returns>The current file or null if the user canceled the dialog.</returns>
        public void saveFileAs(FileChosen fileChosenCb)
        {
            FileSaveDialog save = new FileSaveDialog(ParentWindow, "", DefaultDirectory, "", Filter);

            save.showModal((result, file) =>
            {
                if (result == NativeDialogResult.OK && !String.IsNullOrEmpty(file))
                {
                    currentFile = file;
                    fileChosenCb(currentFile);
                }
            });
        }
示例#3
0
        /// <summary>
        /// Show the open file dialog and return the chosen file.
        /// <param name="fileChosenCb">A function that is called when a file is chosen with the name of the chosen file.</param>
        /// </summary>
        public void openFile(FileChosen fileChosenCb)
        {
            FileOpenDialog fileOpen = new FileOpenDialog(ParentWindow, "", DefaultDirectory, "", Filter, false);

            fileOpen.showModal((result, files) =>
            {
                String file = files.FirstOrDefault();
                if (result == NativeDialogResult.OK && !String.IsNullOrEmpty(file))
                {
                    currentFile = file;
                    fileChosenCb(currentFile);
                }
            });
        }
示例#4
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == 42 && resultCode == Result.Ok)
            {
                if (data == null)
                {
                    return;
                }

                Uri uri       = null;
                var stringUri = data.ToUri(IntentUriType.None);
                uri = new Uri(stringUri);

                FileChosen?.Invoke(uri);
            }
        }
示例#5
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == MyPermissions.READ_MEDIA_REQUEST_CODE)
            {
                SettingToneViewModel.IsFinding = true;

                if (resultCode == Result.Ok)
                {
                    if (data == null)
                    {
                        return;
                    }
                    var _uri     = data.Data;
                    var realPath = GetRealPathFromURI(_uri);
                    //var stringUri = data.ToUri(IntentUriType.None);
                    //Uri uri = new Uri(stringUri);

                    FileChosen?.Invoke(realPath);
                }
            }
        }
示例#6
0
 protected void OnFileChosen(FileMenuArgs args) => FileChosen?.Invoke(this, args);
示例#7
0
 void OnFileChosen(Uri uri)
 {
     FileChosen?.Invoke(uri);
     _mainActivity.FileChosen -= OnFileChosen;
 }
示例#8
0
 void OnFileChosen(string path)
 {
     FileChosen?.Invoke(path);
     _mainActivity.FileChosen -= OnFileChosen;
 }