Exemplo n.º 1
0
        private async Task DisplayContentDialog(ContentDialog dialog)
        {
            try
            {
                if (isDialogOpened)
                {
                    if (dialogQueue == null)
                    {
                        dialogQueue = new Queue <ContentDialog>();
                    }
                    dialogQueue.Enqueue(dialog);
                    return;
                }

                dialog.Closed += OnDialogClosed;
                isDialogOpened = true;
                NativeMethods.FlashWindow(this.Hwnd);
                await dialog.ShowAsync(ContentDialogPlacement.Popup);
            }
            catch (Exception e)
            {
                isDialogOpened = false;
                Logger.Error($"Failed to display ContentDialog of type {dialog.GetType()}", e);
            }
        }
Exemplo n.º 2
0
        private void ResultsList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var item = sender as System.Windows.Controls.ListBoxItem;

            if (item != null && item.IsSelected)
            {
                GameEntry entry = item.Content as GameEntry;
                Library.CopyEntryMetadata(slug, entry);
                Hide();
                original.ShowAsync();

                if (original.GetType() == typeof(EditGameInfo))
                {
                    ((EditGameInfo)original).Refresh();
                }
            }
        }
        private Task HandleDialogNavigationAsync(ContentDialog dialog, object parameter)
        {
            _logging.WriteLine($"Opening {dialog.GetType().Name} with parameter: {parameter}");
            _currentDialog = dialog;

            dialog.Opened += async(s, e) =>
            {
                _logging.WriteLine($"Opened {s.GetType().Name}.");
                _dialogIsOpen = true;
                await HandleActivationAsync(dialog.DataContext as INavigable, parameter, NavigationMode.New);
            };
            dialog.Closed += (s, e) =>
            {
                _logging.WriteLine($"Closed {s.GetType().Name}.");
                _dialogIsOpen = false;
            };

            return(dialog.ShowAsync().AsTask());
        }