Click here to Skip to main content
15,898,222 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.4K   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 frmBotOptions.
	/// </summary>
	public class frmBotOptions : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtError;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Button cmdOK;
		private System.Windows.Forms.Button cmdCancel;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox txtStartNode;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox txtBaseNode;
		private System.Windows.Forms.ComboBox cboBotType;
		private System.Windows.Forms.Label label8;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmBotOptions()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <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.txtError = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.cmdOK = new System.Windows.Forms.Button();
			this.cmdCancel = new System.Windows.Forms.Button();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.txtStartNode = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.txtBaseNode = new System.Windows.Forms.TextBox();
			this.cboBotType = new System.Windows.Forms.ComboBox();
			this.label8 = new System.Windows.Forms.Label();
			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(106, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "Bot Options";
			// 
			// txtError
			// 
			this.txtError.Location = new System.Drawing.Point(120, 38);
			this.txtError.Name = "txtError";
			this.txtError.Size = new System.Drawing.Size(160, 20);
			this.txtError.TabIndex = 1;
			this.txtError.Text = "";
			// 
			// 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(8, 40);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(100, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "Error Message :";
			// 
			// cmdOK
			// 
			this.cmdOK.Location = new System.Drawing.Point(48, 264);
			this.cmdOK.Name = "cmdOK";
			this.cmdOK.TabIndex = 3;
			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(160, 264);
			this.cmdCancel.Name = "cmdCancel";
			this.cmdCancel.TabIndex = 4;
			this.cmdCancel.Text = "&Cancel";
			this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(120, 64);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(160, 40);
			this.label3.TabIndex = 5;
			this.label3.Text = "This message is shown when no expected response is recieved.";
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label4.Location = new System.Drawing.Point(8, 120);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(88, 16);
			this.label4.TabIndex = 6;
			this.label4.Text = "Bot Start Node";
			// 
			// txtStartNode
			// 
			this.txtStartNode.Location = new System.Drawing.Point(120, 118);
			this.txtStartNode.Name = "txtStartNode";
			this.txtStartNode.Size = new System.Drawing.Size(160, 20);
			this.txtStartNode.TabIndex = 7;
			this.txtStartNode.Text = "";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(120, 144);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(160, 24);
			this.label5.TabIndex = 8;
			this.label5.Text = "The execution of the bot will be started from this node.";
			// 
			// label6
			// 
			this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label6.Location = new System.Drawing.Point(8, 186);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(88, 16);
			this.label6.TabIndex = 9;
			this.label6.Text = "Bot Base Node";
			// 
			// txtBaseNode
			// 
			this.txtBaseNode.Location = new System.Drawing.Point(120, 184);
			this.txtBaseNode.Name = "txtBaseNode";
			this.txtBaseNode.Size = new System.Drawing.Size(160, 20);
			this.txtBaseNode.TabIndex = 10;
			this.txtBaseNode.Text = "";
			// 
			// cboBotType
			// 
			this.cboBotType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboBotType.Items.AddRange(new object[] {
															"QA Bot",
															"Helper Bot"});
			this.cboBotType.Location = new System.Drawing.Point(120, 219);
			this.cboBotType.Name = "cboBotType";
			this.cboBotType.Size = new System.Drawing.Size(160, 21);
			this.cboBotType.TabIndex = 12;
			// 
			// label8
			// 
			this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label8.Location = new System.Drawing.Point(8, 221);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(88, 16);
			this.label8.TabIndex = 11;
			this.label8.Text = "Bot Type";
			// 
			// frmBotOptions
			// 
			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(292, 303);
			this.Controls.Add(this.txtBaseNode);
			this.Controls.Add(this.label6);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.txtStartNode);
			this.Controls.Add(this.txtError);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.cmdCancel);
			this.Controls.Add(this.cmdOK);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.cboBotType);
			this.Controls.Add(this.label8);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.Name = "frmBotOptions";
			this.ShowInTaskbar = false;
			this.Text = "Bot Options";
			this.Load += new System.EventHandler(this.frmBotOptions_Load);
			this.ResumeLayout(false);

		}
		#endregion

		
		private void cmdOK_Click(object sender, System.EventArgs e)
		{
			try
			{
				DataSource.botOptions = new BotOptions(txtError.Text, txtStartNode.Text, txtBaseNode.Text, (BotOptions.BotType)cboBotType.SelectedIndex);
				this.Close();
			
			}
			catch(Exception ex)
			{
				MessageBox.Show(this,
					"Error : " + ex.Message,
					Application.Name,
					MessageBoxButtons.OK,
					MessageBoxIcon.Information);
			}
			
		}

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

		private void frmBotOptions_Load(object sender, System.EventArgs e)
		{
			txtError.Text = DataSource.botOptions.error;
			txtStartNode.Text = DataSource.botOptions.botStartNode.ToString();
			txtBaseNode.Text = DataSource.botOptions.botBaseNode.ToString();
			cboBotType.SelectedIndex = (int) DataSource.botOptions.botType;
		}
	}
}

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