Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Boolean numberValidator(int number)
- {
- Boolean exist = false;
- if (comboBox2.Items.Equals(number))
- {
- exist = true;
- }
- return exist;
- }
- public void processCall(int rNumber)
- {
- if (!numberValidator(rNumber))
- {
- p1.TextBox1.Clear();
- p1.TextBox1.Text = "Not connected";
- //MessageBox.Show(p2.returnPhoenStatus());
- }
- else
- {
- p1.TextBox1.Clear();
- p1.TextBox1.Text = "Call in progress";
- p2.receiveCall(1);
- p1.setStatus("Busy");
- /*
- if (p2.btnCallPressStatus())
- {
- p1.TextBox1.Clear();
- p1.TextBox1.Text = "Call initiated";
- }*/
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (comboBox1.SelectedIndex == 0)
- {
- p1.Show();
- comboBox2.Items.Add(1);
- p1.setStatus("A");
- }
- if (comboBox1.SelectedIndex == 1)
- {
- p2.Show();
- comboBox2.Items.Add(2);
- p2.setStatus("A");
- }
- }
- }
- }
- string status;
- public void setStatus(string Status)
- {
- status = Status;
- }
- public string returnStatus()
- {
- return status;
- }
- public void receiveCall(int callerNumber)
- {
- setStatus("Busy");
- btnCall.Text = "Answer";
- textBox1.Text = "Phone " + callerNumber + " Calling.";
- }
- public void makeCall(int number)
- {
- phone2 p2 = new phone2();
- network net = new network();
- MessageBox.Show(p2.returnStatus()); // this line not returing status of phone2
- if (p2.returnStatus() == "A")
- {
- net.processCall(number);
- }
- else
- {
- textBox1.Text = "Receiver Busy";
- }
- }
- public TextBox TextBox1
- {
- get
- {
- return textBox1;
- }
- }
- private void btnCall_Click(object sender, EventArgs e)
- {
- string number = textBox1.Text;
- int numberInt = Convert.ToInt16(number);
- makeCall(numberInt);
- }
- string phoneNo = "";
- private void btn2_Click(object sender, EventArgs e)
- {
- phoneNo = phoneNo + btn2.Text;
- textBox1.Text = phoneNo;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement