private void ActivityClick(BaseTask task, Image image) { if (task.IsActive) { task.CloseActivity(); image.Source = new BitmapImage(new Uri("/Resources/rec.png", UriKind.Relative)); NotificationHelper.Notify(NotificationType.TaskActivityStopped, task.Name); } else { task.StartActivity(); image.Source = new BitmapImage(new Uri("/Resources/recActive.png", UriKind.Relative)); NotificationHelper.Notify(NotificationType.TaskActivityStarted, task.Name); } using (IRepository <Task, long> repository = PersistentFactory.GetContext().GetRepository <Task, long>()) repository.Update(Task); }