public void SetUpdateNotification(object sender, EventArgs widgetEvent) { switch (UpdateControlData.Instance.UpdateStatus) { case UpdateControlData.UpdateStatusStates.MayBeAvailable: { popUpAboutPage.RemoveAllChildren(); Button updateStatusMessage = linkButtonFactory.Generate("Check For Update".Localize()); updateStatusMessage.Click += (sender2, e) => { UiThread.RunOnIdle(CheckForUpdateWindow.Show); }; popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; } break; case UpdateControlData.UpdateStatusStates.ReadyToInstall: case UpdateControlData.UpdateStatusStates.UpdateAvailable: case UpdateControlData.UpdateStatusStates.UpdateDownloading: { popUpAboutPage.RemoveAllChildren(); Button updateStatusMessage = linkButtonFactory.Generate("Update Available".Localize()); updateStatusMessage.Click += (sender2, e) => { UiThread.RunOnIdle(CheckForUpdateWindow.Show); }; var updateMark = new UpdateNotificationMark(); updateMark.Margin = new BorderDouble(0, 0, 3, 2); updateMark.VAnchor = VAnchor.ParentTop; popUpAboutPage.AddChild(updateMark); popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; } break; case UpdateControlData.UpdateStatusStates.UpToDate: if (AlwaysShowUpdateStatus) { popUpAboutPage.RemoveAllChildren(); TextWidget updateStatusMessage = new TextWidget("Up to Date".Localize(), textColor: linkButtonFactory.textColor, pointSize: linkButtonFactory.fontSize); updateStatusMessage.VAnchor = VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; UiThread.RunOnIdle((state) => popUpAboutPage.Visible = false, 3); AlwaysShowUpdateStatus = false; } else { popUpAboutPage.Visible = false; } break; case UpdateControlData.UpdateStatusStates.CheckingForUpdate: if (AlwaysShowUpdateStatus) { popUpAboutPage.RemoveAllChildren(); TextWidget updateStatusMessage = new TextWidget("Checking For Update...".Localize(), textColor: linkButtonFactory.textColor, pointSize: linkButtonFactory.fontSize); updateStatusMessage.VAnchor = VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; } else { popUpAboutPage.Visible = false; } break; default: throw new NotImplementedException(); } }
public void SetUpdateNotification(object sender, EventArgs widgetEvent) { switch (UpdateControlData.Instance.UpdateStatus) { case UpdateControlData.UpdateStatusStates.MayBeAvailable: { popUpAboutPage.RemoveAllChildren(); Button updateStatusMessage = linkButtonFactory.Generate("Check For Update".Localize()); updateStatusMessage.Click += (sender2, e) => { UiThread.RunOnIdle(CheckForUpdateWindow.Show); }; popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; } break; case UpdateControlData.UpdateStatusStates.ReadyToInstall: case UpdateControlData.UpdateStatusStates.UpdateAvailable: case UpdateControlData.UpdateStatusStates.UpdateDownloading: { popUpAboutPage.RemoveAllChildren(); Button updateStatusMessage = linkButtonFactory.Generate("Update Available".Localize()); updateStatusMessage.Click += (sender2, e) => { UiThread.RunOnIdle(CheckForUpdateWindow.Show); }; var updateMark = new UpdateNotificationMark(); updateMark.Margin = new BorderDouble(0, 0, 3, 2); updateMark.VAnchor = VAnchor.ParentTop; popUpAboutPage.AddChild(updateMark); popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; } break; case UpdateControlData.UpdateStatusStates.UpToDate: if (AlwaysShowUpdateStatus) { popUpAboutPage.RemoveAllChildren(); TextWidget updateStatusMessage = new TextWidget("Up to Date".Localize(), textColor: linkButtonFactory.textColor, pointSize: linkButtonFactory.fontSize); updateStatusMessage.VAnchor = VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; UiThread.RunOnIdle((state) => popUpAboutPage.Visible = false, 3); AlwaysShowUpdateStatus = false; } else { popUpAboutPage.Visible = false; } break; case UpdateControlData.UpdateStatusStates.CheckingForUpdate: if (AlwaysShowUpdateStatus) { popUpAboutPage.RemoveAllChildren(); TextWidget updateStatusMessage = new TextWidget("Checking For Update...".Localize(), textColor: linkButtonFactory.textColor, pointSize: linkButtonFactory.fontSize); updateStatusMessage.VAnchor = VAnchor.ParentCenter; popUpAboutPage.AddChild(updateStatusMessage); popUpAboutPage.Visible = true; } else { popUpAboutPage.Visible = false; } break; default: throw new NotImplementedException(); } }