示例#1
0
        private async void OnDeleteDirectoryCommandExecute()
        {
            // Rückfrage
            // https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/dialogs-and-flyouts/dialogs
            Windows.UI.Xaml.Controls.ContentDialog locationPromptDialog = new Windows.UI.Xaml.Controls.ContentDialog
            {
                Title             = "Bestätigung",
                Content           = "Möchten Sie den gesamten Ordner löschen?",
                CloseButtonText   = "Abbrechen",
                PrimaryButtonText = "Löschen"
            };

            Windows.UI.Xaml.Controls.ContentDialogResult result = await locationPromptDialog.ShowAsync();

            // wenn löschen bestätigt
            if (result == Windows.UI.Xaml.Controls.ContentDialogResult.Primary)
            {
                // Ordner lokal löschen
                StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
                StorageFolder currentFolder = await storageFolder.GetFolderAsync(SelectedDirName);

                await currentFolder.DeleteAsync();

                // Ordner in Dropbox löschen
                DropboxCommunication dropbox = new DropboxCommunication(AppSettings.Default.DropBoxAppToken);
                dropbox.DeleteFolderAsync(SelectedDirName);
                UpdateDirNamesAsync();
            }
        }
示例#2
0
        /// <summary>
        /// Shows the picker UI and returns the selected device; does not require you to register for an event.
        /// </summary>
        /// <param name="selection">The rectangle from which you want the picker to fly out.
        /// <para>Ignored on Phone platforms as dialog is presented full-screen and Windows Desktop where it is centered.</para></param>
        /// <param name="placement">The edge of the rectangle from which you want the picker to fly out.
        /// <para>Ignored on Phone platforms as dialog is presented full-screen and Windows Desktop where it is centered.</para></param>
        /// <returns></returns>
        public async Task <DeviceInformation> PickSingleDeviceAsync(Rect selection, Placement placement)
        {
#if __ANDROID__ || __IOS__ || WIN32 || WINDOWS_UWP
            return(await DoPickSingleDeviceAsync(selection, placement));
#elif WINDOWS_PHONE_APP
            _dialog = new DevicePickerDialog(this);
            Windows.UI.Xaml.Controls.ContentDialogResult result = await _dialog.ShowAsync();

            return(_dialog.SelectedDevice);
#elif WINDOWS_APP
            _popup = new Popup();
            DevicePickerControl dpc = new DevicePickerControl(this, _popup);
            _popup.Child                 = dpc;
            _popup.HorizontalOffset      = selection.X + selection.Width;
            _popup.VerticalOffset        = selection.Y;
            _popup.IsLightDismissEnabled = true;
            _popup.IsOpen                = true;
            return(await Task.Run <DeviceInformation>(() => { return dpc.WaitForSelection(); }));
#else
            return(null);
#endif
        }