private async Task RegistAttendee()
        {
            string message       = "参加を申込みますか?";
            var    confirmdialog = new MessageDialog(message);

            confirmdialog.Commands.Add(new UICommand("Yes"));
            confirmdialog.Commands.Add(new UICommand("No"));
            var result = await confirmdialog.ShowAsync();

            if (result.Label == "Yes")
            {
                try
                {
                    KumichoActivity selitem
                                  = (KumichoActivity)ActivityList.SelectedItem;
                    attendeeslist = await attendees
                                    .Where(attendee =>
                                           attendee.EventID == selitem.EventID &&
                                           attendee.TwitterID == user.UserId)
                                    .ToCollectionAsync();

                    if (attendeeslist.Count == 0)
                    {
                        ActivityAttendees newregister = new ActivityAttendees
                        {
                            EventID    = selitem.EventID,
                            TwitterID  = user.UserId,
                            FirstName  = FirstName.Text,
                            FamilyName = FamilyName.Text,
                            IsCanceled = false,
                            IsAttended = false
                        };
                        await attendees.InsertAsync(newregister);

                        selitem.ActualAttendees++;
                        await activityTable.UpdateAsync(selitem);

                        message
                            = string.Format("【{0}】への参加申込を受付けました。",
                                            selitem.Title);
                        //参加申込済リストを読み込み通知のタグを更新
                        await LoadRegistedActivity(user.UserId);

                        ClearRegisterForm();
                    }
                    else
                    {
                        message = "このイベントは参加申込済またはキャンセル済です。";
                        ClearRegisterForm();
                    }
                }
                catch
                {
                    message = "申込時にエラーが発生しました。時間をおいて再度申込してください。";
                }
                var dialog = new MessageDialog(message);
                dialog.Commands.Add(new UICommand("OK"));
                await dialog.ShowAsync();
            }
        }
        private async Task UpdateAttend(object sender)
        {
            CheckBox          cb     = (CheckBox)sender;
            ActivityAttendees attend = cb.DataContext as ActivityAttendees;
            await attendees.UpdateAsync(attend);

            cb.IsEnabled = false;
        }
        private async Task CancelRegistration()
        {
            var dialog = new MessageDialog("参加を取り消しますか?");

            dialog.Commands.Add(new UICommand("OK"));
            dialog.Commands.Add(new UICommand("Cancel"));
            var result = await dialog.ShowAsync();

            string message;

            if (result.Label == "OK")
            {
                try
                {
                    KumichoActivity selitem = ActivityList.SelectedItem as KumichoActivity;

                    attendeeslist = await attendees
                                    .Where(attendee => attendee.EventID == selitem.EventID && attendee.TwitterID == user.UserId)
                                    .ToCollectionAsync();

                    if (attendeeslist.Count != 0)
                    {
                        ActivityAttendees cancelregistration = attendeeslist[0];
                        cancelregistration.IsCanceled = true;
                        await attendees.UpdateAsync(cancelregistration);

                        selitem.ActualAttendees--;
                        await activityTable.UpdateAsync(selitem);

                        message = "参加を取り消しました。";
                    }
                    else
                    {
                        message = "キャンセルできませんでした。";
                    }
                }
                catch (Exception ex)
                {
                    message = "キャンセル時に問題が発生しました。時間をおいて再度実行してください。";
                }

                dialog = new MessageDialog(message);
                dialog.Commands.Add(new UICommand("OK"));
                await dialog.ShowAsync();
            }
            await RefreshActivities();
        }