示例#1
0
        private async Task CreateListItems()
        {
            try
            {
                var source  = new CancellationTokenSource();
                var results = await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.GetResults(_meeting.Id), source);

                if (results == null)
                {
                    return;
                }

                foreach (var e in Enum.GetValues(typeof(EvaluationItem)))
                {
                    var score = results.SingleOrDefault(x => x.EvaluationItem == (Data.EvaluationItem)e).Score;
                    var item  = new ListItemViewModel
                    {
                        Text       = e.ToString(),
                        DetailText = (score == null) ? "評価結果はありません" : $"{((double)score).ToString("0.0")} 点",
                        Image      = $"evaluation_{e.ToString().ToLower()}",
                        Selectable = false,
                    };
                    ListItems.Add(item);
                }
            }
            catch (AggregateException) { return; }
            catch (TaskCanceledException) { return; }
        }
        private async Task CreateListItems()
        {
            try
            {
                var source = new CancellationTokenSource();
                var awards = await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.GetAwards(_meeting.Id), source);

                if (awards == null)
                {
                    return;
                }

                foreach (var e in Enum.GetValues(typeof(EvaluationItem)))
                {
                    var header = new MeetingAwardListItemViewModel()
                    {
                        HeaderText  = $"{e.ToString()}賞",
                        HeaderImage = $"evaluation_{e.ToString().ToLower()}",
                        Selectable  = false,
                        IsSection   = true,
                    };

                    var award = awards.SingleOrDefault(x => x.EvaluationItem == (Data.EvaluationItem)e);
                    if (award != null && award.Users.Any())
                    {
                        foreach (var user in award.Users)
                        {
                            var item = new ListItemViewModel
                            {
                                Text       = $"{user.User.Name}",
                                DetailText = $"{((double)user.Score).ToString("0.0")} 点",
                                Image      = user.User.IconUrl(),
                                Selectable = false,
                            };
                            header.SubItems.Add(item);
                        }
                    }
                    else
                    {
                        var item = new ListItemViewModel
                        {
                            Text       = "",
                            DetailText = "評価結果はありません",
                            Image      = null,
                            Selectable = false,
                        };
                        header.SubItems.Add(item);
                    }
                    ListItems.Add(header);
                }
            }
            catch (AggregateException) { return; }
            catch (TaskCanceledException) { return; }
        }
示例#3
0
        private async Task CreateListItemsAsync()
        {
            try
            {
                var source = new CancellationTokenSource();
                var users  = await UserDialogs.Instance.LoadingDelayedAsync(_userHub.GetUsers(), source);

                if (users == null)
                {
                    return;
                }

                foreach (var user in users)
                {
                    var item = new ListItemViewModel
                    {
                        Text       = user.Name,
                        Selectable = true,
                        Image      = user.IconUrl(),
                    };
                    item.OnAction = async() =>
                    {
                        await NavigationService.Navigate(typeof(UserResultViewModel), user);
                    };
                    ListItems.Add(item);
                }
            }
            catch (AggregateException) { return; }
            catch (TaskCanceledException) { return; }

            //for (int i = 0; i < 10; i++)
            //{
            //    var item = new ListItemViewModel
            //    {
            //        Text = $"Yamada Taro_{i}",
            //        Selectable = true,
            //        Image = "10215340156958472",
            //    };

            //    item.OnAction = async () =>
            //    {
            //        await NavigationService.Navigate<UserResultViewModel>();
            //    };

            //    ListItems.Add(item);
            //}
        }
        private async Task CreateListItemsAsync()
        {
            var header = new ListItemViewModel()
            {
                Text       = $"{_parameter.CurrentEvaluationItem.ToString()}",
                Image      = $"evaluation_{_parameter.CurrentEvaluationItem.ToString().ToLower()}",
                Selectable = false,
                IsSection  = true,
            };

            if (_parameter.Participants == null)
            {
                try
                {
                    _parameter.Participants = new List <User>();
                    var source       = new CancellationTokenSource();
                    var participants = await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.GetParticipants(_parameter.MeetingId), source);

                    _parameter.Participants.AddRange(participants);
                }
                catch (AggregateException) { return; }
                catch (TaskCanceledException) { return; }
            }

            foreach (var member in _parameter.Participants)
            {
                var item = new RatingListItemViewModel
                {
                    MemberId   = member.Id,
                    Text       = member.Name,
                    Image      = member.IconUrl(),
                    Rating     = 0,
                    Selectable = false,
                };
                header.SubItems.Add(item);
            }
            ListItems.Add(header);
        }
示例#5
0
        private void CreateListItems()
        {
            {
                var item = new ListItemViewModel
                {
                    Text       = "会議名",
                    DetailText = _meeting.Name,
                    Selectable = true,
                };
                item.OnAction = async() =>
                {
                    var config = new PromptConfig
                    {
                        Message       = item.Text,
                        Text          = _meeting.Name,
                        OnTextChanged = r => r.IsValid = !string.IsNullOrWhiteSpace(r.Value) && _meeting.Name != r.Value,
                    };
                    var result = await UserDialogs.Instance.PromptAsync(config);

                    if (!result.Ok)
                    {
                        return;             // cancel
                    }
                    // update
                    _meeting.Name   = result.Text;
                    item.DetailText = _meeting.Name;
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "発話券/人",
                    DetailText = $"{_meeting.Tickets} 枚",
                };
                item.OnAction = async() =>
                {
                    var config = new PromptConfig
                    {
                        Message       = item.Text,
                        Text          = _meeting.Tickets.ToString(),
                        InputType     = InputType.Number,
                        OnTextChanged = r => r.IsValid = byte.TryParse(r.Value, out var value) && value > 0 && _meeting.Tickets != value,
                    };
                    var result = await UserDialogs.Instance.PromptAsync(config);

                    if (!result.Ok)
                    {
                        return;             // cancel
                    }
                    // update
                    _meeting.Tickets = int.Parse(result.Text);
                    item.DetailText  = $"{_meeting.Tickets} 枚";
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "時間/枚",
                    DetailText = $"{_meeting.Seconds} 秒",
                };
                item.OnAction = async() =>
                {
                    var config = new PromptConfig
                    {
                        Message       = item.Text,
                        Text          = _meeting.Seconds.ToString(),
                        InputType     = InputType.Number,
                        OnTextChanged = r => r.IsValid = ushort.TryParse(r.Value, out var value) && value > 0 && _meeting.Seconds != value,
                    };
                    var result = await UserDialogs.Instance.PromptAsync(config);

                    if (!result.Ok)
                    {
                        return;             // cancel
                    }
                    // update
                    _meeting.Seconds = int.Parse(result.Text);
                    item.DetailText  = $"{_meeting.Seconds} 秒";
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "発話振興券/人",
                    DetailText = $"{_meeting.Coupons} 枚",
                };
                item.OnAction = async() =>
                {
                    var config = new PromptConfig
                    {
                        Message       = item.Text,
                        Text          = _meeting.Coupons.ToString(),
                        InputType     = InputType.Number,
                        OnTextChanged = r => r.IsValid = byte.TryParse(r.Value, out var value) && _meeting.Coupons != value,
                    };
                    var result = await UserDialogs.Instance.PromptAsync(config);

                    if (!result.Ok)
                    {
                        return;             // cancel
                    }
                    // update
                    _meeting.Coupons = int.Parse(result.Text);
                    item.DetailText  = $"{_meeting.Coupons} 枚";
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "ルーレット開始までの時間",
                    DetailText = $"{_meeting.IdleSeconds} 秒",
                };
                item.OnAction = async() =>
                {
                    var config = new PromptConfig
                    {
                        Message       = item.Text,
                        Text          = _meeting.IdleSeconds.ToString(),
                        InputType     = InputType.Number,
                        OnTextChanged = r => r.IsValid = ushort.TryParse(r.Value, out var value) && value > 0 && _meeting.IdleSeconds != value,
                    };
                    var result = await UserDialogs.Instance.PromptAsync(config);

                    if (!result.Ok)
                    {
                        return;             // cancel
                    }
                    // update
                    _meeting.IdleSeconds = int.Parse(result.Text);
                    item.DetailText      = $"{_meeting.IdleSeconds} 秒";
                };
                ListItems.Add(item);
            }
        }
示例#6
0
        private void CreateListItems()
        {
            {
                var user = Settings.LoginUser;
                var item = new ListItemViewModel
                {
                    Text       = user.Name,
                    Selectable = true,
                    Image      = user.IconUrl(),
                };
                item.OnAction = async() =>
                {
                    await NavigationService.Navigate(typeof(UserResultViewModel), user);
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "会議一覧",
                    Selectable = true,
                    Image      = "res:ic_forum_grey600_24dp",
                };
                item.OnAction = async() =>
                {
                    await NavigationService.Navigate <MeetingsViewModel>();
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "アカウント一覧",
                    Selectable = true,
                    Image      = "res:ic_account_grey600_24dp",
                };
                item.OnAction = async() =>
                {
                    await NavigationService.Navigate <UsersViewModel>();
                };
                ListItems.Add(item);
            }
            {
                var item = new ListItemViewModel
                {
                    Text       = "Main(debug)",
                    Selectable = true,
                };
                item.OnAction = async() =>
                {
                    await NavigationService.Navigate <EventViewModel, Meeting>(new Meeting());
                };
                ListItems.Add(item);
            }
            {
                var r    = new Random();
                var item = new ListItemViewModel
                {
                    Text       = "Dialog(debug)",
                    Selectable = true,
                };
                item.OnAction = async() =>
                {
                    var names = new[] {
                        "本村 翔平",
                        "熊田 栄治",
                        "大河内 和広",
                        "佐田 真",
                        "勝見 裕貴",
                        "蝦名 樹",
                        "田浦 文昭",
                        "樋野 辰哉",
                        "土師 勝広",
                        "相本 義貴",
                        "蘆田 弘毅",
                        "島谷 俊久",
                        "藍川 憲之",
                        "中富 洋三",
                        "勝連 はじめ",
                        "芳本 洋二郎",
                        "溝畑 邦生",
                        "比良 春男",
                        "梅北 直裕",
                        "兼久 恭佑",
                        "柏岡 修弘",
                        "武貞 芳孝",
                        "連 貢一",
                        "楠谷 秀直",
                        "米須 高博",
                        "賀茂 まさと",
                        "野垣 知希",
                        "四辻 金太郎",
                        "入木田 太平",
                        "新実 禎久"
                    };

                    var list = new List <Data.EventUser>();
                    for (int i = 0; i < 10; i++)
                    {
                        var user = new Data.EventUser
                        {
                            GuestId = new Guid($"9546482E-887A-4CAB-A403-AD9C326FFDA{i.ToString("X")}"),
                            Name    = names[i],
                        };
                        list.Add(user);
                    }

                    var options = new RouletteOptions
                    {
                        Users          = list,
                        SelectedUserId = r.Next(0, list.Count),
                    };

                    await NavigationService.Navigate(typeof(RouletteViewModel), options);
                };
                ListItems.Add(item);
            }
            //{
            //    var item = new ListItemViewModel
            //    {
            //        Text = "個人評価結果(debug)",
            //        Selectable = true,
            //    };
            //    item.OnAction = async () =>
            //    {
            //        await NavigationService.Navigate<UserResultViewModel>();
            //    };
            //    ListItems.Add(item);
            //}
            //{
            //    var item = new ListItemViewModel
            //    {
            //        Text = "会議評価結果(debug)",
            //        Selectable = true,
            //    };
            //    item.OnAction = async () =>
            //    {
            //        await NavigationService.Navigate<MeetingResultTabRootViewModel>();
            //    };
            //    ListItems.Add(item);
            //}
        }