InviteForm.cs
Upload User: jinwengen
Upload Date: 2014-06-07
Package Size: 3653k
Code Size: 4k
Category:

CSharp

Development Platform:

Others

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using DCBusiness;
  7. using DCFacade;
  8. namespace DCWinUI
  9. {
  10. /// <summary>
  11. /// Summary description for InviteForm.
  12. /// </summary>
  13. public class InviteForm : System.Windows.Forms.Form
  14. {
  15. private System.Windows.Forms.Button btnYes;
  16. private System.Windows.Forms.Button btnNo;
  17. private System.Windows.Forms.Label lblMessage;
  18. private System.ComponentModel.Container components = null;
  19. private Invite invitation;
  20. private Facade f;
  21. private Form1 parent;
  22. public Invite Invitation
  23. {
  24. get{return invitation;}
  25. set{invitation = value;}
  26. }
  27. public InviteForm(Form1 parent, ref Facade f)
  28. {
  29. InitializeComponent();
  30. this.MdiParent = parent;
  31. this.parent = parent;
  32. this.f = f;
  33. }
  34. public void initialise()
  35. {
  36. lblMessage.Text = "You have been invited to join a conversation with:n";
  37. foreach(Member m in invitation.InvitedConversation.Members)
  38. {
  39. lblMessage.Text += m.Id;
  40. lblMessage.Text += "n";
  41. }
  42. lblMessage.Text += "Would you like to join?";
  43. }
  44. /// <summary>
  45. /// Clean up any resources being used.
  46. /// </summary>
  47. protected override void Dispose( bool disposing )
  48. {
  49. if( disposing )
  50. {
  51. if(components != null)
  52. {
  53. components.Dispose();
  54. }
  55. }
  56. base.Dispose( disposing );
  57. }
  58. #region Windows Form Designer generated code
  59. /// <summary>
  60. /// Required method for Designer support - do not modify
  61. /// the contents of this method with the code editor.
  62. /// </summary>
  63. private void InitializeComponent()
  64. {
  65. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(InviteForm));
  66. this.lblMessage = new System.Windows.Forms.Label();
  67. this.btnYes = new System.Windows.Forms.Button();
  68. this.btnNo = new System.Windows.Forms.Button();
  69. this.SuspendLayout();
  70. // 
  71. // lblMessage
  72. // 
  73. this.lblMessage.Dock = System.Windows.Forms.DockStyle.Fill;
  74. this.lblMessage.Location = new System.Drawing.Point(0, 0);
  75. this.lblMessage.Name = "lblMessage";
  76. this.lblMessage.Size = new System.Drawing.Size(220, 203);
  77. this.lblMessage.TabIndex = 0;
  78. // 
  79. // btnYes
  80. // 
  81. this.btnYes.Location = new System.Drawing.Point(10, 164);
  82. this.btnYes.Name = "btnYes";
  83. this.btnYes.Size = new System.Drawing.Size(90, 24);
  84. this.btnYes.TabIndex = 1;
  85. this.btnYes.Text = "接受";
  86. this.btnYes.Click += new System.EventHandler(this.btnYes_Click);
  87. // 
  88. // btnNo
  89. // 
  90. this.btnNo.Location = new System.Drawing.Point(115, 164);
  91. this.btnNo.Name = "btnNo";
  92. this.btnNo.Size = new System.Drawing.Size(90, 24);
  93. this.btnNo.TabIndex = 2;
  94. this.btnNo.Text = "拒绝";
  95. this.btnNo.Click += new System.EventHandler(this.btnNo_Click);
  96. // 
  97. // InviteForm
  98. // 
  99. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  100. this.ClientSize = new System.Drawing.Size(220, 203);
  101. this.Controls.Add(this.btnNo);
  102. this.Controls.Add(this.btnYes);
  103. this.Controls.Add(this.lblMessage);
  104. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  105. this.Name = "InviteForm";
  106. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  107. this.Text = "邀请";
  108. this.TopMost = true;
  109. this.ResumeLayout(false);
  110. }
  111. #endregion
  112. private void btnYes_Click(object sender, System.EventArgs e)
  113. {
  114. //accept the invitation
  115. f.acceptInvitation(parent.ConversationMember.Id,invitation.Id);
  116. parent.joinConversation(this);
  117. }
  118. private void btnNo_Click(object sender, System.EventArgs e)
  119. {
  120. f.rejectInvitation(parent.ConversationMember.Id,invitation.Id);
  121. this.Close();
  122. }
  123. }
  124. }