示例#1
0
 public FormClient(Networkconnect network, bool isPhysician, string username)
 {
     InitializeComponent();
     network.SetParent(this);
     this.isPhysician = isPhysician;
     this.network     = network;
     this.username    = username;
     if (!isPhysician) //Client:
     {
         currentUser = network.getUser(username);
         pwrTxtBox.Hide();
         distanceTxtBox.Hide();
         timeTxtBox.Hide();
         label5.Hide();
         label6.Hide();
         label7.Hide();
         sendButton.Hide();
         broadCastButton.Hide();
         connectedUsers.Hide();
         newClient.Hide();
         dropDownTest.HideDropDown();
         bikeImprovementToolStripMenuItem.HideDropDown();
     }
     else //Specialist:
     {
         BComConnect.Hide();
         resetButton.Hide();
         //Getting all connected users:
         users = network.GetAllConnectedUsers(username);
         if (users != null)
         {
             if (users.Count > 0)
             {
                 currentUser = users.First();
             }
             FillUserComboBox();
         }
         Thread physicianThread = new Thread(new ThreadStart(ResfreshThreadPhysician));
         physicianThread.IsBackground = true;
         physicianThread.Start();
     }
 }
示例#2
0
        public FormClient(Networkconnect network, bool isPhysician, string username)
        {
            InitializeComponent();

            timer1.Interval = 1000;
            timer1.Elapsed += new ElapsedEventHandler(timer1_Tick);

            network.SetParent(this);
            this.isPhysician = isPhysician;
            this.network = network;
            this.username = username;
            if(!isPhysician) //Client:
            {
                currentUser = network.getUser(username);
                pwrTxtBox.Hide();
                distanceTxtBox.Hide();
                timeTxtBox.Hide();
                label5.Hide();
                label6.Hide();
                label7.Hide();
                sendButton.Hide();
                broadCastButton.Hide();
                connectedUsers.Hide();
                newClient.Hide();
            }
            else //Specialist:
            {
                BComConnect.Hide();
                resetButton.Hide();
                //Getting all connected users:
                users = network.GetAllConnectedUsers(username);
                if (users != null)
                {
                    if (users.Count > 0)
                            currentUser = users.First();
                    FillUserComboBox();
                }
                Thread physicianThread = new Thread(new ThreadStart(ResfreshThreadPhysician));
                physicianThread.IsBackground = true;
                physicianThread.Start();
            }
        }