Exemple #1
0
        void UpdateComponent_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // e.Error is always null to enable passing back the UserState to the caller.
            UpdateComponentArgs result = (UpdateComponentArgs)e.Result;

            UpdateComponentCompletedEventArgs updateComponentResult;

            if (result.Error != null)
            {
                updateComponentResult = new UpdateComponentCompletedEventArgs(result.Component,
                                                                              null,
                                                                              result.UserState,
                                                                              result.Error);
            }
            else
            {
                updateComponentResult = new UpdateComponentCompletedEventArgs(result.Component,
                                                                              result.UpdateInfo,
                                                                              result.UserState,
                                                                              null);
            }

            // Signal async callers.
            if (UpdateComponentCompleted != null)
            {
                UpdateComponentCompleted(this, updateComponentResult);
            }
        }
Exemple #2
0
 /// <summary>
 /// Call back method for update check.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void Processor_UpdateComponentCompleted(object sender, UpdateComponentCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         WriteSatus(String.Format("There was a problem finding update information. {0}. Please try again later, or visit http://www.codeplex.com/precode.", e.Error.Message));
     }
     else
     {
         if (e.Component.NeedsUpdate(e.UpdateInfo))
         {
             WriteSatusFormat("A new version of the PreCode Code Snippet Plugin is available.{0}", Environment.NewLine);
             WriteSatusFormat("The new version is {0}, and contains the following changes: {1}{2}", e.UpdateInfo.Version, e.UpdateInfo.Description, Environment.NewLine);
             WriteSatusFormat("This updated is available for download at {0}", e.UpdateInfo.UpdateUrl);
             WriteSatusFormat("You can find out more about this update by visiting {0}", e.UpdateInfo.UpdateArticleUrl);
         }
         else
         {
             WriteSatus("You are using the latest version of PreCode Code Snippet Plugin for Windows Live Writer.");
         }
     }
 }