Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. public Boolean numberValidator(int number)
  2. {
  3.  
  4. Boolean exist = false;
  5. if (comboBox2.Items.Equals(number))
  6. {
  7. exist = true;
  8. }
  9.  
  10. return exist;
  11. }
  12.  
  13. public void processCall(int rNumber)
  14.  
  15. {
  16.  
  17. if (!numberValidator(rNumber))
  18. {
  19. p1.TextBox1.Clear();
  20. p1.TextBox1.Text = "Not connected";
  21.  
  22. //MessageBox.Show(p2.returnPhoenStatus());
  23. }
  24.  
  25. else
  26. {
  27.  
  28. p1.TextBox1.Clear();
  29.  
  30. p1.TextBox1.Text = "Call in progress";
  31.  
  32. p2.receiveCall(1);
  33.  
  34. p1.setStatus("Busy");
  35. /*
  36. if (p2.btnCallPressStatus())
  37. {
  38. p1.TextBox1.Clear();
  39.  
  40. p1.TextBox1.Text = "Call initiated";
  41. }*/
  42.  
  43. }
  44.  
  45.  
  46. }
  47.  
  48.  
  49. private void button1_Click(object sender, EventArgs e)
  50. {
  51. if (comboBox1.SelectedIndex == 0)
  52. {
  53. p1.Show();
  54. comboBox2.Items.Add(1);
  55. p1.setStatus("A");
  56. }
  57. if (comboBox1.SelectedIndex == 1)
  58. {
  59. p2.Show();
  60. comboBox2.Items.Add(2);
  61. p2.setStatus("A");
  62. }
  63. }
  64. }
  65.  
  66. }
  67.  
  68.  
  69.  
  70.  
  71. string status;
  72.  
  73. public void setStatus(string Status)
  74. {
  75. status = Status;
  76. }
  77.  
  78. public string returnStatus()
  79. {
  80. return status;
  81. }
  82.  
  83. public void receiveCall(int callerNumber)
  84. {
  85. setStatus("Busy");
  86.  
  87. btnCall.Text = "Answer";
  88.  
  89. textBox1.Text = "Phone " + callerNumber + " Calling.";
  90.  
  91. }
  92.  
  93. public void makeCall(int number)
  94. {
  95. phone2 p2 = new phone2();
  96. network net = new network();
  97.  
  98. MessageBox.Show(p2.returnStatus()); // this line not returing status of phone2
  99. if (p2.returnStatus() == "A")
  100. {
  101. net.processCall(number);
  102. }
  103. else
  104. {
  105. textBox1.Text = "Receiver Busy";
  106. }
  107.  
  108.  
  109. }
  110.  
  111. public TextBox TextBox1
  112. {
  113. get
  114. {
  115. return textBox1;
  116. }
  117. }
  118.  
  119. private void btnCall_Click(object sender, EventArgs e)
  120. {
  121. string number = textBox1.Text;
  122. int numberInt = Convert.ToInt16(number);
  123.  
  124.  
  125. makeCall(numberInt);
  126. }
  127.  
  128. string phoneNo = "";
  129. private void btn2_Click(object sender, EventArgs e)
  130. {
  131. phoneNo = phoneNo + btn2.Text;
  132.  
  133. textBox1.Text = phoneNo;
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement