INTERACT FORUM

Windows => Plug-in Development => Topic started by: llafriel on October 25, 2009, 12:54:43 pm

Title: Adding windows to plugin
Post by: llafriel on October 25, 2009, 12:54:43 pm
Hi again,

I feel I'm flooding the forum with questions atm..
I want to add a window(form) in my plugin. The problem is how to connect the new window/form to MC. I'm able to add a form and open it. But doing requests to MC's database doesn't work.
Title: Re: Adding windows to plugin
Post by: gappie on October 25, 2009, 01:41:42 pm
I feel I'm flooding the forum with questions atm..
Good!!  8)

I want to add a window(form) in my plugin. The problem is how to connect the new window/form to MC. I'm able to add a form and open it. But doing requests to MC's database doesn't work.
not sure if i understand the question. ive had a windows form in my plugin showing file info from the file playing now and volume(until the info panel came, still sometimes i think its a pity i took it away because it also worked on fullscreen etc).
how do you open the form? it should not be diferent from how you get data in your plugin. is it not updating, or do you get nothing..

 :)
gab
Title: Re: Adding windows to plugin
Post by: llafriel on October 25, 2009, 02:10:28 pm
I'm doing a plugin for discogs, getting tag information, style/genre etc. In the maininterface my plugin I get a list of albums from MC. With these I do a search in discogs and get hits based upon the search. I want so select one hit, click a button and go into a window which retrieves the album info. This part works fine. In the popup window I also want to get the local files from MC to compare with the info from discogs. This doesn't work.  It seems my new window is missing the link to MC?
Title: Re: Adding windows to plugin
Post by: ThoBar on October 25, 2009, 09:36:47 pm
I call the new window passing a reference to the MC object to it...

So the calling code is ...
Code: [Select]
Form_RuleSetEdit subForm = new Form_RuleSetEdit(mediaCenterReference, this, RuleSet2Edit);

and the called form looks like ....
Code: [Select]
public Form_RuleSetEdit(MediaCenter.IMJAutomation mediaCenterReference, MainInterface mainInterface, RuleSet RuleSet2Edit)

I dont say it's the right or best way to do it... but it works for me :)
Title: Re: Adding windows to plugin
Post by: pbair on October 26, 2009, 02:29:10 am
What about the following method:

1. Load your popup form so that it isn't visible.
2. From the MainInterface, get the MC album info and assign it to the popup form's controls (textboxes, listboxes, etc).
3. Make your popup form visible.

Title: Re: Adding windows to plugin
Post by: Mr ChriZ on October 26, 2009, 04:52:31 am
What about the following method:

1. Load your popup form so that it isn't visible.
2. From the MainInterface, get the MC album info and assign it to the popup form's controls (textboxes, listboxes, etc).
3. Make your popup form visible.



That would use up more memory as you'd have objects in memory that aren't being used.
It's fairly simple to create Form at run time, and pass references at Cornfishy recommends.
That's not to say we haven't done something similar ;-)