Esempio n. 1
0
        public EquipmentsViewModel(MainContext mainContext) : base(mainContext)
        {
            this.SearchHint = this.MainContext.GetLocal(string.Empty);

            // TODO : Generate this method
            //var captions = new EquipmentCaptions(serialNumberCaption, powerCaption, lastCheckedCaption);
            this.SerialNumberOption = new SortOption(this.MainContext.GetLocal(nameof(EquipmentProperty.SerialNumber)), EquipmentProperty.SerialNumber);
            this.PowerOption        = new SortOption(this.MainContext.GetLocal(nameof(EquipmentProperty.Power)), EquipmentProperty.Power);
            this.LastCheckedOption  = new SortOption(this.MainContext.GetLocal(nameof(EquipmentProperty.LastChecked)), EquipmentProperty.LastChecked);
            this.Captions           = new EquipmentCaptions("", "", "");

            this.ClearSearchCommand = new Command(this.ClearSearch);

            this.SelectSortOptionCommand = new Command(this.SelectSortOption);
        }
Esempio n. 2
0
        public EquipmentViewModel(Equipment model, EquipmentCaptions captions)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (captions == null)
            {
                throw new ArgumentNullException(nameof(captions));
            }

            this.Model               = model;
            this.SerialNumber        = model.SerialNumber;
            this.SerialNumberCaption = captions.SerialNumber;
            this.Power               = model.Power.ToString(@"F2");
            this.PowerCaption        = captions.Power;
            this.LastChecked         = model.LastChecked.HasValue ? model.LastChecked.Value.ToString(@"dd MMM yyyy") : GetDisplayValue(string.Empty);;
            this.LastCheckedCaption  = captions.LastChecked;
        }