Skip to content

Commit ab11161

Browse files
committed
chore: Allow users to visit update site from update dialog
1 parent 70f03ba commit ab11161

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

Buttplug.Components.Controls/ButtplugAboutControl.xaml.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
using System.Windows;
66
using System.Windows.Controls;
77
using System.Windows.Documents;
8+
using System.Windows.Forms;
89
using System.Windows.Input;
910
using Buttplug.Core;
1011
using JetBrains.Annotations;
1112
using Newtonsoft.Json.Linq;
13+
using Application = System.Windows.Application;
14+
using MessageBox = System.Windows.MessageBox;
15+
using TabControl = System.Windows.Controls.TabControl;
1216

1317
namespace Buttplug.Components.Controls
1418
{
@@ -109,7 +113,7 @@ public void CheckUpdate([NotNull] ButtplugConfig config, [NotNull] string appNam
109113
var check = _config.GetValue(appName + ".updateCheck");
110114
if (check == null)
111115
{
112-
var result = MessageBox.Show("Do you want Buttplug to automaticaly check for updates on start?", "Update Checking", MessageBoxButton.YesNo);
116+
var result = System.Windows.MessageBox.Show("Do you want Buttplug to automatically check for updates on start?", "Update Checking", MessageBoxButton.YesNo, MessageBoxImage.Asterisk);
113117
check = result == MessageBoxResult.Yes ? "true" : "false";
114118
_config.SetValue(appName + ".updateCheck", check);
115119
}
@@ -177,12 +181,13 @@ private void CheckForUpdates_Click(object sender, RoutedEventArgs e)
177181
{
178182
// Update available
179183
UpdateCheckStatus.Text = "Update Available! (" + DateTime.Now.ToString() + ")";
184+
Hyperlink hyperlink = null;
180185
try
181186
{
182187
var location = json[_appName]["location"]?.ToString();
183188
if (location != null)
184189
{
185-
var hyperlink = new Hyperlink(new Run(location))
190+
hyperlink = new Hyperlink(new Run(location))
186191
{
187192
NavigateUri = new Uri(location),
188193
};
@@ -196,7 +201,14 @@ private void CheckForUpdates_Click(object sender, RoutedEventArgs e)
196201
// noop - there was an update, we just don't know where
197202
}
198203

199-
MessageBox.Show("A new buttplug update is available!", "Buttplug Update");
204+
if (MessageBox.Show("A new buttplug update is available! Would you like to go to the update site?",
205+
"Buttplug Update",
206+
MessageBoxButton.YesNo,
207+
MessageBoxImage.Asterisk) == MessageBoxResult.Yes)
208+
{
209+
hyperlink?.DoClick();
210+
}
211+
200212
try
201213
{
202214
((TabControl)((TabItem)Parent).Parent).SelectedItem = Parent;

0 commit comments

Comments
 (0)