コード例 #1
0
ファイル: Form_SendTo.cs プロジェクト: cfrpg/Publish
 public Form_SendTo(List<BookInformation> _books, ClientTable _players)
 {
     InitializeComponent();
     books = _books;
     players = _players;
     OnDispaly();
 }
コード例 #2
0
 public Form_SendTo(List <BookInformation> _books, ClientTable _players)
 {
     InitializeComponent();
     books   = _books;
     players = _players;
     OnDispaly();
 }
コード例 #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();
        }
コード例 #4
0
ファイル: Form_Main.cs プロジェクト: cfrpg/Publish
        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();
            

        }