示例#1
0
		/// <summary>
		/// Checks the client to see if there is an update available. If so it starts the update process
		/// and returns true. If no update is found then return false.
		/// </summary>
		/// <returns>True if an update has started or false otherwise.</returns>
		protected void CheckForUpdate()
		{
			if (_client == null)
			{
				return;
			}

			try
			{
				WriteLine("Check for a service update.", LogLevel.Trace);
				var serviceDetails = new WindowsServiceDetails { Name = ServiceFileName, Version = ServiceVersion };
				var update = _client.CheckForUpdate(serviceDetails);

				if (update.Size > 0)
				{
					WriteLine("Starting to update the service.");
					StartServiceUpdate(update);
				}
			}
			catch (Exception ex)
			{
				WriteLine(ex.ToDetailedString(), LogLevel.Fatal);
			}
		}