Example #1
0
 /// <summary>
 /// 检测到程序更新事件
 /// </summary>
 /// <param name="detector"></param>
 private void OnUpdateNotification(UpdateDetector detector)
 {
     this.Invoke((Action)(() =>
     {
         ShowUpdateNotification();
     }));
 }
Example #2
0
        /// <summary>
        /// 启动更新检测
        /// </summary>
        /// <param name="localRunInfo"></param>
        /// <param name="config"></param>
        private void StartUpdateDetect(LocalRunInfo localRunInfo, Config config)
        {
            if (_updateDetector != null)
            {
                _updateDetector.Stop();
                _updateDetector.OnStart        -= OnUpdateDetectorStart;
                _updateDetector.OnStop         -= OnUpdateDetectorStop;
                _updateDetector.OnNotifyUpdate -= OnUpdateNotification;
            }

            UpdateUrlInfo info = UpdateUrlInfo.Parse(localRunInfo.UpdateUrl);

            _updateDetector                 = new UpdateDetector(config.DetectInterval * 1000, info);
            _updateDetector.OnStart        += OnUpdateDetectorStart;
            _updateDetector.OnStop         += OnUpdateDetectorStop;
            _updateDetector.OnNotifyUpdate += OnUpdateNotification;
            _updateDetector.Start();
        }