Major overhaul #2

Merged
alexhorner merged 14 commits from master into master 2022-12-08 08:13:17 -05:00
18 changed files with 1078 additions and 797 deletions
Showing only changes of commit fe4ae354b2 - Show all commits

View File

@@ -1,7 +1,7 @@
 
namespace ntfysh_client namespace ntfysh_client
{ {
partial class Form1 partial class MainForm
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -30,7 +30,7 @@ namespace ntfysh_client
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.subscribeNewTopic = new System.Windows.Forms.Button(); this.subscribeNewTopic = new System.Windows.Forms.Button();
this.removeSelectedTopics = new System.Windows.Forms.Button(); this.removeSelectedTopics = new System.Windows.Forms.Button();
this.notificationTopics = new System.Windows.Forms.ListBox(); this.notificationTopics = new System.Windows.Forms.ListBox();
@@ -192,7 +192,7 @@ namespace ntfysh_client
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "Subscribed Notification Topics:"; this.label1.Text = "Subscribed Notification Topics:";
// //
// Form1 // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -210,12 +210,12 @@ namespace ntfysh_client
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "Form1"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ntfy.sh"; this.Text = "ntfy.sh";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.MainForm_Load);
this.trayContextMenu.ResumeLayout(false); this.trayContextMenu.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();

View File

@@ -1,25 +1,21 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace ntfysh_client namespace ntfysh_client
{ {
public partial class Form1 : Form public partial class MainForm : Form
{ {
private readonly NotificationListener _notificationListener; private readonly NotificationListener _notificationListener;
private bool _trueExit; private bool _trueExit;
public Form1(NotificationListener notificationListener) public MainForm(NotificationListener notificationListener)
{ {
_notificationListener = notificationListener; _notificationListener = notificationListener;
_notificationListener.OnNotificationReceive += OnNotificationReceive; _notificationListener.OnNotificationReceive += OnNotificationReceive;
@@ -27,7 +23,7 @@ namespace ntfysh_client
InitializeComponent(); InitializeComponent();
} }
private void Form1_Load(object sender, EventArgs e) => LoadTopics(); private void MainForm_Load(object sender, EventArgs e) => LoadTopics();
private void subscribeNewTopic_Click(object sender, EventArgs e) private void subscribeNewTopic_Click(object sender, EventArgs e)
{ {
@@ -181,12 +177,12 @@ namespace ntfysh_client
notifyIcon.ShowBalloonTip(3000, e.Title, e.Message, ToolTipIcon.Info); notifyIcon.ShowBalloonTip(3000, e.Title, e.Message, ToolTipIcon.Info);
} }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
{ {
notifyIcon.Dispose(); notifyIcon.Dispose();
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{ {
// Let it close // Let it close
if (_trueExit) return; if (_trueExit) return;

View File

@@ -19,7 +19,7 @@ namespace ntfysh_client
Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(NotificationListener)); Application.Run(new MainForm(NotificationListener));
} }
} }
} }

View File

@@ -7,14 +7,11 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ApplicationIcon>NotificationHub.ico</ApplicationIcon> <ApplicationIcon>NotificationHub.ico</ApplicationIcon>
<StartupObject>ntfysh_client.Program</StartupObject>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Properties" />
</ItemGroup>
</Project> </Project>