Good morning!
Hopefully this is the right place to find some help ... I've the following problem and I'm looking for a solution or at least a hint in the right direction.
General information
-
I'm using Visual Studio 2008 with CAB and SCSF
-
I'm using a lot of business modules that can contain one or more views. When speaking of a "view" I'm meaning these elements
-
I'm using Infragistics NetAdvantage for .NET 2007 Volume 3 with NetAdvantage CAB Extensibility Kit
-
I've read the following ressources:
-
[url:http://www.chrisholmesonline.com/2008/01/16/saving-settings-in-a-cab-application/] - A simple and fast solution
-
[url:http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=9844] - Very detailed, much too complicated
Problem description
I've created a CAB/SCSF application using a Infragistics UltraDockWorkspace. During runtime the user can open/close different views attached to this UltraDockWorkspace which contain my business objects. When the user closes the application the Infragistics UltraDockWorkspace layout must be saved. When the user restarts the application I want the application to
First try - My method of resolution
(1) Closing the application and saving the settings
When my Shell application closes I'm catching the "Application closing event" using something like
> this.Shell.FormClosing +=new FormClosingEventHandler(Shell_FormClosing);
The Shell_FormClosing method broadcasts a "save your stuff"-event to all open views containing business data. Each view that receives this event saves it's business content to a separate XML file.
After the business objects are saved the UltraDockWorkspace settings (location and size of open windows etc.) are saved using the following command:
> _dockWorkspace.SaveAsXML(configFile);
(2) Loading the previous application settings
When the user starts the application again I want the following to happen:
This is the point where I'm stuck 
After a good deal of thought
I know the following:
Here I can use the following code to reconstruct the size and position of the views:
> _dockWorkspace.LoadFromXML(configFile);
This works only when the corresponding views are opend already. Otherwise I get an assertion error.
Questions
That's a difficult point which raises some questions:
-
How do I know which views must be opened programmatically before I call the _LoadFromXML(configFile)_ command?
It seems that the only point to get this information is my XML file _configFile_. I'm going round in circles :(
-
Is this general description I made a good solution for my problem? Can it be done faster/simplier?
-
Is there a better was to save my business data stuff than storing it into separate XML files?
-
Is this the correct way to restore my application after starting?
-
Start Shell application
-
Check which views must be opened
-
Programmatically open views
-
Load busness data into views
-
Call LoadFromXML()
Any help appreciated!
thx, Mac