コード例 #1
0
        public void Launch()
        {
            if (_shelf == null)
            {
                try
                {
                    ValidationEditorComponent editor = new ValidationEditorComponent(this.Context.Component);

                    _shelf = ApplicationComponent.LaunchAsShelf(
                        this.Context.DesktopWindow,
                        editor,
                        string.Format("{0} rules editor", this.Context.Component.GetType().Name),
                        ShelfDisplayHint.DockFloat);
                    _shelf.Closed += delegate { _shelf = null; };
                }
                catch (Exception e)
                {
                    // could not launch component
                    ExceptionHandler.Report(e, this.Context.DesktopWindow);
                }
            }
            else
            {
                _shelf.Activate();
            }
        }
コード例 #2
0
 public void Open()
 {
     if (_shelf == null)
     {
         _shelf = ApplicationComponent.LaunchAsShelf(
             this.Context.DesktopWindow,
             new TagBrowserComponent(new TagDatabase()),
             "Study Tagging",
             ShelfDisplayHint.DockRight);
         _shelf.Closed += delegate { _shelf = null; };
     }
     else
     {
         _shelf.Activate();
     }
 }
コード例 #3
0
ファイル: SchedulingTool.cs プロジェクト: hksonngan/Xian
 /// <summary>
 /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
 /// </summary>
 public void Apply()
 {
     // check if the shelf already exists
     if (_shelf == null)
     {
         // create a new shelf that hosts the SchedulingComponent
         _shelf = ApplicationComponent.LaunchAsShelf(
             this.Context.DesktopWindow,
             new SchedulingComponent(),
             SR.SchedulingTool,
             ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide,
             delegate(IApplicationComponent c)
         {
             _shelf = null;      // destroy the shelf when the user closes it
         });
     }
     else
     {
         // activate existing shelf
         _shelf.Activate();
     }
 }
コード例 #4
0
            public Shelf Launch(IDesktopWindow desktopWindow)
            {
                try
                {
                    if (_searchComponentShelf != null)
                    {
                        _searchComponentShelf.Activate();
                    }
                    else
                    {
                        desktopWindow.Workspaces.ItemActivationChanged += Workspaces_ItemActivationChanged;

                        _searchComponentShelf = LaunchAsShelf(
                            desktopWindow,
                            this.Instance,
                            SR.TitleSearch,
                            SR.TitleSearch,
                            ShelfDisplayHint.DockFloat);

                        _searchComponentShelf.Closed += delegate
                        {
                            desktopWindow.Workspaces.ItemActivationChanged -= Workspaces_ItemActivationChanged;
                            _searchComponentShelf = null;
                            SearchComponentManager.ActiveSearchComponent = SearchComponentManager.ActiveSearchComponentContext.None;
                        };

                        UpdateDisplay();
                    }
                }
                catch (Exception e)
                {
                    // cannot start component
                    ExceptionHandler.Report(e, desktopWindow);
                }

                SearchComponentManager.ActiveSearchComponent = new SearchComponentManager.ActiveSearchComponentContext(_searchComponentShelf, typeof(TSearchComponent));

                return(_searchComponentShelf);
            }