示例#1
0
        public TillView(TillModel tillModel, ObservableCollection<TillDivisionModel> tillDivisions)
        {
            InitializeComponent();
            DataContext = _viewModel = new TillViewModel(tillModel, tillDivisions);

            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;
            Unloaded += TillView_Unloaded;

        }
示例#2
0
        private void AddTill()
        {
            var tillModel = new TillModel(new Till()
            {
                ID = Guid.NewGuid()
            });

            tillModel.PropertyChanged += OnTillPropertyChanged;
            Till = tillModel;
        }
示例#3
0
 public async void RefreshTills(TillModel _till)
 {
     var tillDivisions = await _adminDataUnit.TillDivisionsRepository.GetAllAsync();
     TillDivisions = new ObservableCollection<TillDivisionModel>(tillDivisions.Select(x => new TillDivisionModel(x)));
     if (_till != null)
     {
         var selectedTillDivision = TillDivisions.FirstOrDefault(tillDiv => tillDiv.TillDivision.ID == _till.TillDivision.ID);
         if (selectedTillDivision != null)
         {
             var selectedTill = selectedTillDivision.Tills.FirstOrDefault(till => till.Till.ID == _till.Till.ID);
             if (selectedTill != null)
             {
                 SelectedTreeViewObject = selectedTill;
                 TillDivisions.ForEach(tilldivision =>
                     {
                         tilldivision.IsExpanded = false;
                     });
                 selectedTillDivision.IsExpanded = true;
             }
         }
     }
 }