Repository navigation
Expand file tree
/
Copy pathSendMediaApplicationContext.cs
More file actions
55 lines (45 loc) · 1.7 KB
/
Copy pathSendMediaApplicationContext.cs
File metadata and controls
55 lines (45 loc) · 1.7 KB
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
using SendMedia.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SendMedia
{
public class SendMediaApplicationContext : ApplicationContext
{
private NotifyIcon trayIcon;
public SendMediaApplicationContext()
{
// Initialize Tray Icon
trayIcon = new NotifyIcon()
{
Icon = Resources.TrayIcon,
ContextMenu = new ContextMenu(new MenuItem[] {
new MenuItem("Exit", Exit)
}),
Text = "Giphy In Skype",
Visible = true
};
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
var frm = new MainForm();
frm.Show();
MessageBox.Show("The application is running. Open Skype window and type /gif YOURKEYWORD. In short time the window with searched gifs will be opened.",
"Information",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var ex = (Exception)e.ExceptionObject;
MessageBox.Show(ex.Message + ex.StackTrace, "Error", MessageBoxButtons.OK);
}
void Exit(object sender, EventArgs e)
{
// Hide tray icon, otherwise it will remain shown until user mouses over it
trayIcon.Visible = false;
Application.Exit();
}
}
}