newOnlineQA/Windows/QuestionDetails.xaml.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using newOnlineQA.Control;
using OnlineQA;
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace newOnlineQA.Windows
{
    /// <summary>
    /// QuestionDetails.xaml 的交互逻辑
    /// </summary>
    public partial class QuestionDetails : Window
    {
        private int qid = 0;

        public QuestionDetails(int _qid)
        {
            InitializeComponent();
            this.MouseDown += (sender, e) =>
            {
                //允许拖动
                if (e.LeftButton == MouseButtonState.Pressed)
                    this.DragMove();
            };
            qid = _qid;
            GetReplyList(qid);
        }

        void GetReplyList(int qid)
        {
            string sql = "select rid,avatar,name,title,reply.contents from users,reply,question where users.uid = reply.uid and question.qid = reply.qid and reply.delete_date is null and reply.qid = @qid";
            SqlParameter para = new SqlParameter("@qid", qid);
            DataTable dataTable = SqlHelper.GetDataTable(sql,para);
            //处理头像显示
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                dataTable.Rows[i]["avatar"] = Directory.GetCurrentDirectory() + "\\Avatar\\" + dataTable.Rows[i]["avatar"];
            }
            this.listBox.ItemsSource = dataTable.DefaultView;
        }

        private void BtnCloseClick(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        private void BtnMinClick(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        private void BtnLikeClick(object sender, RoutedEventArgs e)
        {
            listBox.SelectedItem = ((Button)sender).DataContext;
            if (GlobalData.Uid == -1)
            {
                MessageBoxX.Show("提示", "请先登录");
后面还有 145 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。