Ejemplo n.º 1
0
 private void PreparingDeviceCopy()
 {
     _originalDeviceVM = _currentDeviceVM;
     _deviceCopy       = _deviceEditor.GetDeviceCopy(_originalDeviceVM.ID);
     _currentDeviceVM  = new DeviceViewModel(_deviceCopy);
     RefreshTaskList();
 }
Ejemplo n.º 2
0
        private async void ExecuteFindAndConnect(object param)
        {
            ushort          selectedDeviceID = SelectedDevice != null ? SelectedDevice.ID : ushort.MinValue;
            DeviceViewModel forSelect        = null;

            await _devicesManager.FindAndConnectDevicesAsync();

            Devices.Clear();
            List <DeviceViewModel> devicesVM = new List <DeviceViewModel>();

            foreach (IDevice device in _devicesManager.Devices.Values)
            {
                DeviceViewModel deviceVM = new DeviceViewModel(device);
                devicesVM.Add(deviceVM);

                if (deviceVM.ID == selectedDeviceID)
                {
                    forSelect = deviceVM;
                }
            }
            Devices = devicesVM;
            OnPropertyChanged(nameof(Devices));

            if (forSelect != null)
            {
                SelectedDevice = forSelect;
            }
        }
Ejemplo n.º 3
0
        private void CommandInvokedHandler(IUICommand command)
        {
            if (command.Label == SC.Yes)
            {
                _currentDeviceVM.ApplyChanges();
                _deviceEditor.ApplyAndSaveChanges(_deviceCopy);
                _originalDeviceVM.FullRefresh();
                _currentDeviceVM = _originalDeviceVM;
                OnPropertyChanged(nameof(Description));
                RefreshTaskList();

                _deviceCopy = null;
                IsEditing   = false;
            }

            if (command.Label == SC.No)
            {
                _deviceCopy      = null;
                _currentDeviceVM = _originalDeviceVM;
                OnPropertyChanged(nameof(Description));
                RefreshTaskList();

                IsEditing = false;
            }
        }
Ejemplo n.º 4
0
        public DevicePresenterViewModel(DeviceViewModel device, IDeviceEditor deviceEditor)
        {
            _deviceEditor    = deviceEditor;
            _currentDeviceVM = device;
            Description      = device.Description;
            Edit             = new RelayCommand(ExecuteEdit);
            AddTask          = new RelayCommand(ExecuteAddTask);
            RemoveTask       = new RelayCommand(ExecuteRemoveTask);

            RefreshTaskList();
        }
Ejemplo n.º 5
0
        public DevicesViewModel(IDevicesManager devicesManager)
        {
            _devicesManager = devicesManager;
            //DevicePresenterVM = new DevicePresenterViewModel(devicesManager.GetDeviceEditor());

            foreach (IDevice device in devicesManager.Devices.Values)
            {
                DeviceViewModel deviceVM = new DeviceViewModel(device);
                Devices.Add(deviceVM);
            }
            OnPropertyChanged(nameof(Devices));

            FindAndConnect = new RelayCommand(ExecuteFindAndConnect);
            SendId         = new RelayCommand(ExecuteSendId);
            GetId          = new RelayCommand(ExecuteGetId);
        }