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
|
namespace PicsWizz
{
public partial class TestConnexion : Form
{
private string login;
private string password;
private int STATUT = -1;
public string RESULTAT="";
public TestConnexion()
{
InitializeComponent();
Thread T1 = new Thread(new ThreadStart(Throw_WebService));
T1.Start();
}
public TestConnexion(string login, string password):this()
{
this.login = login;
this.password = password;
}
public void Throw_WebService()
{
try
{
WebServiceFunctions();
}
catch (Exception E)
{
Debug.WriteLine(E.Message.ToString());
}
}
private void WebServiceFunctions()
{
Heelo_test T = new Heelo_test();
if (T.Authentification(login, password) == "1")
{
RESULTAT = "Succès d'authentification !!!";
STATUT = 1;
}
else
{
RESULTAT = "Athentification refusée !!!";
STATUT = 0;
}
}
private void Show_ProgressBar(object sender, EventArgs e)
{
while (RESULTAT == "")
{
progressBar1.Value = progressBar1.Value % progressBar1.Maximum + 1;
this.Update();
Thread.Sleep(50);
}
if (STATUT == 1)
{
Color col = Color.FromArgb(100, 0, 255, 0);
label1.ForeColor = col;
}
else
{
Color col = Color.FromArgb(100, 125, 0, 0);
label1.ForeColor = col;
}
progressBar1.Value = 100;
ContentAlignment Align = ContentAlignment.TopCenter;
Size S = new Size();
S.Width = label1.Text.Length;
label1.Size = S;
label1.TextAlign = Align;
label1.Text = RESULTAT;
}
}
} |