Exemplo n.º 1
0
        public ContragentForm()
        {
            InitializeComponent();
            var vm = new ContragentFormViewModel();

            this.DataContext = vm;
            if (vm.CloseAction == null)
            {
                vm.CloseAction = new Action(() => this.Close());
            }
        }
Exemplo n.º 2
0
        public ContragentForm(IViewManager viewManager, IContragentService contragentService)
        {
            InitializeComponent();

            ContragentFormViewModel vm = (ContragentFormViewModel)this.DataContext; // this creates an instance of the ViewModel

            if (vm.CloseAction == null)
            {
                vm.CloseAction = new Action(() => this.Close());
            }

            vm.ViewManager       = viewManager;
            vm.ContragentService = contragentService;
        }