コード例 #1
0
        private async void EnterSystem()
        {
            try
            {
                UserDto currentUser = _controller.ResolveView <AuthorizationView, AuthorizationViewModel>()
                                      .RunDialogWithResult(vm => vm.User);

                if (currentUser != null)
                {
                    _controller.Container.Bind <UserDto>().ToInstance(currentUser);
                    _currentUser    = currentUser;
                    CurrentUserName = currentUser.FIO;

                    await System.Threading.Tasks.Task.Run(() =>
                    {
                        Regions = new ObservableCollection <RegionDto>(_dataServiceProxy.LoadData <RegionDto>());
                    });

                    InitPages();
                }
            }
            catch (FaultException <AuthorizationFault> ex)
            {
                MessageService.ShowError(ex.Message);
            }
            catch (InvalidOperationException ex)
            {
                MessageService.ShowError(ex.Message);
            }
            catch (Exception ex)
            {
                string errorMessage = ex.InnerException.Message ?? ex.Message;
                MessageService.ShowError(errorMessage);
            }
        }
コード例 #2
0
        protected async void SendMail(string email)
        {
            try
            {
                MailMessageDto mailDto = _controller.ResolveView <SendMailView, SendMailViewModel>()
                                         .RunDialogWithResult(vm => vm.MailObject);

                if (mailDto != null)
                {
                    await _mailService.SendMail(email, mailDto.Subject, mailDto.Text, mailDto.Attachments.ToArray());
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex.Message);
            }
        }