コード例 #1
0
        public UserEditorWindowViewModel(UserEditorWindow view, User user, UserRepository repository)
        {
            if (user == null)
            {
                CreateMode = true;
                user = new User();
            }

            this.view = view;
            this.repository = repository;

            User = user;

            if (CreateMode) return;

            view.SetPasswordDots();
            view.Set(User.Type);
        }
コード例 #2
0
        public void OpenEditor(User user)
        {
            try
            {
                if (user != null)
                {
                    user = user.Clone();
                }

                var editor = new UserEditorWindow(user);
                var result = editor.ShowDialog();

                if (result.HasValue && result.Value)
                {
                    RetrieveData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }