Skip to content

Commit

Permalink
Added an icon, minimizing to system tray, and auto-starting when laun…
Browse files Browse the repository at this point in the history
…ched.
  • Loading branch information
Kapps committed Sep 22, 2014
1 parent 7f49f61 commit 8f88c1d
Show file tree
Hide file tree
Showing 9 changed files with 6,287 additions and 10 deletions.
6 changes: 6 additions & 0 deletions PoEWhisperNotifier/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<setting name="EnableSound" serializeAs="String">
<value>True</value>
</setting>
<setting name="MinimizeToTray" serializeAs="String">
<value>False</value>
</setting>
<setting name="AutoStartWhenOpened" serializeAs="String">
<value>False</value>
</setting>
</PoEWhisperNotifier.Properties.Settings>
</userSettings>
</configuration>
Binary file added PoEWhisperNotifier/Content/Chat.ico
Binary file not shown.
5 changes: 4 additions & 1 deletion PoEWhisperNotifier/Content/credits.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Notify.wav is a renamed sound part of the Notifications Pack created by FoolBoyMedia at https://www.freesound.org/people/FoolBoyMedia/sounds/234564/.
The sound is licensed under the Creative Commons Attribution Non-Commercial License.
Please see http://creativecommons.org/licenses/by-nc/3.0/ for the license details.
Please see http://creativecommons.org/licenses/by-nc/3.0/ for the license details.

The application icon (Chat.ico) is originally part of the Crysigns Icon Pack created by edesigner (http://www.crystalxp.net/galerie/en.id.15794-crysigns-asher-icons-a-png.htm)
The icons are allowed for non-commercial use only.
34 changes: 28 additions & 6 deletions PoEWhisperNotifier/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 45 additions & 3 deletions PoEWhisperNotifier/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ struct LASTINPUTINFO {

public Main() {
InitializeComponent();
NotificationIcon.Icon = SystemIcons.Information;
NotificationIcon.Icon = this.Icon;
}

private void Form1_Load(object sender, EventArgs e) {
NotificationIcon.Visible = Settings.Default.TrayNotifications;
NotificationIcon.Visible = Settings.Default.TrayNotifications || Settings.Default.MinimizeToTray;
NotificationIcon.BalloonTipClicked += NotificationIconClick;
NotificationIcon.DoubleClick += NotificationIconClick;
txtLogPath.TextChanged += txtLogPath_TextChanged;
txtLogPath.Click += txtLogPath_Click;
txtLogPath.Text = Settings.Default.LogPath;
Expand All @@ -50,6 +52,29 @@ private void Form1_Load(object sender, EventArgs e) {
tsmEnableSMTPNotifications.Checked = Settings.Default.EnableSmtpNotifications;
tsmEnablePushBullet.Checked = Settings.Default.EnablePushbullet;
tsmEnableSound.Checked = Settings.Default.EnableSound;
tsmAutoStart.Checked = Settings.Default.AutoStartWhenOpened;
tsmMinimizeToTray.Checked = Settings.Default.MinimizeToTray;
this.Resize += Main_Resize;

if(Settings.Default.AutoStartWhenOpened)
Start();
}

private void NotificationIconClick(object sender, EventArgs e) {
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.Show();
}

void Main_Resize(object sender, EventArgs e) {
if(Settings.Default.MinimizeToTray) {
if(this.WindowState == FormWindowState.Minimized) {
this.Visible = false;
NotificationIcon.Visible = true;
} else {
this.Visible = true;
}
}
}

void txtLogPath_Click(object sender, EventArgs e) {
Expand All @@ -75,6 +100,10 @@ void txtLogPath_TextChanged(object sender, EventArgs e) {
}

private void cmdStart_Click(object sender, EventArgs e) {
Start();
}

private void Start() {
if(!LogMonitor.IsValidLogPath(txtLogPath.Text)) {
MessageBox.Show("The log path you have entered is invalid. Please select the client.txt file located in the PoE folder.");
return;
Expand Down Expand Up @@ -195,7 +224,7 @@ private void tsmEnableTrayNotifications_Click(object sender, EventArgs e) {
tsmEnableTrayNotifications.Checked = !tsmEnableTrayNotifications.Checked;
Settings.Default.TrayNotifications = tsmEnableTrayNotifications.Checked;
Settings.Default.Save();
NotificationIcon.Visible = Settings.Default.TrayNotifications;
NotificationIcon.Visible = Settings.Default.TrayNotifications || Settings.Default.MinimizeToTray;
}

private void tsmEnableSound_Click(object sender, EventArgs e) {
Expand All @@ -204,6 +233,19 @@ private void tsmEnableSound_Click(object sender, EventArgs e) {
Settings.Default.Save();
}

private void tsmAutoStart_Click(object sender, EventArgs e) {
tsmAutoStart.Checked = !tsmAutoStart.Checked;
Settings.Default.AutoStartWhenOpened = tsmAutoStart.Checked;
Settings.Default.Save();
}

private void tsmMinimizeToTray_Click(object sender, EventArgs e) {
tsmMinimizeToTray.Checked = !tsmMinimizeToTray.Checked;
Settings.Default.MinimizeToTray = tsmMinimizeToTray.Checked;
Settings.Default.Save();
NotificationIcon.Visible = Settings.Default.TrayNotifications || Settings.Default.MinimizeToTray;
}

// TODO: Merge common functionality below, and ideally of most of these enable buttons too.

private void tsmEnablePushbullet_Click(object sender, EventArgs e) {
Expand Down
Loading

0 comments on commit 8f88c1d

Please sign in to comment.