Hi all,
I've got several views developed that I want to share between different modules. I would like to know what's the best way to do it.
I've got to open these views in a modal way. I'm completely new to CAB and SCSF, if this is not right forum or I'm making no sense, please let me know.
This is my current code:
(Searcher is my view)
(SearchPresenter is the presenter of the view)
| Searchersearcher=this._presenter.WorkItem.SmartParts.AddNew<Searcher>(); |
| //publicproperty |
| searcher.ObjectName="Roads"; |
| searcher.Dock=DockStyle.Fill; |
| SearcherPresentertsp=newSearcherPresenter(); |
| searcher.Presenter=tsp; |
| tsp.WorkItem=this._presenter.WorkItem; |
| tsp.SetObjectName("Roads"); |
|
| WindowWorkspaceworkspace=this._presenter.WorkItem.Workspaces.AddNew<WindowWorkspace>(); |
| WindowSmartPartInfowspi=newWindowSmartPartInfo(); |
| wspi.Title="PleaseChooseObjecttosearch"; |
| wspi.StartPosition=FormStartPosition.CenterParent; |
| wspi.Height=310; |
| wspi.Width=665; |
| wspi.Modal=true; |
| workspace.Show(searcher,wspi); |
|
| if(searcher.DialogResult==DialogResult.OK) |
| { |
| //Getallinformationfromtheviewusinginterface?? |
| } |
1- Should I place this view in a common module and add references in all the modules that want to use it and call it like in this example?
2- Am I doing something wrong calling a view in this manner?
3- Shold I use an event to open this view? If yes, how can I retrieve the values there were set to the right parent?
Thanks ahead for all the help,
Luis Miguel Pinho
Luis Pinho