private void GlobalKeyUp(object sender, KeyEventArgs e)
{
mouseKeyEventProvider.Enabled = false;
bool Shift = ((e.Modifiers & Keys.Shift) == Keys.Shift);
bool Alt = ((e.Modifiers & Keys.Alt) == Keys.Alt);
bool Ctrl = ((e.Modifiers & Keys.Control) == Keys.Control);
if (Convert.ToString(e.KeyCode).Equals(Convert.ToString(Properties.Settings.Default.Key))
&& Shift == Properties.Settings.Default.Shift
&& Alt == Properties.Settings.Default.Alt
&& Ctrl == Properties.Settings.Default.Ctrl)
{
String text = Clipboard.GetText();
if (text.Length >= 4000)
{
notifyIconMain.BalloonTipText = GetString("TOLONG");
notifyIconMain.ShowBalloonTip(5);
}
else
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(url);
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("login", Properties.Settings.Default.Login),
new KeyValuePair<string, string>("pass", Properties.Settings.Default.Pass),
new KeyValuePair<string, string>("message", text)
});
var result = client.PostAsync(filePathSend, content).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
if (Properties.Settings.Default.ShowBallon)
{
String message = resultContent;
if (resultContent.Contains("WRONGLOGIN"))
{
message = GetString("WRONGLOGIN");
}
if (resultContent.Contains("TOLONG"))
{
message = GetString("TOLONG");
}
if (resultContent.Contains("OK!"))
{
message = GetString("OK!");
}
notifyIconMain.BalloonTipText = message;
notifyIconMain.ShowBalloonTip(5);
}
}
}
}
mouseKeyEventProvider.Enabled = true;
}