Menu

[r9]: / trunk / WhatsappClient / Form_Debug.cs  Maximize  Restore  History

Download this file

105 lines (94 with data), 3.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
/*
* 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)
{
ThreadedMethod tMethod = new ThreadedMethod(verifyAccount);
tMethod.Start();
}
/// <summary>
/// Verifies the account, this method is supposed to be called in a seperated thread using the ThreadedMethod class.
/// </summary>
private void verifyAccount()
{
// Verify account
bool Result = Helper.verifyAccount(TextBox_PhoneNumber.Text, TextBox_Password.Text);
if (Result)
AddToLog("Account exists!");
else
AddToLog("Account does not exists!");
}
}
}