Exemplo n.º 1
0
 //**************************************************************
 // This event if fired whenever a new update is detected.
 // The default behavior is to start the update download immediately.
 //**************************************************************
 public void updater_OnUpdateDetected(object sender, UpdateDetectedEventArgs e)
 {
     if (e.UpdateDetected)
     {
         logger.Info("Alchemi updater: Found new updates. Downloading...");
     }
     else
     {
         logger.Info("Alchemi updater: No new updates.");
     }
 }
Exemplo n.º 2
0
        //**************************************************************
        // CheckForUpdates()
        // - Checks for an update
        // - This is a sync call... normally called by the poller object
        //   on the poller thread.
        //**************************************************************
        public bool CheckForUpdates()
        {
            Debug.WriteLine("APPMANAGER:  Checking for updates.");

            bool retValue = false;

            //If the OnCheckForUpdate event the caller is doing the check
            if (OnCheckForUpdate != null)
            {
                retValue = OnCheckForUpdate(this, new EventArgs());
            }
            else             //otherwise do the check ourselves
            {
                //If versioning is enabled check to see if the version file has changed.
                if (ChangeDetectionMode == ChangeDetectionModes.ServerManifestCheck)
                {
                    ServerManifest vm = new ServerManifest();
                    vm.Load(UpdateUrl);
                    retValue = vm.IsServerVersionNewer(GetLatestInstalledVersion());
                }
                else                 //If versioning is not enabled, check the files themselves
                {
                    Resource currentResource;
                    foreach (Object r in Manifest.Resources.ResourceList)
                    {
                        currentResource = (Resource)(((DictionaryEntry)r).Value);
                        string url      = UpdateUrl + currentResource.Name;
                        string FilePath = currentResource.FilePath;
                        if (WebFileLoader.CheckForFileUpdate(url, FilePath))
                        {
                            retValue = true;
                        }
                    }
                }
            }

            //Fire the OnUpdateDetected Event on the UI thread
            if (OnUpdateDetected != null)
            {
                foreach (UpdateDetectedEventHandler UC in  OnUpdateDetected.GetInvocationList())
                {
                    UpdateDetectedEventArgs ud = new UpdateDetectedEventArgs();
                    ud.UpdateDetected = retValue;
                    EventControl.BeginInvoke(UC, new object[] { this, ud });
                }
            }

            return(retValue);
        }
Exemplo n.º 3
0
        //**************************************************************
        // CheckForUpdates()
        // - Checks for an update
        // - This is a sync call... normally called by the poller object
        //   on the poller thread.
        //**************************************************************
        public bool CheckForUpdates()
        {
            Debug.WriteLine("APPMANAGER:  Checking for updates.");

            bool retValue = false;

            //If the OnCheckForUpdate event the caller is doing the check
            if (OnCheckForUpdate != null)
            {
                retValue = OnCheckForUpdate(this, new EventArgs());
            }
            else //otherwise do the check ourselves
            {
                //If versioning is enabled check to see if the version file has changed.
                if (ChangeDetectionMode == ChangeDetectionModes.ServerManifestCheck)
                {
                    ServerManifest vm = new ServerManifest();
                    vm.Load(UpdateUrl);
                    retValue = vm.IsServerVersionNewer(GetLatestInstalledVersion());
                }
                else //If versioning is not enabled, check the files themselves
                {
                    Resource currentResource;
                    foreach(Object r in Manifest.Resources.ResourceList)
                    {
                        currentResource = (Resource)(((DictionaryEntry)r).Value);
                        string url = UpdateUrl + currentResource.Name;
                        string FilePath = currentResource.FilePath;
                        if( WebFileLoader.CheckForFileUpdate(url, FilePath))
                            retValue =  true;
                    }
                }
            }

            //Fire the OnUpdateDetected Event on the UI thread
            if (OnUpdateDetected != null)
            {
                foreach ( UpdateDetectedEventHandler UC in  OnUpdateDetected.GetInvocationList())
                {
                    UpdateDetectedEventArgs ud = new UpdateDetectedEventArgs();
                    ud.UpdateDetected = retValue;
                    EventControl.BeginInvoke(UC,new object[] {this,ud});
                }
            }

            return retValue;
        }
Exemplo n.º 4
0
 //**************************************************************
 // This event if fired whenever a new update is detected.
 // The default behavior is to start the update download immediately.
 //**************************************************************
 public void updater_OnUpdateDetected(object sender, UpdateDetectedEventArgs e)
 {
     if (e.UpdateDetected)
     {
         logger.Info("Alchemi updater: Found new updates. Downloading...");
     }
     else
     {
         logger.Info("Alchemi updater: No new updates.");
     }
 }