2014-04-25 21:55:43 +00:00
|
|
|
|
using GlacialComponents.Controls;
|
|
|
|
|
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 MSGer.tk
|
|
|
|
|
{
|
2015-03-26 19:36:18 +00:00
|
|
|
|
public partial class AddPartner : ThemedForms
|
2014-04-25 21:55:43 +00:00
|
|
|
|
{
|
|
|
|
|
public AddPartner()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-10-24 17:02:38 +00:00
|
|
|
|
this.Text = Language.Translate("addcontact");
|
|
|
|
|
label1.Text = Language.Translate("addcontact");
|
|
|
|
|
label2.Text = Language.Translate("addcontact_nameemail");
|
|
|
|
|
searchbtn.Text = Language.Translate("addcontact_search");
|
2015-03-26 19:36:18 +00:00
|
|
|
|
glacialList1.Columns[0].Text = Language.Translate("username");
|
2014-10-24 17:02:38 +00:00
|
|
|
|
gobtn.Text = Language.Translate("addcontact_add");
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-24 17:02:38 +00:00
|
|
|
|
List<UserInfo> FoundUsers = new List<UserInfo>();
|
2014-04-25 21:55:43 +00:00
|
|
|
|
|
|
|
|
|
private void searchbtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
glacialList1.Items.Clear();
|
2014-10-24 17:02:38 +00:00
|
|
|
|
foreach (var tmp in UserInfo.KnownUsers)
|
|
|
|
|
{
|
|
|
|
|
if ((tmp.UserName.Contains(nameText.Text) || tmp.Name.Contains(nameText.Text) || tmp.UserID.ToString() == nameText.Text) && !FoundUsers.Contains(tmp))
|
|
|
|
|
{
|
|
|
|
|
glacialList1.Items.Add(tmp.UserName);
|
2014-04-25 21:55:43 +00:00
|
|
|
|
|
2014-10-24 17:02:38 +00:00
|
|
|
|
FoundUsers.Add(tmp);
|
|
|
|
|
}
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void glacialList1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int item = glacialList1.HotItemIndex;
|
|
|
|
|
if (item >= glacialList1.Items.Count)
|
|
|
|
|
return;
|
|
|
|
|
//2014.04.18. - Partnerinformáció mutatása
|
2014-10-24 17:02:38 +00:00
|
|
|
|
//2014.08.16. - Megvalósítás
|
|
|
|
|
if (FoundUsers.Count < item)
|
|
|
|
|
(new PartnerInformation(FoundUsers[item])).ShowDialog();
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void gobtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-10-24 17:02:38 +00:00
|
|
|
|
if (glacialList1.SelectedItems.Count == 0 || FoundUsers.Count == 0)
|
2014-04-25 21:55:43 +00:00
|
|
|
|
return;
|
|
|
|
|
string username = ((GLItem)glacialList1.SelectedItems[0]).Text;
|
|
|
|
|
string response = Networking.SendRequest("adduser", username, 0, true);
|
2014-10-24 17:02:38 +00:00
|
|
|
|
if (response == "Success")
|
2014-04-25 21:55:43 +00:00
|
|
|
|
MessageBox.Show("Felhasználó felvéve az ismerőseid közé.");
|
|
|
|
|
else
|
|
|
|
|
MessageBox.Show("Nem sikerült felvenni a felhasználót az ismerőseid közé.\nLehet, hogy már felvetted, vagy valami hiba történt.\n(" + response + ")");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|