public CardInfoViewModel(IShell shell, CardService service, EmployeeService employeeService)
        {
            try
            {
                this.Entity        = service.GetById((int)shell.LastNavigatedDialogParameter);
                this.IsWriteRights = employeeService.CurrentUser.Role == Role.Manager;
            }
            catch (Exception)
            {
                shell.OpenDialogByUri(CompanyUris.ConnectionLost, false, null);
                return;
            }

            this.ViewEmployeeInfoCommand =
                new RelayCommand(
                    () => shell.OpenDialogByUri(CompanyUris.EmployeeInfo, true, this.Entity.EmployeeId));
            this.OpenEditor = new RelayCommand(() =>
            {
                shell.NavigateByUri(CompanyUris.CardEditor, this.Entity.Id);
                shell.CloseDialog();
            });


            this.ApplyCommand = new RelayCommand(() => shell.CloseDialog());
        }
示例#2
0
 public ConnectionLostDialogViewModel(IShell shell)
 {
     this.ApplyCommand
         = new RelayCommand(() =>
     {
         shell.NavigateByUri(CompanyUris.Auth);
         shell.CloseDialog();
     });
 }