Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Loading, saving and restoring a UltraDockWorkspace CAB/SCSF application
posted

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

  • open all Views that were opended before the application was closed
  • restore all business contents in the views

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:

  • Open all views that were opened before closing the application at right size and position
  • Restore all business data in the views and the "background" (administration stuff) of the application


Sad This is the point where I'm stuck Sad

 

After a good deal of thought

I know the following:

  • Loading the UltraDockworkspace

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.

  • I have to use unique names. Otherwise the LoadFromXML() method doesn't work correctly.

Questions

That's a difficult point which raises some questions:

  1. 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 :(
  2. Is this general description I made a good solution for my problem? Can it be done faster/simplier?
  3. Is there a better was to save my business data stuff than storing it into separate XML files?
  4. 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

Parents Reply Children
No Data