iMonitor desktop application using dotnet 4.8
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

361 lines
9.0 KiB

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using iMonitorApp.Classes;
using iMonitorApp.Properties;
namespace iMonitorApp
{
// Token: 0x0200000C RID: 12
public partial class DashBoard : Form
{
// Token: 0x06000053 RID: 83 RVA: 0x0000382B File Offset: 0x00001A2B
public DashBoard()
{
this.InitializeComponent();
}
// Token: 0x06000054 RID: 84 RVA: 0x00003844 File Offset: 0x00001A44
private void DashBoard_Load(object sender, EventArgs e)
{
new Thread(delegate()
{
this.InitializePhoneSystem();
}).Start();
new Thread(delegate()
{
this.InitializeTradeAlerts();
}).Start();
new Thread(delegate()
{
this.InitializeEmailAlerts();
}).Start();
new Thread(delegate()
{
this.InitializeMarketDataAlerts();
}).Start();
}
// Token: 0x06000055 RID: 85 RVA: 0x000038AE File Offset: 0x00001AAE
private void InitializeMarketDataAlerts()
{
}
// Token: 0x06000056 RID: 86 RVA: 0x000038AE File Offset: 0x00001AAE
private void InitializeEmailAlerts()
{
}
// Token: 0x06000057 RID: 87 RVA: 0x000038B1 File Offset: 0x00001AB1
private void InitializeTradeAlerts()
{
this._tradeTimer = new System.Threading.Timer(new TimerCallback(this.TradeAlertProc), null, 100, Settings.Default.TimerTradeChecks * 1000);
}
// Token: 0x06000058 RID: 88 RVA: 0x000038E0 File Offset: 0x00001AE0
private void TradeAlertProc(object state)
{
CountdownEvent countdownEvent = new CountdownEvent(5);
new Thread(delegate()
{
this.UpdateButton(this.btn_check_working_orders, TradeAlerts.CheckWorkingOrders());
countdownEvent.Signal();
}).Start();
new Thread(delegate()
{
this.UpdateButton(this.btn_check_new_orders, TradeAlerts.CheckNewOrders());
countdownEvent.Signal();
}).Start();
new Thread(delegate()
{
this.UpdateButton(this.btn_check_baskets, TradeAlerts.CheckBaskets());
countdownEvent.Signal();
}).Start();
new Thread(delegate()
{
this.UpdateButton(this.btn_check_outbox, TradeAlerts.CheckOutbox());
countdownEvent.Signal();
}).Start();
new Thread(delegate()
{
this.UpdateButton(this.btn_checkGun, TradeAlerts.CheckGun());
countdownEvent.Signal();
}).Start();
countdownEvent.Wait();
}
// Token: 0x06000059 RID: 89 RVA: 0x00003986 File Offset: 0x00001B86
private void btn_check_baskets_Click(object sender, EventArgs e)
{
new Thread(delegate()
{
this.UpdateButton(this.btn_check_baskets, TradeAlerts.CheckBaskets());
}).Start();
}
// Token: 0x0600005A RID: 90 RVA: 0x000039A0 File Offset: 0x00001BA0
private void InitializePhoneSystem()
{
this._phoneCallList = new ObservableCollection<PhoneCall>();
this._phoneCallList.CollectionChanged += this._phoneCallList_CollectionChanged;
new Thread(delegate()
{
this._phoneCallListener = new AsynchronousSocketListener(Config.GetIP4Address(), Settings.Default.PhonePort);
AsynchronousSocketListener.Received += this.AsynchronousSocketListener_Received;
AsynchronousSocketListener.StartListening();
}).Start();
this.UpdateLabel(this.lbl_check_skype, "Checking Skype");
this.UpdateLabel(this.lbl_skype_status, "Skype Status: Unknown");
this.UpdateLabel(this.lbl_call_status, "Call Status: Unknown");
this.UpdatePicture(this.pictureBox1, Resources.loading);
try
{
this.UpdateLabel(this.lbl_check_skype, "Skype Working.");
this.UpdatePicture(this.pictureBox1, Resources.Check);
}
catch
{
this.UpdateLabel(this.lbl_check_skype, "Unable to access skype");
this.UpdatePicture(this.pictureBox1, Resources.cancel);
}
}
// Token: 0x0600005B RID: 91 RVA: 0x00003A94 File Offset: 0x00001C94
private void AsynchronousSocketListener_Received(object sender, EventArgs e)
{
string text = sender.ToString().Replace("<EOF>", "");
this.UpdateLabel(this.lbl_server_received, "Last Received: " + DateTime.Now.ToShortTimeString());
List<string> list = (from t in text.Split(new char[]
{
','
}).ToList<string>()
where t.Trim() != ""
select t).ToList<string>();
bool flag = list.Count > 4;
if (flag)
{
this.MultiplePhones(text.Split(new char[]
{
','
}).ToList<string>());
}
else
{
PhoneCall item = new PhoneCall
{
Numbers = list,
Count = list.Count,
Status = "Queued"
};
this._phoneCallList.Add(item);
}
}
// Token: 0x0600005C RID: 92 RVA: 0x00003B88 File Offset: 0x00001D88
private void MultiplePhones(List<string> numbers)
{
try
{
int num = numbers.Count / 4;
int num2 = numbers.Count % 4;
int num3 = 0;
for (int i = 0; i < num; i++)
{
this._phoneCallList.Add(new PhoneCall
{
Numbers = numbers.Skip(num3).Take(4).ToList<string>(),
Count = 4,
Status = "Queued"
});
num3 += 4;
}
bool flag = num2 == 1;
if (flag)
{
this._phoneCallList.Add(new PhoneCall
{
Numbers = numbers.Skip(num3).Take(1).ToList<string>(),
Count = 1,
Status = "Queued"
});
}
bool flag2 = num2 == 2;
if (flag2)
{
this._phoneCallList.Add(new PhoneCall
{
Numbers = numbers.Skip(num3).Take(2).ToList<string>(),
Count = 1,
Status = "Queued"
});
}
bool flag3 = num2 == 3;
if (flag3)
{
this._phoneCallList.Add(new PhoneCall
{
Numbers = numbers.Skip(num3).Take(3).ToList<string>(),
Count = 1,
Status = "Queued"
});
}
}
catch
{
foreach (string item in numbers)
{
this._phoneCallList.Add(new PhoneCall
{
Numbers = new List<string>
{
item
},
Count = 1,
Status = "Queued"
});
}
}
}
// Token: 0x0600005D RID: 93 RVA: 0x00003D80 File Offset: 0x00001F80
private void _phoneCallList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
this.ProcessPhoneQueue();
}
// Token: 0x0600005E RID: 94 RVA: 0x00003D8C File Offset: 0x00001F8C
private void ProcessPhoneQueue()
{
IEnumerable<PhoneCall> source = from p in this._phoneCallList
where p.Status == "Working"
select p;
this.UpdateLabel(this.lbl_phone_working, "Working: " + source.Count<PhoneCall>().ToString());
IEnumerable<PhoneCall> source2 = from p in this._phoneCallList
where p.Status == "Queued"
select p;
this.UpdateLabel(this.lbl_phone_queued, "Queued: " + source2.Count<PhoneCall>().ToString());
bool flag = source2.Count<PhoneCall>() > 0;
if (flag)
{
PhoneCall phoneCall = source2.First<PhoneCall>();
bool flag2 = phoneCall.Count != 0;
if (flag2)
{
try
{
List<string> list = new List<string>();
foreach (string text in phoneCall.Numbers)
{
list.Add(text.Replace(" ", ""));
}
try
{
}
catch
{
}
bool flag3 = !PhoneScheduleCheck.IsPhoneActive();
if (flag3)
{
int num = 2;
int frequency = 4000;
int duration = 200;
for (int i = 0; i < num; i++)
{
Console.Beep(frequency, duration);
}
return;
}
Uri uri = new Uri("skype:" + string.Join(";", list) + "?call");
Process.Start(uri.AbsoluteUri);
Thread.Sleep(10000);
phoneCall.Status = "Working";
}
catch
{
}
}
}
IEnumerable<PhoneCall> source3 = from p in this._phoneCallList
where p.Status == "Finished"
select p;
this.UpdateLabel(this.lbl_phone_finished, "Finished: " + source3.Count<PhoneCall>().ToString());
bool flag4 = source3.Count<PhoneCall>() > 0;
if (flag4)
{
}
}
// Token: 0x0600005F RID: 95 RVA: 0x00003FEC File Offset: 0x000021EC
private void UpdatePicture(PictureBox p, Bitmap image)
{
bool invokeRequired = p.InvokeRequired;
if (invokeRequired)
{
p.Invoke(new Action(delegate()
{
p.Image = image;
}));
}
else
{
p.Image = image;
}
}
// Token: 0x06000060 RID: 96 RVA: 0x0000404C File Offset: 0x0000224C
private void UpdateLabel(Label l, string message)
{
bool invokeRequired = l.InvokeRequired;
if (invokeRequired)
{
l.Invoke(new Action(delegate()
{
l.Text = message;
}));
}
else
{
l.Text = message;
}
}
// Token: 0x06000061 RID: 97 RVA: 0x000040AC File Offset: 0x000022AC
private void UpdateButton(Button l, string message)
{
bool invokeRequired = l.InvokeRequired;
if (invokeRequired)
{
l.Invoke(new Action(delegate()
{
l.Text = message;
}));
}
else
{
l.Text = message;
}
}
// Token: 0x06000062 RID: 98 RVA: 0x000038AE File Offset: 0x00001AAE
private void btn_check_outbox_Click(object sender, EventArgs e)
{
}
// Token: 0x04000029 RID: 41
private ObservableCollection<PhoneCall> _phoneCallList;
// Token: 0x0400002A RID: 42
private AsynchronousSocketListener _phoneCallListener;
// Token: 0x0400002B RID: 43
private System.Threading.Timer _tradeTimer;
}
}