Click here to Skip to main content
15,885,767 members
Articles / Programming Languages / C#

Bot Suite

Rate me:
Please Sign up or sign in to vote.
1.35/5 (16 votes)
24 Aug 2008LGPL36 min read 94.1K   877   31  
Bot Suite is a collection of utilities provided to create, schedule and run the chat bots. Bot suite consists of three applications i.e. Bot Studio, Bot Engine & MyMessenger. Bot suite provides the solution for the automated conversation using these applications. We will see their usage here.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using BotSuite.MyWebAssembly;

namespace BotSuite.BotStudio
{
	/// <summary>
	/// Summary description for frmAddEvent.
	/// </summary>
	public class frmAddEvent : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox txtEmail;
		private System.Windows.Forms.TextBox txtMessage;
		private System.Windows.Forms.ComboBox cboMType;
		private System.Windows.Forms.Button cmdOK;
		private System.Windows.Forms.Button cmdCancel;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmAddEvent()
		{
			
			InitializeComponent();

		
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.txtEmail = new System.Windows.Forms.TextBox();
			this.txtMessage = new System.Windows.Forms.TextBox();
			this.cboMType = new System.Windows.Forms.ComboBox();
			this.cmdOK = new System.Windows.Forms.Button();
			this.cmdCancel = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.Location = new System.Drawing.Point(11, 18);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "User email ID";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label2.Location = new System.Drawing.Point(11, 50);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(80, 16);
			this.label2.TabIndex = 1;
			this.label2.Text = "MessageType";
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label3.Location = new System.Drawing.Point(11, 80);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(80, 16);
			this.label3.TabIndex = 2;
			this.label3.Text = "Message";
			// 
			// txtEmail
			// 
			this.txtEmail.Location = new System.Drawing.Point(104, 16);
			this.txtEmail.Name = "txtEmail";
			this.txtEmail.Size = new System.Drawing.Size(168, 20);
			this.txtEmail.TabIndex = 3;
			this.txtEmail.Text = "";
			// 
			// txtMessage
			// 
			this.txtMessage.Location = new System.Drawing.Point(8, 104);
			this.txtMessage.Multiline = true;
			this.txtMessage.Name = "txtMessage";
			this.txtMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txtMessage.Size = new System.Drawing.Size(264, 80);
			this.txtMessage.TabIndex = 4;
			this.txtMessage.Text = "";
			// 
			// cboMType
			// 
			this.cboMType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboMType.Items.AddRange(new object[] {
														  "Email",
														  "Instant Message"});
			this.cboMType.Location = new System.Drawing.Point(104, 48);
			this.cboMType.Name = "cboMType";
			this.cboMType.Size = new System.Drawing.Size(168, 21);
			this.cboMType.TabIndex = 5;
			// 
			// cmdOK
			// 
			this.cmdOK.Location = new System.Drawing.Point(47, 208);
			this.cmdOK.Name = "cmdOK";
			this.cmdOK.TabIndex = 6;
			this.cmdOK.Text = "&OK";
			this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
			// 
			// cmdCancel
			// 
			this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cmdCancel.Location = new System.Drawing.Point(159, 208);
			this.cmdCancel.Name = "cmdCancel";
			this.cmdCancel.TabIndex = 7;
			this.cmdCancel.Text = "&Cancel";
			this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
			// 
			// frmAddEvent
			// 
			this.AcceptButton = this.cmdOK;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
			this.CancelButton = this.cmdCancel;
			this.ClientSize = new System.Drawing.Size(280, 245);
			this.Controls.Add(this.cmdCancel);
			this.Controls.Add(this.cmdOK);
			this.Controls.Add(this.cboMType);
			this.Controls.Add(this.txtMessage);
			this.Controls.Add(this.txtEmail);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.Name = "frmAddEvent";
			this.ShowInTaskbar = false;
			this.Text = "Add Event";
			this.Load += new System.EventHandler(this.frmAddEvent_Load);
			this.ResumeLayout(false);

		}
		#endregion

		
		private void cmdOK_Click(object sender, System.EventArgs e)
		{
			MessageType MType;
			if( cboMType.SelectedItem.ToString() == "Email")
				MType = MessageType.Email;
			else
				MType = MessageType.InstantMessage;
			Event evt = new Event(txtEmail.Text,txtMessage.Text,MType);
			this.Tag = evt;
			this.DialogResult = DialogResult.OK;
			this.Close();
		}

		private void cmdCancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void frmAddEvent_Load(object sender, System.EventArgs e)
		{
			cboMType.SelectedIndex = 0;
			if(this.Tag != null) // opened for editing
			{
				Event evt = (Event) this.Tag;
				txtEmail.Text = evt.email;
				txtMessage.Text = evt.message;
				if(evt.MType.ToString() == "Email")
					cboMType.SelectedIndex = 0;
				else
					cboMType.SelectedIndex = 1;
			}
			
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Web Developer
Pakistan Pakistan
Mansoor Sarfraz works in a well reputed multinational software development company. Software development is not only his duty but his passion too. In his professional career he was Involved in the development of resource/content management system, workflow based systems, enterprise projects based on MS Windows DNA architecture and .NET framework, web based rich client UI development, Rest based backend web services and windows services for different systems. He was also involved in software designing and architecture. He has expertise in C#.NET, ASP.NET, Sql Server, Adobe Flex, Java, Ajax and JavaScript.

You can reach him through his blog
http://mansoorsarfraz.blogspot.com

Comments and Discussions