Skip to content

Commit d714b11

Browse files
committed
removes redundant labels for What's New and Update Check Failed
1 parent 0f6de51 commit d714b11

File tree

3 files changed

+20
-82
lines changed

3 files changed

+20
-82
lines changed

Source/Menu/MainForm.Designer.cs

Lines changed: 0 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Menu/MainForm.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,6 @@ void CheckForUpdate()
316316
return null;
317317
}, _ =>
318318
{
319-
if (UpdateManager.LastCheckError != null)
320-
{
321-
linkLabelUpdate.Text = catalog.GetString("Update check failed");
322-
linkLabelChangeLog.Visible = true;
323-
}
324319
NotificationManager.CheckNotifications();
325320
});
326321
}
@@ -511,27 +506,6 @@ bool CheckUserName(string text)
511506
#endregion
512507

513508
#region Misc. buttons and options
514-
void linkLabelUpdate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
515-
{
516-
if (UpdateManager.LastCheckError != null)
517-
{
518-
MessageBox.Show(catalog.GetStringFmt("The update check failed due to an error:\n\n{0}", UpdateManager.LastCheckError), Application.ProductName);
519-
return;
520-
}
521-
522-
UpdateManager.Update();
523-
524-
if (UpdateManager.LastUpdateError != null)
525-
{
526-
MessageBox.Show(catalog.GetStringFmt("The update failed due to an error:\n\n{0}", UpdateManager.LastUpdateError), Application.ProductName);
527-
return;
528-
}
529-
}
530-
531-
void linkLabelChangeLog_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
532-
{
533-
Process.Start(UpdateManager.ChangeLogLink);
534-
}
535509

536510
void buttonTools_Click(object sender, EventArgs e)
537511
{

Source/Menu/Notifications/NotificationManager.cs

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -126,26 +126,23 @@ void SetUpdateNotificationPage()
126126
if (UpdateManager.LastCheckError != null || Error != null)
127127
{
128128
NewPageCount = 0;
129-
//if (ArePagesVisible)
130-
{
131-
var message = (UpdateManager.LastCheckError != null)
132-
? UpdateManager.LastCheckError.Message
133-
: Error.Message;
134-
135-
// Reports notifications are not available.
136-
var channelName = UpdateManager.ChannelName == "" ? "None" : UpdateManager.ChannelName;
137-
var today = DateTime.Now.Date;
138-
new NTitleControl(page, 1, 1, $"{today:dd-MMM-yy}", "Notifications are not available").Add();
139-
new NRecordControl(page, "Update mode", 140, channelName).Add();
140-
new NRecordControl(page, "Installed version", 140, VersionInfo.VersionOrBuild).Add();
141-
142-
new NHeadingControl(page, "Notifications are not available", "red").Add();
143-
new NTextControl(page, $"Error: {message}").Add();
144-
new NTextControl(page, "Is your Internet connected?").Add();
145-
146-
new NRetryControl(page, "Retry", 140, "Try again to fetch notifications", MainForm).Add();
147-
PageList.Add(page);
148-
}
129+
var message = (UpdateManager.LastCheckError != null)
130+
? UpdateManager.LastCheckError.Message
131+
: Error.Message;
132+
133+
// Reports notifications are not available.
134+
var channelName = UpdateManager.ChannelName == "" ? "None" : UpdateManager.ChannelName;
135+
var today = DateTime.Now.Date;
136+
new NTitleControl(page, 1, 1, $"{today:dd-MMM-yy}", "Notifications are not available").Add();
137+
new NRecordControl(page, "Update mode", 140, channelName).Add();
138+
new NRecordControl(page, "Installed version", 140, VersionInfo.VersionOrBuild).Add();
139+
140+
new NHeadingControl(page, "Notifications are not available", "red").Add();
141+
new NTextControl(page, $"Error: {message}").Add();
142+
new NTextControl(page, "Is your Internet connected?").Add();
143+
144+
new NRetryControl(page, "Retry", 140, "Try again to fetch notifications", MainForm).Add();
145+
PageList.Add(page);
149146
return;
150147
}
151148

@@ -206,12 +203,6 @@ void SetUpdateNotificationPage()
206203
PageList.Add(page);
207204
}
208205

209-
//private bool IsUpdateAvailable()
210-
//{
211-
// return UpdateManager.LastUpdate != null
212-
// && UpdateManager.LastUpdate.Version != VersionInfo.Version;
213-
//}
214-
215206
private void AddItemToPage(NotificationPage page, Item item)
216207
{
217208
if (item is Record record)
@@ -238,6 +229,7 @@ private void AddItemToPage(NotificationPage page, Item item)
238229

239230
/// <summary>
240231
/// Returns any check that fails.
232+
/// (Could be extended to include other SystemInfo values.)
241233
/// </summary>
242234
/// <param name="check"></param>
243235
/// <returns></returns>
@@ -270,6 +262,7 @@ private Check CheckExcludes(Check check)
270262

271263
/// <summary>
272264
/// Returns any check that succeeds.
265+
/// (Could be extended to include other SystemInfo values.)
273266
/// </summary>
274267
/// <param name="check"></param>
275268
/// <returns></returns>
@@ -318,7 +311,7 @@ public void DropUnusedUpdateNotifications()
318311
if (updateModeSetting == "" && lowerUpdateMode == "stable")
319312
continue;
320313

321-
// Mark unused updates for deletion
314+
// Mark unused updates for deletion outside loop
322315
n.ToDelete = lowerUpdateMode != updateModeSetting;
323316
}
324317
Notifications.NotificationList.RemoveAll(n => n.ToDelete);

0 commit comments

Comments
 (0)