示例#1
0
        public void Launch()
        {
            try
            {
                if (_shelf == null)
                {
                    var component = new CannedTextSummaryComponent();

                    _shelf = ApplicationComponent.LaunchAsShelf(
                        this.Context.DesktopWindow,
                        component,
                        SR.TitleCannedText,
                        SR.TitleCannedText,
                        ShelfDisplayHint.DockFloat);

                    _shelf.Closed += delegate { _shelf = null; };
                }
                else
                {
                    _shelf.Activate();
                }
            }
            catch (Exception e)
            {
                // could not launch component
                ExceptionHandler.Report(e, this.Context.DesktopWindow);
            }
        }
示例#2
0
        private bool ResolveNameInteractive(string query, out CannedText result)
        {
            result = null;

            var cannedTextComponent = new CannedTextSummaryComponent(true, query);
            var exitCode            = ApplicationComponent.LaunchAsDialog(
                _desktopWindow, cannedTextComponent, SR.TitleCannedText);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                var summary = (CannedTextSummary)cannedTextComponent.SummarySelection.Item;
                result = new CannedText(summary);
            }

            return(result != null);
        }