public void RefreshTasks() { Tasks.Clear(); foreach (IDeviceTask task in _device.Tasks) { if (!task.IsDelete) { DeviceTaskViewModel taskVM = new DeviceTaskViewModel(task); Tasks.Add(taskVM); } } }
private void RefreshTaskList() { int taskIDForSelect = int.MinValue; if (SelectedTask != null) { taskIDForSelect = SelectedTask.ID; } OnPropertyChanged(nameof(Tasks)); if (taskIDForSelect > int.MinValue) { DeviceTaskViewModel task = Tasks.Where(t => t.ID == taskIDForSelect).FirstOrDefault(); SelectedTask = task; } }