Getting automaticUpdater animation to show on host form

Hello-

I have written a plugin for an application. My plugin adds menuItems to the host apps menuItems, and I want to check for updates from one of these menuItems.

I have automaticUpdater working just fine from my menuItem, but I can't seem to get the animation to show on the host app's form.

Is this possible?

Here is what I have done so far:

namespace Anesthesia{public class FormOpenDentalA : Control{public static FormOpenDentalA formOpenDentalA;public System.ComponentModel.IContainer components;public wyDay.Controls.AutomaticUpdater automaticUpdater1;

public FormOpenDentalA(){InitializeComponent();

}public void InitializeComponent(){ this.automaticUpdater1 = new wyDay.Controls.AutomaticUpdater(); ((System.ComponentModel.ISupportInitialize)(this.automaticUpdater1)).BeginInit(); this.SuspendLayout(); // // automaticUpdater1// this.automaticUpdater1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.automaticUpdater1.ContainerForm = System.Windows.Forms.Form.ActiveForm; this.automaticUpdater1.GUID = "49d5d16a-fa8c-4bc6-b59e-ab67622abddc"; this.automaticUpdater1.Location = new System.Drawing.Point(640,20); this.automaticUpdater1.Name = "automaticUpdater1"; this.automaticUpdater1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.automaticUpdater1.Size = new System.Drawing.Size(16, 16); this.automaticUpdater1.TabIndex = 152; this.automaticUpdater1.MenuItem = this.menuItemUpdates; this.automaticUpdater1.wyUpdateCommandline = ""; this.automaticUpdater1.UpdateSuccessful += new wyDay.Controls.SuccessHandler(automaticUpdater1_UpdateSuccessful); // // menuItemUpdates // this.menuItemUpdates.Index = 6; this.menuItemUpdates.Text = "Check for updates..."; this.menuItemUpdates.Click += new System.EventHandler(this.menuItemUpdates_Click); ((System.ComponentModel.ISupportInitialize)(automaticUpdater1)).EndInit(); this.ResumeLayout(false); this.PerformLayout();

public void Load_end(OpenDental.FormOpenDental sender, long patNum) {

// Add the menu items to the main menu. formOpenDentalA = new FormOpenDentalA();

etc...

Hey William,

I'm not quite sure what you're trying to do. I take it you don't have access to the main form -- if you did you could just add the automatic updater to the main form. From what it looks like is that the main app gives you access to the main form through an event maybe?

The important question is do you have access to the main form's constructor? (You need it.)

Sam-

Thanks for the quick response. I have access to the main form via hooks placed in the main program.

I'll see if I can have a hook added to the constructor

The hook should be added after the InitializeComponents() function in their app.

Sam-

I just emailed the developer of the host app and it is not possible to add a hook to the constructor of the form because the plugins haven't loaded at that point.

So all I can do is add code to the load event via a hook.

I *do* have automaticUpdater working from my added-on menuitem. When I click 'Check for updates', the menuItem text changes to 'Cancel update checking' and if there is an update, to 'Install update now'. That leads me to believe that I *should* be able to get the animation to show somehow, but alas, my knowledge of how the designer works is admittedly lacking 🤔

You might be able to get the animation to show with the loaded event, but it's a moot point because the actual AutomaticUpdating won't work without being added in the constructor of the app.

Once you get the AutomaticUpdater added via a constructor make sure you add the AutomaticUPdater instance to the main form's "Controls" property:

mainForm.Controls.Add(automaticUpdater);

I didn't see that in the code you posted, so that's probably why the AutomaticUpdater isn't showing itself.

Sam-

OK, I found the problem.

The Controls.Add was part of my code, forgot to include it above, sorry.

The problem is that the Controls.Add statement has to get inserted before the main form loads. Since all plugins are loaded *after* the main form loads, it explains why the control won't show. I confirmed this by moving the this.Controls.Add(this.automaticUpdater1); statement to a position after the Load event on one of my other forms.

On to Plan B... 😛

Thanks again.

Update: I asked the lead developer and it was his opinion that I could use a automaticUpdater1.BringToFront() statement. Sure enough, when I placed that in my plugin's constructor, it worked as expected. Thanks for your help, Sam.