Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Livinston-Bran authored Sep 18, 2023
1 parent d0cc213 commit 2e555ac
Show file tree
Hide file tree
Showing 75 changed files with 267,529 additions and 0 deletions.
6 changes: 6 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
428 changes: 428 additions & 0 deletions Assistant.Designer.cs

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions Assistant.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.IO;
using System.Drawing.Imaging;

namespace Smart_Application
{
public partial class Assistant : Form
{
SpeechRecognitionEngine recEngine = new SpeechRecognitionEngine();
SpeechSynthesizer speech = new SpeechSynthesizer();
System.Media.SoundPlayer music = new System.Media.SoundPlayer();
public Assistant()
{
InitializeComponent();

Choices choices = new Choices();
string[] text = File.ReadAllLines(Environment.CurrentDirectory + "//grammer.txt");
choices.Add(text);
Grammar grammar = new Grammar(new GrammarBuilder(choices));
recEngine.LoadGrammar(grammar);
recEngine.SetInputToDefaultAudioDevice();
recEngine.RecognizeAsync(RecognizeMode.Multiple);
recEngine.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recEngine_SpeechRecognized);

speech.SelectVoiceByHints(VoiceGender.Female);
}

private void recEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
string result = e.Result.Text;

if (result == "Hello Zain")
{
result = "Hello, I am Zain State your Command";
}

if (result == "Lights On")
{
result = "Activated";
}

if (result == "Refridgerator On")
{
result = "Activated";
}

if (result == "Air Conditioner On")
{
result = "Activated";
}

if (result == "Temprature On")
{
result = "Activated";
}

if (result == "Lights Off")
{
result = "Dectivated";
}

if (result == "Refridgerator Off")
{
result = "Deactivated";
}

if (result == "Air Conditioner Off")
{
result = "Deactivated";
}

if (result == "Temprature Off")
{
result = "Deactivated";
}


if (result == "EXIT")
{
this.Hide();
}


speech.SpeakAsync(result);
txtlabel.Text = result;
}

private void Assistant_Load(object sender, EventArgs e)
{

}

private void guna2Button8_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
5,407 changes: 5,407 additions & 0 deletions Assistant.resx

Large diffs are not rendered by default.

313 changes: 313 additions & 0 deletions Login.Designer.cs

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions Login.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Smart_Application
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}


private void label2_Click(object sender, EventArgs e)
{
Application.Exit();
}

int count = 0;
private void guna2Button1_Click(object sender, EventArgs e)
{
String username = TextBox1.Text;
String password = TextBox2.Text;

count = count + 1;

if (count > 3)
{
MessageBox.Show("Sorry Invalid User Attempt !!");
this.Close();
}

if (username.Equals("branL") && password.Equals("2001"))
{
dashboard dashboard = new dashboard();
this.Hide();
dashboard.Show();
}
else
{
MessageBox.Show("Username or Password Incorrect !");
}
}

private void TextBox2_TextChanged(object sender, EventArgs e)
{

}

private void guna2Panel2_Paint(object sender, PaintEventArgs e)
{

}

private void Login_Load(object sender, EventArgs e)
{
Label3.Text = DateTime.Now.ToShortTimeString();


int currentHour = DateTime.Now.Hour;

if (currentHour < 12)
guna2HtmlLabel6.Text = "Good Morning Bran!";
else if (currentHour < 18)
guna2HtmlLabel6.Text = "Good Afternoon Bran!";
else
guna2HtmlLabel6.Text = "Good Evening Bran!";
}


private void timer1_Tick(object sender, EventArgs e)
{
Label3.Text = DateTime.Now.ToShortTimeString();
timer1.Start();
}

private void guna2HtmlLabel6_Click(object sender, EventArgs e)
{

}
}
}
Loading

0 comments on commit 2e555ac

Please sign in to comment.