コード例 #1
0
 public void Add(IReportViewFactory factory)
 {
     viewFactories.Add(factory, null);
     miViews.MenuItems.Add(factory.ViewName, delegate
     {
         showView(factory);
     });
 }
コード例 #2
0
        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();
        }
コード例 #3
0
 public void remove(IReportViewFactory factory)
 {
     viewFactories.Remove(factory);
 }
コード例 #4
0
 public void add(IReportViewFactory factory)
 {
     viewFactories.Add(factory, null);
     miViews.MenuItems.Add(factory.ViewName,
                           delegate { showView(factory); });
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: sjeyaram/partcover.net4
        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();
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: sjeyaram/partcover.net4
 public void remove(IReportViewFactory factory)
 {
     viewFactories.Remove(factory);
 }
コード例 #7
0
        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();
        }