-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainForm.cs
64 lines (52 loc) · 1.24 KB
/
MainForm.cs
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
/*
* Created by SharpDevelop.
* User: Alex
* Date: 06.08.2015
* Time: 10:00
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
namespace Telemonitor
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
private TelegramWorker worker;
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void MainFormShown(object sender, EventArgs e)
{
Hide();
}
void MainFormLoad(object sender, EventArgs e)
{
Settings tmSettings = new Settings();
if (tmSettings.SettingsExists) {
worker = new TelegramWorker(tmSettings);
worker.StartWork();
trayIcon.Text = "Telemonitor (работает)";
}
else
{
trayIcon.Text = "Telemonitor (неактивен)";
}
}
void MainFormFormClosing(object sender, FormClosingEventArgs e)
{
if (worker != null)
worker.StopWork();
}
}
}