public void CheckForUpdates(bool IsManual) { UpdateController UpdContr = new UpdateController(); UpdContr.CheckForUpdatesAsync(); UpdContr.CheckingComplete += (sender, IsAvailabe) => { double factor = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11; if (IsAvailabe) { TrayIcon.ShowBalloonTip("New Version is Available: " + UpdContr.NewVersionString, UpdContr.Description + " Click here to see more.", new Icon(Properties.Resources.updateIcon, new System.Drawing.Size(Convert.ToInt32(40 * factor), Convert.ToInt32(40 * factor))), true); } else if (!IsAvailabe && IsManual) { TrayIcon.ShowBalloonTip("No Updates Available", "You are using latest version.", new Icon(Properties.Resources.updateIcon, new System.Drawing.Size(Convert.ToInt32(40 * factor), Convert.ToInt32(40 * factor))), true); } }; }
public void Window_Loaded() { UpdateController UpdCtr = new UpdateController(); UpdCtr.CheckingComplete += (sender, IsAvailabe) => { if (IsAvailabe) { ChangeLogUrl = UpdCtr.ChangeLogUrl; DownloadUrl = UpdCtr.DownloadUrl; Description = DescLabel.Text = UpdCtr.Description; Version = VersionLabel.Text = UpdCtr.NewVersionString; Show(); } else { Close(); } }; UpdCtr.CheckForUpdatesAsync(); }