Winify

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 47  →  ?path2? @ 48
/trunk/Winify/AboutForm.Designer.cs
@@ -8,19 +8,6 @@
/// </summary>
private System.ComponentModel.IContainer components = null;
 
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
 
#region Windows Form Designer generated code
 
/// <summary>
/trunk/Winify/AboutForm.cs
@@ -1,18 +1,49 @@
using System.Windows.Forms;
using System;
using System.Threading;
using System.Windows.Forms;
 
namespace Winify
{
public partial class AboutForm : Form
{
#region Event Handlers
 
private void AboutForm_Shown(object sender, EventArgs e)
{
VersionTextBox.Text = $"{Constants.AssemblyName} v.{Constants.AssemblyVersion}";
}
 
#endregion
 
#region Constructors, Destructors and Finalizers
 
public AboutForm()
{
InitializeComponent();
 
Utilities.WindowState.FormTracker.Track(this);
}
 
public AboutForm(CancellationToken cancellationToken) : this()
{
Shown += AboutForm_Shown;
}
 
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
 
Shown -= AboutForm_Shown;
 
base.Dispose(disposing);
}
 
#endregion
}
}
/trunk/Winify/Gotify/GotifyConnection.cs
@@ -110,11 +110,17 @@
_cancellationTokenSource = null;
}
 
_webSocketSharp.Close();
_webSocketSharp = null;
if (_webSocketSharp != null)
{
_webSocketSharp.Close();
_webSocketSharp = null;
}
 
_httpClient.Dispose();
_httpClient = null;
if (_httpClient != null)
{
_httpClient.Dispose();
_httpClient = null;
}
}
 
#endregion
@@ -160,16 +166,18 @@
 
private void WebSocketSharp_OnClose(object sender, CloseEventArgs e)
{
Log.Information($"Connection to server closed with reason: {e.Reason}");
Log.Information($"WebSockets connection to server {_webSocketsUri.AbsoluteUri} closed with reason {e.Reason}.");
}
 
private void WebSocketSharp_OnOpen(object sender, EventArgs e)
{
Log.Information("Connection to server is now open.");
Log.Information($"WebSockets connection to server {_webSocketsUri.AbsoluteUri} is now open.");
}
 
private async void WebSocketSharp_OnError(object sender, ErrorEventArgs e)
{
Log.Error($"Connection to WebSockets server {_webSocketsUri.AbsoluteUri} terminated unexpectedly with message {e.Message}.", e.Exception);
 
if (_cancellationToken.IsCancellationRequested)
{
Stop();
@@ -177,7 +185,7 @@
}
 
await Task.Delay(TimeSpan.FromSeconds(1), _cancellationToken);
Log.Information("Reconnecting to websocket server.");
Log.Information($"Reconnecting to websocket server {_webSocketsUri.AbsoluteUri}.");
 
Connect();
}
/trunk/Winify/MainForm.cs
@@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading;
@@ -102,7 +103,8 @@
new Ed25519Checker(SecurityMode.Strict, "LonrgxVjSF0GnY4hzwlRJnLkaxnDn2ikdmOifILzLJY="))
{
UIFactory = new UIFactory(icon),
RelaunchAfterUpdate = true
RelaunchAfterUpdate = true,
SecurityProtocolType = SecurityProtocolType.Tls12
};
_sparkle.StartLoop(true, true);
}
@@ -234,6 +236,7 @@
{
// Manually check for updates, this will not show a ui
var result = await _sparkle.CheckForUpdatesQuietly();
var updates = result.Updates;
if (result.Status == UpdateStatus.UpdateAvailable)
{
// if update(s) are found, then we have to trigger the UI to show it gracefully
/trunk/Winify/Settings/SettingsForm.cs
@@ -5,6 +5,7 @@
using Announcements;
using Servers;
using Winify.Utilities;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 
namespace Winify.Settings
{
@@ -119,12 +120,10 @@
private void Button1_Click(object sender, EventArgs e)
{
var server = new Server();
server.Name = serverNameTextBox.Text;
server.Url = serverUrlTextBox.Text;
server.Username = serverUsernameTextBox.Text;
server.Password = serverPasswordTextBox.Text;
server.Name = "New Server";
 
_servers.Server.Add(server);
_serverBindingSource.DataSource = server;
 
Save?.Invoke(this, new SettingsSavedEventArgs(_servers, _announcements));
 
@@ -133,12 +132,32 @@
 
private void Button2_Click(object sender, EventArgs e)
{
if (listBox1.SelectedItem is Server server) _servers.Server.Remove(server);
var index = -1;
 
if (listBox1.SelectedItem is Server server)
{
index = listBox1.Items.IndexOf(server);
_servers.Server.Remove(server);
}
 
if (index >= listBox1.Items.Count)
{
--index;
}
 
listBox1.SelectedIndex = index;
}
 
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
var listBox = (ListBox)sender;
if (listBox.SelectedIndex == -1)
{
_serverBindingSource.DataSource = new
{ Name = string.Empty, Url = string.Empty, Username = string.Empty, Password = string.Empty };
return;
}
 
if (listBox.SelectedItem is Server server)
{