Пример #1
0
        private void processFoundComputer(string computerName, int index)
        {
            //aggiungo il server alla lista dei server disponibili
            //costruisco server Entity
            ServerEntity se = new ServerEntity(computerName);

            se.setId(index);
            this.serverManger.availableServers.Add(se);


            this.lvComputers.Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
            {
                Label l = new Label {
                    Content = computerName
                };
                layout.setComputerNameLabelLayout(l);

                //create textbox for password
                TextBox tbPwd = new TextBox()
                {
                    Name = "k" + index
                };                                                    //t for the passwords
                tbPwd.TextChanged += tbPassword_Changed;
                layout.setPasswordTextBoxLayout(tbPwd);

                //create port field
                TextBox tbPort = new TextBox()
                {
                    Name = "p" + index
                };                                                     //p for the ports
                tbPort.TextChanged += tbPort_Changed;
                layout.setPortTextBoxLayout(tbPort);

                //create button checkin button
                String cbname = "cb" + index;
                CheckBox cbox = new CheckBox {
                    Name = cbname
                };
                cbox.Checked   += checkbox_Checked; //ADD EVENT
                cbox.Unchecked += checkbox_Unchecked;
                layout.setCheckBoxLayout(cbox);
                //add elements to the window
                this.lvComputers.Items.Add(new MyListViewItem(l, tbPwd, tbPort, cbox));
            }));
        }