コード例 #1
0
        public AddDeviceViewModel(IMainViewModelCallback mainVM)
        {
            _mainVMCallback = mainVM;

            SubmitCommand = new DelegateCommand(OnSubmit, OnCanSubmit);
            RevertCommand = new DelegateCommand(OnRevert, OnCanRevert);
        }
コード例 #2
0
        public EditDeviceViewModel(tblDeviceDetails deviceObj, IMainViewModelCallback mainVM)
        {
            _deviceObj      = deviceObj;
            _mainVMCallback = mainVM;

            SubmitCommand = new DelegateCommand(OnSubmit, OnCanSubmit);
            RevertCommand = new DelegateCommand(OnRevert, OnCanRevert);

            if (deviceObj != null)
            {
                ID            = deviceObj.id;
                Location      = deviceObj.location;
                Device_Health = deviceObj.device_health;
                Type          = deviceObj.type;
                Price         = Convert.ToDouble(deviceObj.price);
                Last_Used     = Convert.ToDateTime(deviceObj.last_used).Date;
                Color         = deviceObj.color;
            }
            else
            {
                //Implement defaults or fetch current selected item
            }
        }