Exemple #1
0
        /// <summary>
        /// 运行时预加载项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form_Main_Load(object sender, EventArgs e)
        {
            serverIP = IPAddress.Parse(Registry.ReadKey4Registry("PublishClient", "ServerIP"));
            uid = Registry.ReadKey4Registry("PublishClient", "CurrentUserID");
            idNumeric = int.Parse(uid);
            uid = idNumeric.ToString("D6");
            uac = Registry.ReadKey4Registry("PublishClient", "CurrentUserAccount");
            ucl = Registry.ReadKey4Registry("PublishClient", "CurrentUserName");
            upw = Registry.ReadKey4Registry("PublishClient", "CurrentUserPW");
            
            // 设置窗口属性
            this.Text = "教材补助经费评估软件 [" + ucl + "]" + " [#" + uid + "]";
            this.label_ClientName.Text = "[#" + uid + "] " + ucl;
            
            // 准备 TCP 监听
            tcpServerGet = new TcpListenerP(new IPEndPoint(IPAddress.Any, Port.TCP_BOOK_INFORMATION_PORT));
            tcpServerGet.OnThreadTaskRequest += new TcpListenerP.ThreadTaskRequest(OnListenBookInfo);
            

            // 准备数据集
            BookList = new BookInformationList();
            BookEval = new BookEvaluaionList();

            // 初始化列表显示
            ResetListView_Books();
        }
Exemple #2
0
 /// <summary>
 /// 运行时预加载项
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Form_Login_Load(object sender, EventArgs e)
 {
     isLogin = false;
     isCatch = false;
     serverIP = IPAddress.Parse(Registry.ReadKey4Registry("PublishClient", "ServerIP"));
     tcpClientLogin = new TcpClientP();
     tcpClientLogin.Connect(serverIP, Port.TCP_LOGIN_PORT);
     string lastUser = Registry.ReadKey4Registry("PublishClient", "LastUser");
     if (lastUser != null)
         this.textBox_UesrAccount.Text = lastUser;
     tcpListenerUser = new TcpListenerP(new IPEndPoint(IPAddress.Any, Port.TCP_USER_FILE_PORT));
     tcpListenerUser.OnThreadTaskRequest += new TcpListenerP.ThreadTaskRequest(OnRecvData);
 }
Exemple #3
0
        private void Form_Main_Load(object sender, EventArgs e)
        {
            __tmp__ = new NotStatic();
            onlineUsers = new ClientTable();
            // 加载用户列表
            rtUserPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "uesrs.bin";
            FileInfo fi = new FileInfo(rtUserPath);
            if (fi.Exists)
                LoadUsersData(rtUserPath);
            else
            {
                FileStream fs = fi.Create(); fs.Close();
                users = new UserSet();
                SaveUsersData(rtUserPath);
            }

            // 调整窗口属性
            uid = Registry.ReadKey4Registry("PublishServer", "CurrentUserID");
            int idNumeric = int.Parse(uid);
            uid = idNumeric.ToString("D6");
            uac = Registry.ReadKey4Registry("PublishServer", "CurrentUserAccount");
            ucl = Registry.ReadKey4Registry("PublishServer", "CurrentUserName");
            this.Text = "教材补助经费评估软件 [" + ucl + "]" + " [#" + uid + "]";

            // 开始 UDP 广播
            backgroundServer = new UDPMessage();
            Thread udpThread = new Thread(
                () => {
                    backgroundServer.OnBroadcast(
                        threadID: 9999,
                        port: Port.DEFAULT_BROADCAST_PORT,
                        ver: VerMessage.PUBLIC_VERIFICATION
                    );
                }
            );
            udpThread.IsBackground = true;
            udpThread.Start();

            // 初始化用户个人信息
            this.label_AdminTitle.Text += "[#" + uid + "]";
            this.label_AdminName.Text = ucl;

            // 所有 TCP 监听端口就绪
            tcpServerLogin = new TcpListenerP(new IPEndPoint(IPAddress.Any, Port.TCP_LOGIN_PORT));
            tcpServerLogin.OnThreadTaskRequest += new TcpListenerP.ThreadTaskRequest(OnListenClient);
            tcpServerBookEvau = new TcpListenerP(new IPEndPoint(IPAddress.Any, Port.TCP_BOOK_EVALUATION_PORT));
            tcpServerBookEvau.OnThreadTaskRequest += new TcpListenerP.ThreadTaskRequest(OnListenBookEvau);

            // 所有 TCP 客户端使用前初始化
            // tcpClientUserFile = new TcpClientP();

            // 初始化教材列表
            BookList = new BookDetailList();
            BookEval = new BookEvaluaionList();

            // 初始化列表显示
            ResetListView_Books();
            ResetListView_Users();
            

        }