public void addToList(UIMessage m) { Next(m); if (m.isUserMessage) { m.Position = new Point(10, messageCoordinatesCounter); } else { m.Position = new Point(mainParent.Width - 160, messageCoordinatesCounter); } mainParent.Height = messageCoordinatesCounter; }
public void Next(UIMessage m) { messageCoordinatesCounter += m.Size.Height + 10; }
private void Window_Loaded(object sender, RoutedEventArgs e) { //TimerCallback tm = new TimerCallback(drawLoading); // создаем таймер //Timer timer = new Timer(drawLoading, null, 0, Int32.MaxValue); Aero.AutoApply(this); var sAnim = Animations.logChangeSize; sAnim.To = 1000; this.Width = 0; this.BeginAnimation(Window.WidthProperty, sAnim); this.BeginAnimation(Window.OpacityProperty, Animations.sFadeinAnimation); UIMessage mtest1 = new UIMessage(AnswerGrid.Width - 160, 160, false); mainGrid.Children.Add(mtest1.Self); Grid.SetRow(mtest1.Self, 0); Grid.SetColumn(mtest1.Self, 0); mtest1.setText("Помню\r\nНе зря\r\nПятый день ноября\r\nИ заговор\r\nПороховой\r\n since \r\n 1487\r\n 487\r\n 87\r\n 7"); UIMessage mtest2 = new UIMessage(AnswerGrid.Width - 160, 160, true); mainGrid.Children.Add(mtest2.Self); Grid.SetRow(mtest2.Self, 0); Grid.SetColumn(mtest2.Self, 0); mtest2.setText("3141\r\n5926\r\n3318\r\n1930\r\n5893\r\n3223"); UIMessage mtest3 = new UIMessage(AnswerGrid.Width - 160, 160, false); mainGrid.Children.Add(mtest3.Self); Grid.SetRow(mtest3.Self, 0); Grid.SetColumn(mtest3.Self, 0); mtest3.setText("3141\r\n5926\r\n3318\r\n1930\r\n5893\r\n3223"); mPositioner p = new mPositioner(mainGrid); p.addToList(mtest1); p.addToList(mtest2); p.addToList(mtest3); mainGrid.Height = p.messageCoordinatesCounter; /* * UIMessage mtest = new UIMessage(); * mainGrid.Children.Add(mtest.Make(AnswerGrid.Width-160, 160)); * Grid.SetRow(mtest.Self, 0); * Grid.SetColumn(mtest.Self, 0); * mtest.setText("3141\r\n5926\r\n3318\r\n1930\r\n5893\r\n3223"); * * UIMessage mtest2 = new UIMessage(); * mainGrid.Children.Add(mtest2.Make(AnswerGrid.Width - 160, AnswerGrid.ActualHeight)); * Grid.SetRow(mtest2.Self, 0); * Grid.SetColumn(mtest2.Self, 0); * mtest2.setText("answernumber2\r\n fuckitfuckifuckitfuckitfuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit"); * * UIMessage mtest3 = new UIMessage(); * mainGrid.Children.Add(mtest3.Make(AnswerGrid.Width - 160, AnswerGrid.ActualHeight+400)); * Grid.SetRow(mtest3.Self, 0); * Grid.SetColumn(mtest3.Self, 0); * mtest3.setText("answernumber3\r\n fuckitfuckifuckitfuckitfuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit\r\n fuckit"); * mainGrid.Height = 1500; */ }