mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Rework notification handling, make Job ID copyable
This commit is contained in:
parent
cfd47fffee
commit
8cd6690a33
@ -52,6 +52,8 @@ namespace Bloxstrap
|
|||||||
public static readonly FastFlagManager FastFlags = new();
|
public static readonly FastFlagManager FastFlags = new();
|
||||||
public static readonly HttpClient HttpClient = new(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All });
|
public static readonly HttpClient HttpClient = new(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All });
|
||||||
|
|
||||||
|
public static System.Windows.Forms.NotifyIcon Notification { get; private set; } = null!;
|
||||||
|
|
||||||
// shorthand
|
// shorthand
|
||||||
public static MessageBoxResult ShowMessageBox(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK)
|
public static MessageBoxResult ShowMessageBox(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK)
|
||||||
{
|
{
|
||||||
@ -155,6 +157,18 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// so this needs to be here because winforms moment
|
||||||
|
// onclick events will not fire unless this is defined here in the main thread so uhhhhh
|
||||||
|
// we'll show the icon if we're launching roblox since we're likely gonna be showing a
|
||||||
|
// bunch of notifications, and always showing it just makes the most sense i guess since it
|
||||||
|
// indicates that bloxstrap is running, even in the background
|
||||||
|
Notification = new()
|
||||||
|
{
|
||||||
|
Icon = Bloxstrap.Properties.Resources.IconBloxstrap,
|
||||||
|
Text = ProjectName,
|
||||||
|
Visible = !IsMenuLaunch
|
||||||
|
};
|
||||||
|
|
||||||
// todo: remove this once 32-bit support is fully gone
|
// todo: remove this once 32-bit support is fully gone
|
||||||
if (!App.IsQuiet && !Environment.Is64BitOperatingSystem)
|
if (!App.IsQuiet && !Environment.Is64BitOperatingSystem)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows;
|
||||||
|
|
||||||
using Bloxstrap.Properties;
|
|
||||||
|
|
||||||
namespace Bloxstrap.Integrations
|
namespace Bloxstrap.Integrations
|
||||||
{
|
{
|
||||||
@ -42,23 +39,19 @@ namespace Bloxstrap.Integrations
|
|||||||
else
|
else
|
||||||
message = $"Location: {locationCity}, {locationRegion}, {locationCountry}";
|
message = $"Location: {locationCity}, {locationRegion}, {locationCountry}";
|
||||||
|
|
||||||
if (_activityWatcher.ActivityMachineUDMUX)
|
message += "\nClick to copy Job ID";
|
||||||
message += "\nServer is UDMUX protected";
|
|
||||||
|
|
||||||
App.Logger.WriteLine($"[ServerNotifier::Notify] {message.ReplaceLineEndings("\\n")}");
|
App.Logger.WriteLine($"[ServerNotifier::Notify] {message.ReplaceLineEndings("\\n")}");
|
||||||
|
|
||||||
NotifyIcon notification = new()
|
EventHandler JobIDCopier = new((_, _) => Clipboard.SetText(_activityWatcher.ActivityJobId));
|
||||||
{
|
|
||||||
Icon = Resources.IconBloxstrap,
|
App.Notification.BalloonTipTitle = "Connected to server";
|
||||||
Text = "Bloxstrap",
|
App.Notification.BalloonTipText = message;
|
||||||
Visible = true,
|
App.Notification.BalloonTipClicked += JobIDCopier;
|
||||||
BalloonTipTitle = "Connected to server",
|
App.Notification.ShowBalloonTip(10);
|
||||||
BalloonTipText = message
|
|
||||||
};
|
|
||||||
|
|
||||||
notification.ShowBalloonTip(10);
|
|
||||||
await Task.Delay(10000);
|
await Task.Delay(10000);
|
||||||
notification.Dispose();
|
App.Notification.BalloonTipClicked -= JobIDCopier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,22 +80,17 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
if (isAutoUpgrade)
|
if (isAutoUpgrade)
|
||||||
{
|
{
|
||||||
NotifyIcon notification = new()
|
EventHandler ReleaseNotesLauncher = new((_, _) => Utilities.OpenWebsite($"https://github.com/{App.ProjectRepository}/releases/tag/v{currentVersionInfo.ProductVersion}"));
|
||||||
{
|
|
||||||
Icon = Resources.IconBloxstrap,
|
|
||||||
Text = "Bloxstrap",
|
|
||||||
Visible = true,
|
|
||||||
BalloonTipTitle = $"Bloxstrap has been upgraded to v{currentVersionInfo.ProductVersion}",
|
|
||||||
BalloonTipText = "Click here to see what's new in this version"
|
|
||||||
};
|
|
||||||
|
|
||||||
notification.BalloonTipClicked += (_, _) => Utilities.OpenWebsite($"https://github.com/{App.ProjectRepository}/releases/tag/v{currentVersionInfo.ProductVersion}");
|
App.Notification.BalloonTipTitle = "Bloxstrap has been upgraded to v{currentVersionInfo.ProductVersion}";
|
||||||
notification.ShowBalloonTip(30);
|
App.Notification.BalloonTipText = "Click here to see what's new in this version";
|
||||||
|
App.Notification.BalloonTipClicked += ReleaseNotesLauncher;
|
||||||
|
App.Notification.ShowBalloonTip(30);
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
Task.Delay(30000).Wait();
|
await Task.Delay(30000);
|
||||||
notification.Dispose();
|
App.Notification.BalloonTipClicked -= ReleaseNotesLauncher;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (!App.IsQuiet)
|
else if (!App.IsQuiet)
|
||||||
|
Loading…
Reference in New Issue
Block a user