/*
* by Swen Kooij aka Kirk - swenkooij@gmail.com
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
/// <summary>
/// The main namespace for the 'Whatsapp Desktop Client' project.
/// </summary>
namespace WhatsappClient
{
/// <summary>
/// A form that is used to test and debug new code and functionalitly
/// </summary>
public partial class Form_Debug : Form
{
// Create an empty instance of the WhatsAppHelper class
private WhatsAppHelper Helper;
/// <summary>
/// Class constructor, initializes the class.
/// </summary>
public Form_Debug()
{
InitializeComponent();
// Initliaze new instance of WhatsAppHelper class
Helper = new WhatsAppHelper();
}
/// <summary>
/// Adds a new line to the top of the RichTextBox designed for logging.
/// </summary>
/// <param name="Text">A string with the text that needs to be appended to the log.</param>
private void AddToLog(string Text)
{
RT_Log.Text = "-> " + Text + Environment.NewLine + RT_Log.Text;
}
/// <summary>
/// Event: Selected item in the 'Device OS' box changed
/// </summary>
private void ComboBox_DeviceOS_SelectedIndexChanged(object sender, EventArgs e)
{
string SelectedValue = ComboBox_DeviceOS.Text;
if (SelectedValue == "iOS")
Label_ImeiMac.Text = "Wifi Mac Adress:";
else
Label_ImeiMac.Text = "IMEI:";
}
/// <summary>
/// Event: The form has loaded
/// </summary>
private void Form_Debug_Load(object sender, EventArgs e)
{
ComboBox_DeviceOS.Text = "Android";
}
/// <summary>
/// Event: The 'Generate Password' button has been clicked
/// </summary>
private void Button_GeneratePassword_Click(object sender, EventArgs e)
{
if (ComboBox_DeviceOS.Text == "iOS")
{
TextBox_Password.Text = Helper.generatePassword(TextBox_ImeiMac.Text, WhatsAppHelper.DeviceOS.iOS);
}
else
{
TextBox_Password.Text = Helper.generatePassword(TextBox_ImeiMac.Text, WhatsAppHelper.DeviceOS.Other);
}
}
/// <summary>
/// Event: The 'Test Connection' button has been clicked
/// </summary>
private void Button_TestConnection_Click(object sender, EventArgs e)
{
// Verify account
bool Result = Helper.verifyAccount(TextBox_PhoneNumber.Text, TextBox_Password.Text);
if(Result)
AddToLog("Account exists!");
else
AddToLog("Account does not exists!");
}
}
}