Beispiel #1
0
 public UpdateForm(AudioSwitcherVersionInfo vi)
 {
     InitializeComponent();
     url = vi.URL;
     changelog = vi.ChangeLog;
     toolTip1.SetToolTip(linkLabel1, url);
 }
        private void CheckForNewVersion()
        {
            statusLabelUpdate.Visible = false;

            using (var client = ConnectionHelper.GetAudioSwitcherProxy())
            {
                if (client == null)
                    return;

                _retrievedVersion = client.GetUpdateInfo(AssemblyVersion);

                if (_retrievedVersion != null && !string.IsNullOrEmpty(_retrievedVersion.URL))
                {
                    _updateAvailable = true;
                    statusLabelUpdate.Visible = true;
                    statusLabelUpdate.ToolTipText = "New Version Available - " + _retrievedVersion.VersionInfo;

                    BeginInvoke(new Action(RefreshNotifyIconItems));

                    if (Program.Settings.UpdateNotificationsEnabled)
                        ShowUpdateNotification(_retrievedVersion);
                }
            }
        }
        private void CheckForUpdates(object o, EventArgs ae)
        {
            try
            {
                using (AudioSwitcherService.AudioSwitcher client = ConnectionHelper.GetAudioSwitcherProxy())
                {
                    if (client == null)
                        return;

                    retrievedVersion = client.GetUpdateInfo(AssemblyVersion);
                    if (retrievedVersion != null && !string.IsNullOrEmpty(retrievedVersion.URL))
                    {
                        notifyIcon1.BalloonTipText = "Click here to download.";
                        notifyIcon1.BalloonTipTitle = "New version available.";
                        notifyIcon1.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
                        notifyIcon1.ShowBalloonTip(3000);
                    }
                }
            }
            catch
            {
            }
        }
        private void ShowUpdateNotification(AudioSwitcherVersionInfo retrievedVersion)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action(() => ShowUpdateNotification(retrievedVersion)));
                return;
            }

            notifyIcon1.BalloonTipText = "Click here to update to " + retrievedVersion.VersionInfo;
            notifyIcon1.BalloonTipTitle = "Audio Switcher Update";
            notifyIcon1.BalloonTipClicked += (s, e) =>
            {
                ShowUpdateForm();
            };

            notifyIcon1.ShowBalloonTip(3000);
        }