Esempio n. 1
0
        private async void CheckUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnCheck.IsEnabled = false;
                var ver = await UpdateHelper.CheckUpdateAsync("HandyOrg", "HandyWinGet");

                if (ver.IsExistNewVersion)
                {
                    Growl.AskGlobal("we found a new Version, do you want to download?", b =>
                    {
                        if (!b)
                        {
                            return(true);
                        }
                        StartProcess(ver.Assets[0].Url);
                        return(true);
                    });
                }
                else
                {
                    Growl.InfoGlobal("you are using Latest Version.");
                }

                btnCheck.IsEnabled = true;
            }
            catch (Exception ex)
            {
                Growl.ErrorGlobal(ex.Message);
            }
        }
Esempio n. 2
0
    public static async void CheckForUpdate(bool onlyShowIfUpdateAvailable = false)
    {
        if (ApplicationHelper.IsConnectedToInternet())
        {
            var ver = await UpdateHelper.CheckUpdateAsync("DineshSolanki", "FoliCon");

            if (ver.IsExistNewVersion)
            {
                var info = new GrowlInfo
                {
                    Message = LangProvider.GetLang("NewVersionFound").Format(ver.TagName,
                                                                             ver.Changelog.Replace("\\n", Environment.NewLine)),
                    ConfirmStr        = LangProvider.GetLang("UpdateNow"),
                    CancelStr         = LangProvider.GetLang("Ignore"),
                    ShowDateTime      = false,
                    ActionBeforeClose = isConfirmed =>
                    {
                        if (isConfirmed)
                        {
                            StartProcess(ver.ReleaseUrl);
                        }
                        return(true);
                    }
                };
                Growl.AskGlobal(info);
            }
            else
            {
                if (onlyShowIfUpdateAvailable is not false)
                {
                    return;
                }
                var info = new GrowlInfo
                {
                    Message      = LangProvider.GetLang("ThisIsLatestVersion"),
                    ShowDateTime = false,
                    StaysOpen    = false
                };
                Growl.InfoGlobal(info);
            }
        }
        else
        {
            Growl.ErrorGlobal(new GrowlInfo
            {
                Message = LangProvider.GetLang("NetworkNotAvailable"), ShowDateTime = false
            });
        }
    }
Esempio n. 3
0
 public static void CheckForUpdate()
 {
     if (IsNetworkAvailable())
     {
         var ver = UpdateHelper.CheckForUpdate(
             "https://raw.githubusercontent.com/DineshSolanki/FoliCon/master/FoliCon/Updater.xml");
         if (ver.IsExistNewVersion)
         {
             var info = new GrowlInfo
             {
                 Message           = $"New Version Found!\n Changelog:{ver.Changelog}",
                 ConfirmStr        = "Update Now",
                 CancelStr         = "Ignore",
                 ShowDateTime      = false,
                 ActionBeforeClose = isConfirmed =>
                 {
                     if (isConfirmed)
                     {
                         StartProcess(ver.Url);
                     }
                     return(true);
                 }
             };
             Growl.AskGlobal(info);
         }
         else
         {
             var info = new GrowlInfo
             {
                 Message      = "Great! you are using the latest version",
                 ShowDateTime = false,
                 StaysOpen    = false
             };
             Growl.InfoGlobal(info);
         }
     }
     else
     {
         Growl.ErrorGlobal(new GrowlInfo {
             Message = "Network not available!", ShowDateTime = false
         });
     }
 }
Esempio n. 4
0
        public static bool IsWingetInstalled()
        {
            if (IsWingetExist())
            {
                return(true);
            }
            else
            {
                Growl.AskGlobal("Winget-cli is not installed, please download and install latest version.", b =>
                {
                    if (!b)
                    {
                        return(true);
                    }
                    StartProcess(Consts.WingetRepository);
                    return(true);
                });

                return(false);
            }
        }
Esempio n. 5
0
 public void AskInDesktop(string message, Func<bool, bool> func) => Growl.AskGlobal(message, func);