Esempio n. 1
0
    async void handleDestination(object sender, EventArgs args)
    {
        var dialog = await Dialog.Instance();

        // Create an OpenDialogOptions reference with custom Properties
        var openOptions = new OpenDialogOptions()
        {
            PropertyFlags = OpenDialogProperties.OpenDirectory | OpenDialogProperties.CreateDirectory
        };

        // Now show the open dialog passing in the options created previously
        // and a call back function when a file is selected.
        // If a call back function is not specified then the ShowOpenDialog function
        // will return an array of the selected file(s) or an empty array if no
        // files are selected.
        var destDirectory = await dialog.ShowOpenDialog(await BrowserWindow.GetFocusedWindow(),
                                                        openOptions
                                                        );

        if (destDirectory != null && destDirectory.Length > 0)
        {
            await destination.SetProperty("value", destDirectory[0]);

            await destination.DispatchEvent(changeEvent);
        }
    }
Esempio n. 2
0
    async void handleSource(object sender, EventArgs args)
    {
        var dialog = await Dialog.Instance();

        // Create an OpenDialogOptions reference with custom FileFilters
        var openOptions = new OpenDialogOptions()
        {
            Filters = new FileFilter[]
            {
                //new FileFilter() { Name = "All Files", Extensions = new string[] {"*"} },
                new FileFilter()
                {
                    Name = "Movies", Extensions = new string[] { "mkv", "avi" }
                },
            }
        };

        // Now show the open dialog passing in the options created previously
        // and a call back function when a file is selected.
        // If a call back function is not specified then the ShowOpenDialog function
        // will return an array of the selected file(s) or an empty array if no
        // files are selected.
        var sourceFile = await dialog.ShowOpenDialog(await BrowserWindow.GetFocusedWindow(),
                                                     openOptions
                                                     );

        if (sourceFile != null && sourceFile.Length > 0)
        {
            await source.SetProperty("value", sourceFile[0]);

            await name.SetProperty("value", Path.GetFileNameWithoutExtension(sourceFile[0]) + ".m4v");

            await source.DispatchEvent(changeEvent);

            await ipcRenderer.Send("getMetaData", sourceFile[0]);
        }
    }