Beispiel #1
0
 public void openBrowser()
 {
     FileBrowser.OnSuccess getpath = setpath;
     FileBrowser.OnCancel  none    = cancelled;
     Debug.Log("Opening browser");
     FileBrowser.ShowLoadDialog(getpath, none);
 }
    } // ShowLoadDialogCoroutine()

    static public IEnumerator ShowSaveDialogCoroutine(FileBrowser.OnSuccess onSuccess, FileBrowser.OnCancel onCancel, string initialPath)
    {
        // Show a load file dialog and wait for a response from user
        // Load file/folder: file, Initial path: default (Documents), Title: "Load File", submit button text: "Load"
        yield return(FileBrowser.WaitForSaveDialog(onSuccess, onCancel, false, initialPath, "Load File", "Load"));

        // Dialog is closed
        // Print whether a file is chosen (FileBrowser.Success)
        // and the path to the selected file (FileBrowser.Result) (null, if FileBrowser.Success is false)
        Debug.Log(FileBrowser.Success + " " + FileBrowser.Result);

        if (FileBrowser.Success)
        {
            // If a file was chosen, read its bytes via FileBrowserHelpers
            // Contrary to File.ReadAllBytes, this function works on Android 10+, as well
            byte[] bytes = FileBrowserHelpers.ReadBytesFromFile(FileBrowser.Result);
        }
    } // ShowSaveDialogCoroutine()
Beispiel #3
0
    public void SaveLunchChoiceSpreadSheet()
    {
        //assign delegate to save the lunch data to the appropriate path once the pop window successfully retrieves it.
        //the delegate is added to a call back inside the widow
        FileBrowser.OnSuccess onSuccessDelegate = new FileBrowser.OnSuccess(new System.Action <string[]>((string[] paths) =>
        {
            StreamWriter writer = new StreamWriter(paths[0], false);
            Dictionary <string, int> lunchChoices = DataBase.Instance.GetTodaysLunchChoices();

            writer.WriteLine("Lunch Choice,Amount of Lunches");
            foreach (string lunchChoice in lunchChoices.Keys)
            {
                Debug.Log(lunchChoice + ", " + lunchChoices[lunchChoice]);
                writer.WriteLine(lunchChoice + "," + lunchChoices[lunchChoice]);
            }
            writer.Close();
        }));
        FileBrowser.SetFilters(false, new FileBrowser.Filter("CSV", ".csv"));
        FileBrowser.ShowSaveDialog(onSuccessDelegate, null, FileBrowser.PickMode.FilesAndFolders, initialFilename: "Student Lunch Choice Spreadsheet");
    }
 public void OpenFileDialogOnClick()
 {
     FileBrowser.SetFilters(false, new FileBrowser.Filter("XML-Schema", ".xml"));
     FileBrowser.OnSuccess onSuccess = new FileBrowser.OnSuccess(SavePath);
     FileBrowser.ShowLoadDialog(onSuccess, null);
 }
 public void SetLoadPath()
 {
     FileBrowser.OnSuccess on_success = (string path) => { load_path.value = path; };
     FileBrowser.ShowSaveDialog(on_success, null,
                                false, System.IO.Path.GetDirectoryName(load_path.value), "Select File", "Select");
 }