예제 #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;
 }