Esempio n. 1
0
        /*****************************    主函数                 *************************/
        public MainWindow()
        {
            InitializeComponent();

            //创建一个线程运行客户端接收数据
            thread = new Thread(new ThreadStart(ClientCS.GetInstance().readData));

            //启动线程
            thread.Start();

            //将配置文件中的信息加载进来
            readConfig = new ReadConfig();

            for (int i = 0; i < readConfig.dataUser.Count; i++)
            {
                ComboBoxItem item = new ComboBoxItem();

                item.Content = readConfig.dataUser[i].userName;

                userNameComboBox.Items.Add(item);
            }

            userNameComboBox.SelectedIndex = 0;

            if (readConfig.dataUser.Count != 0)
            {
                passWordBox.Password = readConfig.dataUser[0].passWord;
            }
        }
Esempio n. 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ClientNode client = new ClientNode();

            ReadConfig rd = new ReadConfig();

            client = rd.ReadHostConfig();

            Form1 form1 = new Form1(client);

            form1.Text = client.name;
            form1.hostsIp(client.hostsIP);
            Task.Run(() => client.start(form1));

            Application.Run(form1);
        }