Yes, I am using automatic updater but it is not restarting the application without user intervention. It only changes its icon (and message) until I manually select to update the app. Only then it starts the update process.
I've tried to handle its events but the updater component isn't firing any.
Here's some code:
// -- Form1.cs#Form1
public partial class Form1 : Form { private static string CurrentVer = "1.1";
public Form1() { InitializeComponent(); if (automaticUpdater.ClosingForInstall) return; }
private void Form1_Load(object sender, EventArgs e) { textBox1.Text = CurrentVer; textBox2.Text = "?"; automaticUpdater.ForceCheckForUpdate(); Log("Form loaded"); }
private void automaticUpdater_UpdateAvailable(object sender, EventArgs e) { Log("Update Available"); automaticUpdater.InstallNow(); }
private void automaticUpdater_CloseAppNow(object sender, EventArgs e) { Log("Force exit"); Application.Exit(); }
private void Log(string format, params object[] values) { logger.Text += string.Format(format, values) + "\n"; } }
/////// Form1.designer.cs#Form1
partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null;
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
#region Windows Form Designer generated code
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.automaticUpdater = new wyDay.Controls.AutomaticUpdater(); this.logger = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.automaticUpdater)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 13); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(42, 13); this.label1.TabIndex = 0; this.label1.Text = "AppVer"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(61, 6); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 1; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 40); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(37, 13); this.label2.TabIndex = 2; this.label2.Text = "LibVer"; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(61, 33); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(100, 20); this.textBox2.TabIndex = 3; // // automaticUpdater // this.automaticUpdater.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.automaticUpdater.ContainerForm = this; this.automaticUpdater.GUID = "73c12b82-16c6-449a-bb9a-3806bee23f9a"; this.automaticUpdater.Location = new System.Drawing.Point(256, 12); this.automaticUpdater.Name = "automaticUpdater"; this.automaticUpdater.Size = new System.Drawing.Size(16, 16); this.automaticUpdater.TabIndex = 4; this.automaticUpdater.wyUpdateCommandline = null; this.automaticUpdater.CloseAppNow += new System.EventHandler(this.automaticUpdater_CloseAppNow); this.automaticUpdater.UpdateAvailable += new System.EventHandler(this.automaticUpdater_UpdateAvailable); // // logger // this.logger.Location = new System.Drawing.Point(12, 64); this.logger.Multiline = true; this.logger.Name = "logger"; this.logger.Size = new System.Drawing.Size(259, 185); this.logger.TabIndex = 5; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 261); this.Controls.Add(this.logger); this.Controls.Add(this.automaticUpdater); this.Controls.Add(this.textBox2); this.Controls.Add(this.label2); this.Controls.Add(this.textBox1); this.Controls.Add(this.label1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.automaticUpdater)).EndInit(); this.ResumeLayout(false); this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textBox2; private wyDay.Controls.AutomaticUpdater automaticUpdater; private System.Windows.Forms.TextBox logger; }