diff --git a/ChatBotProject/ChatBotProject/ChatBot.Designer.cs b/ChatBotProject/ChatBotProject/ChatBot.Designer.cs
index b3a92fb..b6512dc 100644
--- a/ChatBotProject/ChatBotProject/ChatBot.Designer.cs
+++ b/ChatBotProject/ChatBotProject/ChatBot.Designer.cs
@@ -199,21 +199,23 @@ private void InitializeComponent()
this.clearChatToolStripMenuItem,
this.toggleVoiceToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(142, 48);
+ this.contextMenuStrip1.Size = new System.Drawing.Size(153, 70);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// clearChatToolStripMenuItem
//
this.clearChatToolStripMenuItem.Name = "clearChatToolStripMenuItem";
- this.clearChatToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
+ this.clearChatToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.clearChatToolStripMenuItem.Text = "Clear Chat";
this.clearChatToolStripMenuItem.Click += new System.EventHandler(this.clearChatToolStripMenuItem_Click);
//
// toggleVoiceToolStripMenuItem
//
+ this.toggleVoiceToolStripMenuItem.CheckOnClick = true;
this.toggleVoiceToolStripMenuItem.Name = "toggleVoiceToolStripMenuItem";
- this.toggleVoiceToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
- this.toggleVoiceToolStripMenuItem.Text = "Toggle Voice";
+ this.toggleVoiceToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.toggleVoiceToolStripMenuItem.Text = "Bot Voice";
+ this.toggleVoiceToolStripMenuItem.Click += new System.EventHandler(this.toggleVoiceToolStripMenuItem_Click);
//
// Form1
//
diff --git a/ChatBotProject/ChatBotProject/ChatBot.cs b/ChatBotProject/ChatBotProject/ChatBot.cs
index cff323c..5624957 100644
--- a/ChatBotProject/ChatBotProject/ChatBot.cs
+++ b/ChatBotProject/ChatBotProject/ChatBot.cs
@@ -2,6 +2,7 @@
using System.Windows.Forms;
using System.Media;
using System.IO; // needed for filing
+using System.Speech.Synthesis;
namespace ChatBotProject
{
@@ -13,6 +14,9 @@ public Form1()
}
static ChatBot bot;
+ SpeechSynthesizer reader = new SpeechSynthesizer();
+ bool textToSpeech = false;
+
private void Form1_Load(object sender, EventArgs e)
{
bot = new ChatBot();
@@ -79,7 +83,7 @@ private void showOutput()
var t = new Timer();
// Time in milseconds - minimum delay of 1s plus 0.1s per character.
- t.Interval = 1; // 1000 + (outtt.Length * 100);
+ t.Interval = 1000 + (outtt.Length * 100);
// Show the "Bot is typing.." text
txtTyping.Show();
@@ -99,6 +103,12 @@ private void showOutput()
// Show the bot message and play the sound
addOutMessage(outtt);
Rcv.Play();
+
+ // Text to Speech if enabled
+ if (textToSpeech)
+ {
+ reader.SpeakAsync(outtt);
+ }
InputTxt.Focus(); // Put the cursor back on the textbox
t.Stop();
@@ -196,5 +206,10 @@ private void menuButton_Click(object sender, EventArgs e)
contextMenuStrip1.Show(menuButton, new System.Drawing.Point(0, -contextMenuStrip1.Size.Height));
}
+ private void toggleVoiceToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ // whenever the toggle is clicked, true is set to false visa versa.
+ textToSpeech = !textToSpeech;
+ }
}
}
\ No newline at end of file
diff --git a/ChatBotProject/ChatBotProject/ChatBot.resx b/ChatBotProject/ChatBotProject/ChatBot.resx
index 7689d0e..56402d2 100644
--- a/ChatBotProject/ChatBotProject/ChatBot.resx
+++ b/ChatBotProject/ChatBotProject/ChatBot.resx
@@ -288,27 +288,6 @@
177, 17
-
-
- iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1
- MAAA6mAAADqYAAAXcJy6UTwAAAAJcEhZcwAACxMAAAsTAQCanBgAAANPSURBVHhe7dyhbUBRDATBNP3r
- TxpY8KSY3YAhyywd9s/3fTArI6zICCsywoqMsCIjrMgIKzLCioywIiOsyAgrMsKKjLAiI6zICCsywoqM
- sC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6PgVW3qTMZjdRS8qk2d
+ yXisjoJXtakzGY/VUfCqNnUm47E6Cl7Vps5kPFZHwava1JmMx+ooeFWbOpPxWB0Fr2pTZzIeq6PgVW3q
+ TMZjdRS8qk2dyQgrMsKKjLAiI6zICCsywoqMsCIjrMgIKzLCioywIiOsyAgrMsKKjLAiI6zICCsywoqM
+ sCIjrMgIKzLCioywIiOsyHisnh3Bq9rUmYzH6ih4VZs6k/FYHQWvalNnMh6ro+BVbepMxmN1FLyqTZ3J
+ eKyOgle1qTMZj9VR8Ko2dSbjsToKXtWmzmQ8VkfBq9rUmYzH6ih4VZs6k/FYHQWvalNnMh6ro+BVbepM
+ xmN1FLyqTZ3JeKyOgle1qTMZj9VR8Ko2dSbjsToKXtWmzmSEFRlhRUZYkRFWZIQVGWFFRliREVZkhBUZ
+ YUVGWJERVmSEFRlhRUZYkRFWZIQVGWFFRliREVZkhBUZYUVGWJERVmSEFRlhRUZYkRFWZIQVGWFFRliR
+ EVZkhBUZYUVGWJERVmSEFRlhRUZYkRFWZIQVGWFFRliREVZkhBUZYUVGWJERNnw/f+slYiGpbk4GAAAA
+ AElFTkSuQmCC
diff --git a/ChatBotProject/ChatBotProject/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/ChatBotProject/ChatBotProject/obj/Debug/DesignTimeResolveAssemblyReferences.cache
index d74598d..3743a85 100644
Binary files a/ChatBotProject/ChatBotProject/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/ChatBotProject/ChatBotProject/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ