private async Task <bool> FinishEvaluationAsync(MeetingListItemViewModel item)
        {
            try
            {
                var meeting = item.GetValue <Meeting>();
                meeting.Status = MeetingStatus.Closed;

                var source = new CancellationTokenSource();
                return(await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.Update(meeting), source));
            }
            catch (AggregateException) { return(false); }
            catch (TaskCanceledException) { return(false); }
        }
        private async Task DeleteAsync(MeetingListItemViewModel item)
        {
            try
            {
                var meeting = item.GetValue <Meeting>();

                var source  = new CancellationTokenSource();
                var success = await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.Delete(meeting), source);

                if (success)
                {
                    ListItems.Remove(item);
                    UserDialogs.Instance.Toast("削除しました");
                }
            }
            catch (AggregateException) { return; }
            catch (TaskCanceledException) { return; }
        }
        private MeetingListItemViewModel CreateListItem(Meeting m)
        {
            var isOwner = m.CreatedBy == Settings.LoginUser?.Id;

            var item = new MeetingListItemViewModel
            {
                Text       = m.Name,
                DetailText = $"発話権: {m.Tickets}枚 ({m.Seconds}秒/枚), 振興券: {m.Coupons}枚",
                Selectable = true,
                Image      =
                    m.Status == MeetingStatus.Waiting ? "meeting_blue" :
                    m.Status == MeetingStatus.InMeeting ? "meeting_red" :
                    m.Status == MeetingStatus.Evaluating ? "meeting_yellow" :
                    m.Status == MeetingStatus.Closed ? "meeting_grey" : "",
                SmallIcon =
                    m.Status == MeetingStatus.Evaluating ? "ic_lead_pencil_black_24dp" :
                    m.Status == MeetingStatus.Closed ? "ic_trophy_variant_black_24dp" : null,
                Value = m,
            };

            switch (m.Status)
            {
            case MeetingStatus.Waiting:
                item.OnAction = () =>
                {
                    var config = new ActionSheetConfig();
                    config.Add("参加する", async() =>
                    {
                        if (await EnterAsync(m.Id, Settings.LoginUser.Id, true))
                        {
                            await NavigationService.Navigate(typeof(EventViewModel), m);
                        }
                    });
                    config.Add("立ち見する", async() =>
                    {
                        await EnterAsync(m.Id, Settings.LoginUser.Id, false);
                        await NavigationService.Navigate(typeof(EventViewModel), m);
                    });

                    if (isOwner)
                    {
                        config.SetDestructive("削除", async() => await DeleteAsync(item));
                    }

                    config.SetCancel();
                    UserDialogs.Instance.ActionSheet(config);
                };
                break;

            case MeetingStatus.InMeeting:
                item.OnAction = async() =>
                {
                    await NavigationService.Navigate(typeof(EventViewModel), m);
                };
                break;

            case MeetingStatus.Evaluating:
                item.OnAction = async() =>
                {
                    var config = new ActionSheetConfig();

                    var source    = new CancellationTokenSource();
                    var evaluated = await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.IsEvaluated(m.Id, Settings.LoginUser.Id), source);

                    if (!evaluated)
                    {
                        config.Add("評価する", async() =>
                        {
                            var result = await NavigationService.Navigate <RatingsViewModel, RatingParameter, RatingResult>(new RatingParameter()
                            {
                                MeetingId = m.Id, CurrentEvaluationItem = EvaluationItem.Clear
                            });
                            if (result != null)
                            {
                                await this.ClosePicker(() => { }, false);
                            }
                        });
                    }
                    else
                    {
                        config.Add("評価済み");
                    }

                    if (isOwner)
                    {
                        config.Add("評価終了", async() =>
                        {
                            if (await FinishEvaluationAsync(item))
                            {
                                item.Image     = "meeting_grey";
                                item.SmallIcon = "ic_trophy_variant_black_24dp";
                                item.OnAction  = async() => await NavigationService.Navigate(typeof(MeetingResultTabRootViewModel), m);;

                                await NavigationService.Navigate(typeof(MeetingResultTabRootViewModel), m);;
                            }
                        });
                    }
                    config.SetCancel();
                    UserDialogs.Instance.ActionSheet(config);
                };
                break;

            case MeetingStatus.Closed:
                item.OnAction = async() =>
                {
                    await NavigationService.Navigate(typeof(MeetingResultTabRootViewModel), m);
                };
                break;

            default:
                break;
            }

            return(item);
        }