private async void OnPrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var deferral = args.GetDeferral();

            var error = await ViewModel.AcceptChangesAsync();

            if (!string.IsNullOrEmpty(error))
            {
                args.Cancel = true;

                await new MessageDialog(error, I18N.Translate("InvalidInput")).ShowAsync();

                SetupFocus();
            }

            deferral.Complete();
        }
        private async void CommandTextBox_OnKeyUp(object sender, KeyRoutedEventArgs e)
        {
            switch (e.Key)
            {
            case VirtualKey.Down:
            case VirtualKey.Up:

                if (!CommandTextBox.IsSuggestionListOpen)
                {
                    CommandTextBox.IsSuggestionListOpen = true;
                }

                return;

            case VirtualKey.Enter:

                if (string.IsNullOrWhiteSpace(CommandTextBox.Text) && !CommandTextBox.IsSuggestionListOpen)
                {
                    CommandTextBox.IsSuggestionListOpen = true;
                }
                else
                {
                    var error = await ViewModel.AcceptChangesAsync();

                    if (string.IsNullOrEmpty(error))
                    {
                        _dialogResult = ContentDialogResult.Primary;

                        _showDialogOperation.Cancel();
                    }
                    else
                    {
                        await new MessageDialog(error, I18N.Translate("InvalidInput")).ShowAsync();
                    }
                }

                return;
            }
        }