Esempio n. 1
0
        public void StartUpdateCheck(bool userInitiated)
        {
            ManualUpdateCheck = userInitiated;

            if (updateChecker != null)
            {
                if (ManualUpdateCheck)
                    tabsConsole.DisplayNotificationInChat("Update check already in progress.");
                return;
            }

            if (ManualUpdateCheck)
                tabsConsole.DisplayNotificationInChat("Checking for updates...", ChatBufferTextStyle.StatusBlue);
            updateChecker = new UpdateChecker();
            updateChecker.OnUpdateInfoReceived += new UpdateChecker.UpdateInfoCallback(OnUpdateInfoReceived);
            updateChecker.StartCheck();
        }
Esempio n. 2
0
        void OnUpdateInfoReceived(object sender, UpdateCheckerArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => OnUpdateInfoReceived(sender, e)));
                return;
            }

            if (!e.Success)
            {
                if (ManualUpdateCheck)
                    tabsConsole.DisplayNotificationInChat("Error: Failed connecting to the update site.", ChatBufferTextStyle.StatusBlue);
            }
            else
            {
                if (!ManualUpdateCheck && e.Info.DisplayMOTD)
                {
                    tabsConsole.DisplayNotificationInChat(e.Info.MOTD, ChatBufferTextStyle.StatusBlue);
                }

                if (e.Info.UpdateAvailable)
                {
                    tabsConsole.DisplayNotificationInChat("New version available at " + e.Info.DownloadSite, ChatBufferTextStyle.Alert);
                }
                else
                {
                    if (ManualUpdateCheck)
                        tabsConsole.DisplayNotificationInChat("Your version is up to date.", ChatBufferTextStyle.StatusBlue);
                }
            }

            updateChecker.Dispose();
            updateChecker = null;
        }