コード例 #1
0
ファイル: LoginViewModel.cs プロジェクト: markgould/Punch
        public Task ShowAsync()
        {
            var commands = new List <IDialogUICommand <DialogResult> >();

            _loginCommand          = new DialogUICommand <DialogResult>("Login", DialogResult.Ok, true);
            _loginCommand.Invoked += async(sender, args) =>
            {
                args.Cancel();     // Cancel command, we'll take it from here.

                await LoginAsync();

                if (_authenticationService.IsLoggedIn)
                {
                    args.DialogHost.TryClose(_loginCommand.DialogResult);
                }
            };
            commands.Add(_loginCommand);

#if !SILVERLIGHT
            var closeCommand = new DialogUICommand <DialogResult>("Close", DialogResult.Cancel, false, true);
            commands.Add(closeCommand);
#endif

            UpdateCommands();
            return(_dialogManager.ShowDialogAsync(commands, this));
        }
コード例 #2
0
        public Task <DialogResult> ShowDialogAsync()
        {
            _okCommand = new DialogUICommand <DialogResult>(DialogResult.Ok, true)
            {
                Enabled = IsComplete
            };
            var cancelCommand = new DialogUICommand <DialogResult>(DialogResult.Cancel, false, true);

            return(_dialogManager.ShowDialogAsync(new[] { _okCommand, cancelCommand }, this));
        }
コード例 #3
0
        public Task<DialogResult> ShowDialogAsync()
        {
            _okCommand = new DialogUICommand<DialogResult>(DialogResult.Ok, true) {Enabled = IsComplete};
            var cancelCommand = new DialogUICommand<DialogResult>(DialogResult.Cancel, false, true);

            return _dialogManager.ShowDialogAsync(new[] {_okCommand, cancelCommand}, this);
        }
コード例 #4
0
        public Task ShowAsync()
        {
            var commands = new List<IDialogUICommand<DialogResult>>();
            _loginCommand = new DialogUICommand<DialogResult>("Login", DialogResult.Ok, true);
            _loginCommand.Invoked += async (sender, args) =>
                {
                    args.Cancel(); // Cancel command, we'll take it from here.

                    await LoginAsync();

                    if (_authenticationService.IsLoggedIn)
                        args.DialogHost.TryClose(_loginCommand.DialogResult);
                };
            commands.Add(_loginCommand);

#if !SILVERLIGHT
            var closeCommand = new DialogUICommand<DialogResult>("Close", DialogResult.Cancel, false, true);
            commands.Add(closeCommand);
#endif

            UpdateCommands();
            return _dialogManager.ShowDialogAsync(commands, this);
        }