示例#1
0
		internal override void Transit(UpdateContext context)
		{
			if (_extracted)
            {
                string installerName = Path.Combine(Path.GetDirectoryName(UpdateContext.LocalPackageFileName),
                                                   "setup.exe");
                if (!File.Exists(installerName))
                {
                    SetState(context, new Failed("The installer is not there."));
                }
                else
                {
                    while (IdeIsRunning)
                    {
                        Lextm.Windows.Forms.MessageBoxFactory.Info(null, "RAD Studio is running", "Please close CodeGear RAD Studio before installing the update.");
                    }
                    Lextm.Diagnostics.ShellHelper.Execute(installerName);
                    SetState(context, new Succeeded());
                }
			} 
			else 
			{
				SetState(context, new Failed("Bad package."));			
			}
		}
示例#2
0
		internal override void Transit(UpdateContext context)
		{
			if (_successful) {
				SetState(context, new PackageReceived());
			}
			else 
			{
				SetState(context, new Failed(_error));
			}
		}
示例#3
0
		/// <summary>
		/// Constructor.
		/// </summary>
		public FormInDate() {
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			//TODO: calculate the height on both XP and Vista here.            
            Width = 340;
            Height = 52;
			Left = Screen.PrimaryScreen.WorkingArea.Right - Width;
			Top = Screen.PrimaryScreen.WorkingArea.Bottom - Height;
			
			context = new UpdateContext(ShareUtils.CoreVersion);
		}
示例#4
0
		/// <summary>
		/// Handles.
		/// </summary>
		/// <param name="context">Context</param>
		internal override void Handle( UpdateContext context )
		{
			try
			{
				(new WebClient()).DownloadFile(
					_link.ToString(), UpdateContext.LocalPackageFileName);
				_successful = true;
			}
			catch (WebException ex)
			{
				_error = ex.Message;
				_successful = false;
			}
		}
示例#5
0
		/// <summary>
		/// Handles.
		/// </summary>
		/// <param name="context">Context</param>
		internal override void Handle( UpdateContext context )
		{
            System.Threading.Thread.Sleep(1000);
			IList<PackageRecord> packages = GetZipLinks(UpdateContext.LocalListFileName);
			if (packages.Count != 0)
			{
				_record = GetLastestRecord(context, packages);
				if (_record != null )
				{
					_found = true;
					return;
				}
			}
			_found = false;
		}
示例#6
0
 /// <summary>
 /// Handles.
 /// </summary>
 /// <param name="context">Context</param>
 internal override void Handle( UpdateContext context )
 {
     FastZip zipper = new FastZip();
     string fileName = UpdateContext.LocalPackageFileName;
     try
     {
         zipper.ExtractZip(fileName,
     	                  Path.GetDirectoryName(fileName),
                           String.Empty);
         _extracted = true;
     }
     catch (SharpZipBaseException ex) 
     {
     	LoggingService.Fatal(ex);
     	_extracted = false;
     }
 }
示例#7
0
		/// <summary>
		/// Handles.
		/// </summary>
		/// <param name="context">Context</param>
		internal override void Handle( UpdateContext context )
		{
			try
			{
				// download the blog entry first.
				MessageService.Debug("Download " + UpdateContext.PackageListUri 
				                    + " to " + UpdateContext.LocalListFileName);
				(new WebClient()).DownloadFile(UpdateContext.PackageListUri.ToString(), 
				                               UpdateContext.LocalListFileName);
				_successful = true;
			}
			catch (WebException ex)
			{
				_successful = false;
				_error = ex.Message;
			}
		}
示例#8
0
		/// <summary>
		/// Transites.
		/// </summary>
		/// <param name="context"></param>
        internal override void Transit(UpdateContext context)
        {
            cTaskDialog.ForceEmulationMode = true;
            cTaskDialog.UseToolWindowOnXP = true;
            cTaskDialog.EmulatedFormWidth = 450;
            //cTaskDialog.VerificationChecked = !(bool)PropertyRegistry.Get("InDateCheckAtStartup", true);
            int result = cTaskDialog.ShowCommandBox("Oops!",
                                                    "Update process is not completed.",
                                                    "Go to homepage to check for latest updates?",
                                                    "Error message: " + _error,
                                                    "Homepage URL: http://code.google.com/p/lextudio",
                                                    "turn off auto update",
                                                    "Yes, take me there|No, thanks",
                                                    false,
                                                    eSysIcons.Error,
                                                    eSysIcons.Information);
            PropertyRegistry.Set("InDateCheckAtStartup", !cTaskDialog.VerificationChecked);
            if (result == 0)
            {
                ShellHelper.Execute(PropertyRegistry.Get("InDateListUri").ToString());
            }
            SetState(context, new Completed());
        }
示例#9
0
		internal override void Transit(UpdateContext context)
		{
			if (_found)
			{
                cTaskDialog.ForceEmulationMode = true;
                cTaskDialog.UseToolWindowOnXP = true;
                cTaskDialog.EmulatedFormWidth = 450;

                bool confirmed = UpdateContext.AlwaysDownload ||
                    cTaskDialog.ShowCommandBox("Update Found",
                                               String.Format(CultureInfo.InvariantCulture, "A new version {0} is available.", _record.Version),
                                               "Do you want to download it now?",
                                               String.Format(CultureInfo.InvariantCulture, "The URL: {0}.", _record.Link),
                                               "Latest version contains bug fixes and new features.",
                                               "turn on auto download and install",
                                               "Yes, download it|No, thanks",
                                               false,
                                               eSysIcons.Question,
                                               eSysIcons.Information) == 0;

                PropertyRegistry.Set("InDateAutoInstall", cTaskDialog.VerificationChecked);
                if (confirmed)
                {
                    SetState(context, new DownloadAffirmed(_record.Link));
                }
                else
                {
                    SetState(context, new Canceled());
                }
			}
			else 
			{
				SetState(context, new Succeeded(
						 "No update is available at this moment."));
			}
		}
示例#10
0
		private static PackageRecord GetLastestRecord(UpdateContext context,
											   IList<PackageRecord> packages)
		{
			Trace.Assert(packages.Count!= 0);
			PackageRecord result = packages[0];

			for (int i = 1; i < packages.Count; i++)
			{
				if (packages[i].Version > result.Version)
				{
					result = packages[i];
				}
			}
			if (context.IsUpdateAvailable(result.Version))
			{
				return result;
			}
			else
			{
				return null;
			}
		}
示例#11
0
 internal override void Transit(UpdateContext context)
 {
     SetState(context, new Completed());
 }
示例#12
0
 internal override void Handle(UpdateContext context)
 {
     Thread.Sleep(1000);
 }
示例#13
0
 internal override void Transit(UpdateContext context)
 {
 }
示例#14
0
 internal override void Handle(UpdateContext context)
 {            
 }
示例#15
0
		/// <summary>
		/// Handles.
		/// </summary>
		/// <param name="context">Context</param>
		internal override void Handle( UpdateContext context )
		{
            System.Threading.Thread.Sleep(1000);
        }