示例#1
0
 public async void Execute()
 {
     if (KoobooUpgrade.IsAutoUpgrade)
     {
         var hours = DateTime.Now.Hour;
         // only do it in the midnight of current computer zone.
         if (hours == 2 || hours == 3 || hours == 4)
         {
             await KoobooUpgrade.Upgrade();
         }
     }
 }
示例#2
0
        private async void Upgrade_Click(object sender, RoutedEventArgs e)
        {
            //防止重复点击
            if (!IsUpgrade)
            {
                IsUpgrade = true;
                try
                {
                    Action action = () =>
                    {
                        SetUpgradeBtnStatus();
                    };

                    await this.Dispatcher.BeginInvoke(action);

                    await KoobooUpgrade.Upgrade(DownloadProgressChanged);
                }
                finally
                {
                    IsUpgrade = false;
                }
            }
        }