private void Answer_CLick(object sender, MouseButtonEventArgs e)
 {
     is_answer    = true;
     other_answer = (ForumAnswer)((Grid)sender).Tag;
     rtb_myanswer.AppendText(ver03.Properties.Settings.Default.NickName + ", ");
     Scroll.ScrollToEnd();
 }
        Grid GetAnswer(ForumAnswer x)
        {
            Grid gr = new Grid();

            TextBlock tb_context = new TextBlock();

            tb_context.FontSize     = 18;
            tb_context.Text         = x.context.Replace(Environment.NewLine, " ");
            tb_context.TextWrapping = TextWrapping.Wrap;
            //tb_context.Background = Brushes.LightGreen;
            tb_context.Margin = new Thickness(5, 5, 165, 5);

            StackPanel dop_stack = new StackPanel();

            dop_stack.VerticalAlignment = VerticalAlignment.Stretch;

            TextBlock tb_author = new TextBlock();

            tb_author.FontSize            = 18;
            tb_author.Text                = x.nick_author;
            tb_author.HorizontalAlignment = HorizontalAlignment.Right;
            //tb_author.Background = Brushes.Yellow;
            tb_author.Margin = new Thickness(0, 5, 5, 0);

            TextBlock tb_date = new TextBlock();

            tb_date.FontSize            = 18;
            tb_date.Text                = x.date_create;
            tb_date.HorizontalAlignment = HorizontalAlignment.Right;
            tb_date.VerticalAlignment   = VerticalAlignment.Bottom;
            tb_date.Margin              = new Thickness(0, 0, 5, 5);
            //tb_date.Background = Brushes.OrangeRed;

            dop_stack.Children.Add(tb_author);
            dop_stack.Children.Add(tb_date);


            gr.Style = (Style)gr.FindResource("answer_style00");
            gr.Children.Add(tb_context);
            gr.Children.Add(dop_stack);

            gr.Tag        = x;
            gr.MouseDown += Answer_CLick;
            return(gr);
        }
コード例 #3
0
        public bool CreateNoteFromForumAnswer(ForumAnswer x, int id_author, string context, string title)
        {
            string sql1 = "INSERT INTO noties (`id_author`, `id_adress`, `tittle`, `context`) VALUES ('" + id_author.ToString()
                          + "', '" + x.id_author.ToString() + "', '" + title + "', '" + context + "');";

            try
            {
                MySqlCommand myCommand = new MySqlCommand(sql1, conn);
                Open();
                myCommand.ExecuteNonQuery();
                Close();
                return(true);
            }
            catch
            {
                MessageBox.Show("Ошибка создания ответа на форуме");
                Close();
                return(false);
            }
        }
コード例 #4
0
 private List <string> GetLikedByWithoutUser(ForumAnswer answer, string userId)
 {
     return(answer.LikedBy
            .Where(uId => uId != userId)
            .ToList());
 }
コード例 #5
0
 private bool IsQuestionLikedByUser(ForumAnswer answer, string userId)
 {
     return(answer.LikedBy.Any(uId => uId == userId));
 }