Пример #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            Preferences.Init();

            MainWindow window = new MainWindow();

            window.Show();

            if (Preferences.PromptWhenUpdatesAreAvailable == true)
            {
                Updates.CheckForUpdates();
            }
        }
Пример #2
0
        private void HelpCheckForUpdates_Click(object sender, RoutedEventArgs e)
        {
            string updates = Updates.CheckForUpdates();

            switch (updates)
            {
            case "false":
                GetInput.ShowInfoDialog("ChromebookGUI Updater", "No updates available", "This product, ChromebookGUI by iamtheyammer, is up to date. You are running " + Software.Type + " " + Software.Version + ".");
                return;

            case "true":
                return;
                //case "error":
                //    GetInput.ShowInfoDialog("ChromebookGUI Updater", "Error checking for updates.", "There was an error checking for updates."); // this should never happen!
                //    return;
            }
        }
Пример #3
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            IDisposable sentry = SentrySdk.Init(o =>
            {
                o.Dsn     = new Dsn("https://[email protected]/1457501");
                o.Release = Software.Version;
                if (Debug.IsDebugMode())
                {
                    o.Debug = true;
                }
                o.BeforeSend = ((arg) => { Console.WriteLine("Sending..."); return(arg); });
            });

            SentrySdk.ConfigureScope((scope) =>
            {
                scope.SetTag("software-type", Software.Type);
            });

            try
            {
                Preferences.Init();
                Task.Run(() => AutoComplete.Init());

                MainWindow window = new MainWindow();
                window.Show();

                if (Preferences.PromptWhenUpdatesAreAvailable == true)
                {
                    Updates.CheckForUpdates();
                }
            }
            catch (Exception err)
            {
                if (Debug.IsDebugMode() == true)
                {
                    throw;
                }
                Debug.CaptureException(err);
            }
        }
Пример #4
0
        /// <summary>
        /// Returns "true" if an update is available, "false" if one is not and "error" if there was an error.
        /// String because I need more options. If a new update is available or there was an error it already opens a dialog!
        /// </summary>
        /// <returns></returns>
        public static string CheckForUpdates()
        {
            Dictionary <string, string> isNewestVersion = Updates.IsNewestVersion();

            if (isNewestVersion["isNewestVersion"] == "false")
            {
                bool extraButtonPressed = GetInput.ShowInfoDialog(
                    "Update Available",
                    "An update for this app is currently available.",
                    "You are running " + Software.Type + " " + Software.Version + " and the newest version is " + isNewestVersion["newestVersion"] + ".\nClick the button on the bottom left to upgrade.\n\nNew in version " + isNewestVersion["newestVersion"] + ":\n" + isNewestVersion["changes"],
                    new Button {
                    IsEnabled = true, Text = "Download newest build"
                });
                if (extraButtonPressed)
                {
                    switch (Software.Type)
                    {
                    case "alpha":
                        Process.Start("https://github.com/iamtheyammer/gam-cros-win-wrapper/raw/master/ChromebookGUI/Installer/Tool+Installer/Installer.msi");
                        break;

                    default:
                        Process.Start("https://github.com/iamtheyammer/releases/latest");
                        break;
                    }
                }
                return("true");
            }
            else if (isNewestVersion["isNewestVersion"] == "error")
            {
                return("error");
                // nothing
            }
            else
            {
                return("false");
                // nothing
            }
        }