Пример #1
0
        public static void ProductUpdateDaylyDetection()
        {
            // Pending: As in Paint.NET, force to be execute only once per day (not per execution).
            try
            {
                var LastDetection = AppExec.GetConfiguration <DateTime>("Application", "LastUpdateCheck");
                if (LastDetection.Date >= DateTime.Now.Date)
                {
                    return;
                }

                if (File.Exists(ProductDirector.LocalVersioningSource))
                {
                    File.Delete(ProductDirector.LocalVersioningSource);
                }

                General.DownloadFileAsync(new Uri(ProductDirector.VERSIONING_SOURCE, UriKind.Absolute),
                                          ProductDirector.LocalVersioningSource, evargs => true,
                                          result =>
                {
                    try
                    {
                        if (result.WasSuccessful)
                        {
                            AppExec.SetConfiguration <DateTime>("Application", "LastUpdateCheck", DateTime.Now.Date, true);

                            var VersionFileText  = General.FileToString(ProductDirector.LocalVersioningSource);
                            var VersionFileLines = General.StringToStrings(VersionFileText);

                            if (ProductDirector.ProductUpdateIsNeeded(VersionFileLines))
                            {
                                Console.WriteLine("There is a new version available: " + VersionFileLines[0]);

                                /*- var Result = Display.DialogMessage("Attention!", "There is a new version available for update this application.\n" +
                                 *                                                   "Do you want to download and install it now?", EMessageType.Question,
                                 *                                                   System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxResult.Yes); */

                                var Result = Display.DialogPersistableMultiOption("Attention!", "There is a new version available for update this application.\n" +
                                                                                  "Do you want to download and install it now?", null,
                                                                                  "Application", "AskForUpdateOnStart", "Cancel",
                                                                                  new SimplePresentationElement("OK", "OK", "Proceed, and apply changes directly.", Display.GetAppImage("accept.png")),
                                                                                  new SimplePresentationElement("Cancel", "Cancel", "Do not edit.", Display.GetAppImage("cancel.png")));

                                if (Result != null && Result == "OK")
                                {
                                    ;
                                }
                                AppVersionUpdate.ShowAppVersionUpdate(VersionFileText);
                            }
                            else
                            {
                                Console.WriteLine("You are using the latest version available. No update required.");
                            }
                        }
                        else
                        {
                            Console.WriteLine("Unable to detect new application version.");
                        }
                    }
                    catch (Exception Problem)
                    {
                        Console.WriteLine("Cannot detect new application version. Problem: " + Problem.Message);
                    }
                });
            }
            catch (Exception Problem)
            {
                Console.WriteLine("Error: Cannot start detection of new version.\n\nProblem: " + Problem.Message);
            }
        }
Пример #2
0
        /*
         * private void TxtEMailContact_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         * {
         *  AppExec.CallExternalProcess("mailto:" + this.TxtEMailContact.Text + "?subject=Customer commercial inquiry.");
         * }
         *
         * private void TxtEMailSupport_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         * {
         *  AppExec.CallExternalProcess("mailto:" + this.TxtEMailSupport.Text + "?subject=Customer support request.");
         * }
         *
         * private void TxtWebsiteProduct_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         * {
         *  AppExec.CallExternalProcess(this.TxtWebsiteProduct.Text);
         * }*/

        private void BtnCheckForNewRelease_Click(object sender, RoutedEventArgs e)
        {
            AppVersionUpdate.ShowAppVersionUpdate();
        }