private void Description_LostFocus(object sender, RoutedEventArgs e) { DependencyObject senderCast = (DependencyObject)sender; ListBoxItem selectedListBoxItem = FindParent <ListBoxItem>(senderCast); Task mTask = selectedListBoxItem.DataContext as Task; if (mTask != null) { System.Threading.Tasks.Task.Factory.StartNew(() => { try { if (selectedListBoxItem != null) { UpdateDescriptionTaskCommand ChangeTags = new UpdateDescriptionTaskCommand(this, mTask); ChangeTags.Execute(); } } catch (AggregateException error) { MessageBox.Show(error.Message); } }).Wait(); } }
public void ClientUpdateTaskDescriptionRequest(int RandomID, string NewDescription) { Console.WriteLine("Received request to: Update Description " + RandomID + "to: " + NewDescription); User mUser = FindUser(Context.ConnectionId); if (mUser.Tasks.Count == 0) { EmptyListBroadcast(); return; } UpdateDescriptionTaskCommand mUpdateTaskDescription = new UpdateDescriptionTaskCommand(mUser, RandomID, NewDescription); mUpdateTaskDescription.Execute(); Clients.Clients(mUser.ConnectionIDs).UpdateTask(RandomID, NewDescription, 2); }