Exemplo n.º 1
0
        public AddMedicationsView(AddMedicationsViewModel addMedicationsViewModel)
        {
            InitializeComponent();
            _addMedicationsViewModel = addMedicationsViewModel;

            _textBoxArrivalPackage.DataBindings.Add("Text", _addMedicationsViewModel, nameof(_addMedicationsViewModel.ArrivalPackages),
                                                    true, DataSourceUpdateMode.OnPropertyChanged);
            _textBoxDescription.DataBindings.Add("Text", _addMedicationsViewModel, nameof(_addMedicationsViewModel.Description),
                                                 true, DataSourceUpdateMode.OnPropertyChanged);
            _textBoxQuantityPackage.DataBindings.Add("Text", _addMedicationsViewModel, nameof(_addMedicationsViewModel.QuantityPackage),
                                                     true, DataSourceUpdateMode.OnPropertyChanged);
            _textBoxRestPackage.DataBindings.Add("Text", _addMedicationsViewModel, nameof(_addMedicationsViewModel.RestPackages),
                                                 true, DataSourceUpdateMode.OnPropertyChanged);
            _textBoxRemainedUnits.DataBindings.Add("Text", _addMedicationsViewModel, nameof(_addMedicationsViewModel.RemainedUnits),
                                                   true, DataSourceUpdateMode.OnPropertyChanged);

            _dateTimeArivalDate.DataBindings.Add("Value", _addMedicationsViewModel, nameof(_addMedicationsViewModel.ArrivalDate));
            _datePikerShelfLife.DataBindings.Add("Value", _addMedicationsViewModel, nameof(_addMedicationsViewModel.ShelfLife));

            _comboBoxName.DataBindings.Add("Text", _addMedicationsViewModel, nameof(_addMedicationsViewModel.Name));

            _buttonAddMedecine.Click += (s, e) => _addMedicationsViewModel.SaveMedications();

            Load += AddMedicationsView_Load;
        }
Exemplo n.º 2
0
        public void ShowAddMedicationsView()
        {
            var vm   = new AddMedicationsViewModel(this);
            var from = new AddMedicationsView(vm);

            from.Owner = _mainfrom;
            from.ShowDialog();
        }