private void OnEvent(TalkData.Cell cell) { Debug.Log("TalkView", "On Event cell"); Device.BeginInvokeOnMainThread(() => { AddCell(cell); MoveToLast(true); }); }
/// <summary> /// トークセルをビューに追加します。 /// </summary> public View AddCell(TalkData.Cell cell) { DateTime date = DateTime.Parse(cell.Time); if (date.Day != day) { day = date.Day; Stack_Main.Children.Add(GetViewDate(date.ToString("M/d"))); } StackLayout stk = new StackLayout(); stk.Orientation = StackOrientation.Vertical; stk.Margin = 5; stk.MinimumWidthRequest = 100; Label label = new Label() { Margin = new Thickness(5, 2), Text = cell.Message, LineBreakMode = LineBreakMode.CharacterWrap }; if (!cell.IsMe) { stk.HorizontalOptions = LayoutOptions.Start; stk.BackgroundColor = Color.SkyBlue; } else { stk.HorizontalOptions = LayoutOptions.End; stk.BackgroundColor = Color.Pink; } stk.Children.Add(label); stk.Children.Add(new Label() { Margin = new Thickness(5, 2), FontSize = 11, TextColor = Color.Gray, Text = date.ToString("HH:mm"), HorizontalOptions = LayoutOptions.End }); Stack_Main.Children.Add(stk); return(label); }
private void OnEvent(TalkData.Cell cell) { Debug.Log("TalkView", "On Event cell"); Device.BeginInvokeOnMainThread(() => Refresh()); }