コード例 #1
0
        public void Visit(IAsyncMvvmCommand command)
        {
            var errorTitleKey   = string.Concat(command.Name, TitleResourceKeySuffix);
            var errorContentKey = string.Concat(command.Name, ContentResourceKeySuffix);
            var errorTitle      = _resources.Get(errorTitleKey);
            var errorContent    = _resources.Get(errorContentKey);
            var isDefault       = command.SetDefaultError(async(ct, ex) =>
            {
                await _messageDialog.Show(ct, errorTitle, errorContent);
            });

            if (isDefault && (string.IsNullOrEmpty(errorTitle) || string.IsNullOrEmpty(errorContent)))
            {
                var sb = new StringBuilder();
                sb.AppendLine(string.Concat("Resources missing for command ", command.Name));
                sb.AppendLine("Missing resources keys :");
                if (string.IsNullOrEmpty(errorTitle))
                {
                    sb.AppendLine(errorTitleKey);
                }
                if (string.IsNullOrEmpty(errorContent))
                {
                    sb.AppendLine(errorContentKey);
                }
                throw new InvalidOperationException(sb.ToString());
            }
        }
コード例 #2
0
 public void Visit <TCommand, TObservable>(IAsyncMvvmCommand <TCommand, TObservable> command)
 {
 }