Exemplo n.º 1
0
        public void ClientMarkTaskRequest(int RandomID, bool IsChecked)
        {
            Console.WriteLine("Received request to: Mark Task " + RandomID + " as:" + IsChecked.ToString());
            User mUser = FindUser(Context.ConnectionId);

            if (mUser.Tasks.Count == 0)
            {
                EmptyListBroadcast();
                return;
            }

            MarkTaskCommand mMarkTask = new MarkTaskCommand(mUser, RandomID, IsChecked);

            mMarkTask.Execute();

            Clients.Clients(mUser.ConnectionIDs).UpdateTask(RandomID, IsChecked, 3);
        }
Exemplo n.º 2
0
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            DependencyObject senderCast          = (DependencyObject)sender;
            ListBoxItem      selectedListBoxItem = FindParent <ListBoxItem>(senderCast);
            Task             mTask = (Task)selectedListBoxItem.DataContext;

            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    if (selectedListBoxItem != null)
                    {
                        MarkTaskCommand ChangeTags = new MarkTaskCommand(this, mTask);
                        ChangeTags.Execute();
                    }
                }
                catch (AggregateException error)
                {
                    MessageBox.Show(error.Message);
                }
            }).Wait();
        }