Ejemplo n.º 1
0
        private void ControlButtonCommand_Execute(object arg)
        {
            InputDialogResultActionType actionType = (InputDialogResultActionType)arg;

            switch (actionType)
            {
            case InputDialogResultActionType.Negative:
                Result = new InputDialogResult(InputDialogResultActionType.Negative, null);
                break;

            case InputDialogResultActionType.Positive:
                Result = new InputDialogResult(InputDialogResultActionType.Positive, Content);
                break;

            default:
                break;
            }
            Close();
        }
Ejemplo n.º 2
0
        public static string ShowStringInputPrompt(string windowTitle = null, string header = null, string defaultValue = null, Func <object, bool> validator = null)
        {
            InputDialogInfo info = new InputDialogInfo
            {
                WindowTitle              = windowTitle ?? DefaultWindowTitle,
                Header                   = header,
                ContentType              = typeof(InputDialogTextViewModel),
                ContentTemplateKey       = InputDialogDefaultContentTemplateKeys.Text,
                CanPositiveActionExecute = validator,
                DefaultValue             = defaultValue
            };
            InputDialog dialog = new InputDialog
            {
                Owner = WindowHelper.GetActiveWindowInstance()
            };
            InputDialogResult result = dialog.ShowDialog(info);

            return(result.ResultAction == InputDialogResultActionType.Positive ?
                   result.GetValueRefrenceAs <InputDialogTextViewModel>().ResultValue : null);
        }