as I remember, the problem is:
1.
public void Show() { ... MainWorkspace.Show(MainView); if ( IsFirstShow ) OnFirstShow(); ... }
...
private void OnFirstShow() { if ( IsFirstShow ) { IWorkspace editorWs = MainWorkspace; editorWs.SmartPartClosing += EditorClosingHandler; IsFirstShow = false; } }
|
in EntityEditorController.
2. MainWorkspace.Show(MainView) calls Form.ShowDialog() (in case of modal dialogs) so OnFirstShow() is not called until dialog window is closed. So editorWs.SmartPartClosing += EditorClosingHandler; is not called until dialog is closed. So SmartPartClosing event is not processed (not "not fired").
btw, solwed the "Reactivation of smartpart: error" problem with:
1. processing closing event in all pagecontrollers (not only editors).
mainWs.SmartPartClosing += PageClosingHandler;
protected void PageClosingHandler(object sender, WorkspaceCancelEventArgs e)
{
if (e.SmartPart != MainView)
return; // not this Editor
PageClosingHandlerCore(sender, e);
if (e.Cancel)
return;
Terminate(e);
}
protected virtual void PageClosingHandlerCore(object sender, WorkspaceCancelEventArgs e) { }
|
2. if we need the page to be hidden (not closed) when pushing the close button:
protected override void PageClosingHandlerCore(object sender, WorkspaceCancelEventArgs e)
{
((IWorkspace) sender).Hide(this.MainView);
e.Cancel = true;
} |
щьёрт, не заметил Russian Federation. ко мне можно и по-русски. а лучше в аське сразу - 376440623 (рабочая), 108588 (домашняя). опыт работы с кабаной почти год уже, поделиться не против.
|