public void Add(IReportViewFactory factory) { viewFactories.Add(factory, null); miViews.MenuItems.Add(factory.ViewName, delegate { showView(factory); }); }
private void showView(IReportViewFactory factory) { if (InvokeRequired) { Invoke(new ShowViewDelegate(showView), factory); return; } var view = viewFactories[factory]; if (view == null) { viewFactories[factory] = view = factory.Create(); view.WindowState = FormWindowState.Maximized; view.MdiParent = this; view.Text = factory.ViewName; if (view is ITreeItemSelectionHandler) { SelectionHandlers.Add((ITreeItemSelectionHandler)view); } var asyncProcess = new TinyAsyncUserProcess { Action = tracker => view.attach(serviceContainer, tracker) }; asyncProcess.Execute(this); view.FormClosed += delegate { if (view is ITreeItemSelectionHandler) { SelectionHandlers.Remove((ITreeItemSelectionHandler)view); } view.detach(serviceContainer, new DummyProgressTracker()); viewFactories[factory] = null; }; } view.Show(); view.Activate(); view.Focus(); }
public void remove(IReportViewFactory factory) { viewFactories.Remove(factory); }
public void add(IReportViewFactory factory) { viewFactories.Add(factory, null); miViews.MenuItems.Add(factory.ViewName, delegate { showView(factory); }); }
private void showView(IReportViewFactory factory) { if (InvokeRequired) { Invoke(new ShowViewDelegate(showView), factory); return; } ReportView view = viewFactories[factory]; if (view == null) { viewFactories[factory] = view = factory.create(); view.WindowState = FormWindowState.Maximized; view.MdiParent = this; view.Text = factory.ViewName; TinyAsyncUserProcess asyncProcess = new TinyAsyncUserProcess(); asyncProcess.Action = delegate(IProgressTracker tracker) { view.attach(serviceContainer, tracker); }; asyncProcess.execute(this); view.FormClosed += delegate { view.detach(serviceContainer, new DummyProgressTracker()); viewFactories[factory] = null; }; } view.Show(); view.Activate(); view.Focus(); }