using System ;

using System.Windows.Forms ;

using MaterialSkin.Controls ;

using System.Threading ;

namespace SellingCursedEnergy

{

public partial class frmTalker : MaterialForm

{

// Input string, Output string (possibly with chatcolors)

public static string Input ;

public static string Output ;

// Counters for time messages send, interval and a string interval because I didn't know how to int.Tryparse

// Content in a textbox immediatly

public static int messageCounter = 0 ;

public static int Interval ;

public static string strInterval ;

// Set the chatcolors in an enum, use them in a switch later

public enum Chatcolors { Wave1, Wave2, Flash1, Flash2, Flash3, Glow1, Glow2, Glow3, Scroll, Slide, Shake, Red, White, Green, Purple, None } ;

public Chatcolors trueColor ;

public frmTalker ( )

{

InitializeComponent ( ) ;

tbSlider . Minimum = 1 ;

tbSlider . Maximum = 10000 ;

}

// The start button sets the interval you want to talk at

// The start button shows a messagebox and starts the timer after 5 seconds

private void btnStart_Click ( object sender, EventArgs e )

{

messageCounter = 0 ;

int tbSliderValue = tbSlider . Value ;

// Default interval is 3500 ms or 3,5 sec

// Try to set the interval, if the textbox is empty (Gives an error) set intervall to 3500ms

Input = txtInput . Text ;

strInterval = txtTimerIntervall . Text ;

int . TryParse ( strInterval, out Interval ) ;

try

{

tmrTalk . Interval = Interval ;

}

catch ( Exception TimerException )

{

Console . WriteLine ( "Error!" + TimerException ) ;

tmrTalk . Interval = 3500 ;

}

// This is the part where the whole checking what radiobutton is checked and respond to that stuff happens,

// it defo defo defo is not great but that was all I could think of.

#region CheckRadioButtons

#region If statements

if ( rBtnFlash1 . Checked )

{

trueColor = Chatcolors . Flash1 ;

}

else if ( rBtnFlash2 . Checked )

{

trueColor = Chatcolors . Flash2 ;

}

else if ( rBtnFlash3 . Checked )

{

trueColor = Chatcolors . Flash3 ;

}

else if ( rBtnWave . Checked )

{

trueColor = Chatcolors . Wave1 ;

}

else if ( rBtnWave2 . Checked )

{

trueColor = Chatcolors . Wave2 ;

}

else if ( rBtnGlow1 . Checked )

{

trueColor = Chatcolors . Glow1 ;

}

else if ( rBtnGlow2 . Checked )

{

trueColor = Chatcolors . Glow2 ;

}

else if ( rBtnGlow3 . Checked )

{

trueColor = Chatcolors . Glow3 ;

}

else if ( rBtnScroll . Checked )

{

trueColor = Chatcolors . Scroll ;

}

else if ( rBtnShake . Checked )

{

trueColor = Chatcolors . Shake ;

}

else if ( rBtnSlide . Checked )

{

trueColor = Chatcolors . Slide ;

}

else if ( rBtnGreen . Checked )

{

trueColor = Chatcolors . Green ;

}

else if ( rBtnPurple . Checked )

{

trueColor = Chatcolors . Purple ;

}

else if ( rBtnRed . Checked )

{

trueColor = Chatcolors . Red ;

}

else if ( rBtnWhite . Checked )

{

trueColor = Chatcolors . White ;

}

else if ( rBtnNone . Checked )

{

trueColor = Chatcolors . None ;

}

#endregion

#region Switch Statement

switch ( trueColor )

{

case Chatcolors . Wave1 :

Output = "wave: " + Input ;

break ;

case Chatcolors . Wave2 :

Output = "wave2: " + Input ;

break ;

case Chatcolors . Flash1 :

Output = "flash1: " + Input ;

break ;

case Chatcolors . Flash2 :

Output = "flash2: " + Input ;

break ;

case Chatcolors . Flash3 :

Output = "flash3: " + Input ;

break ;

case Chatcolors . Glow1 :

Output = "glow1: " + Input ;

break ;

case Chatcolors . Glow2 :

Output = "glow2: " + Input ;

break ;

case Chatcolors . Glow3 :

Output = "glow3: " + Input ;

break ;

case Chatcolors . Scroll :

Output = "scroll: " + Input ;

break ;

case Chatcolors . Slide :

Output = "slide: " + Input ;

break ;

case Chatcolors . Shake :

Output = "shake: " + Input ;

break ;

case Chatcolors . Red :

Output = "red: " + Input ;

break ;

case Chatcolors . White :

Output = "white: " + Input ;

break ;

case Chatcolors . Green :

Output = "green: " + Input ;

break ;

case Chatcolors . Purple :

Output = "purple:" + Input ;

break ;

case Chatcolors . None :

Output = Input ;

break ;

default :

Output = Input ;

break ;

}

#endregion

#endregion

Thread . Sleep ( tbSliderValue ) ;

tmrTalk . Start ( ) ;

}

private void btnStop_Click ( object sender, EventArgs e )

{

tmrTalk . Stop ( ) ;

MessageBox . Show ( $ "I send {messageCounter} messages!" ) ;

}

private void tmrTalk_Tick ( object sender, EventArgs e )

{

messageCounter ++;

SendKeys . SendWait ( "~" ) ;

System. Threading . Thread . Sleep ( 500 ) ;

SendKeys . SendWait ( Output ) ;

System. Threading . Thread . Sleep ( 500 ) ;

SendKeys . SendWait ( "~" ) ;

}

// TODO

// Improve my coding skills

}