Beispiel #1
0
        public void Launch()
        {
            if (_workspace == null)
            {
                try
                {
                    var component = new StaffGroupSummaryComponent();

                    _workspace = ApplicationComponent.LaunchAsWorkspace(
                        this.Context.DesktopWindow,
                        component,
                        "Staff Groups");
                    _workspace.Closed += delegate { _workspace = null; };
                }
                catch (Exception e)
                {
                    // failed to launch component
                    ExceptionHandler.Report(e, this.Context.DesktopWindow);
                }
            }
            else
            {
                _workspace.Activate();
            }
        }
        public override bool ResolveNameInteractive(string query, out StaffGroupSummary result)
        {
            result = null;

            var staffComponent = new StaffGroupSummaryComponent(true, query, _electiveGroupsOnly);

            staffComponent.IncludeDeactivatedItems = this.IncludeDeactivatedItems;
            var exitCode = ApplicationComponent.LaunchAsDialog(
                _desktopWindow, staffComponent, SR.TitleStaffGroups);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                result = (StaffGroupSummary)CollectionUtils.FirstElement(staffComponent.SummarySelection.Items);
            }

            return(result != null);
        }
        public override void Start()
        {
            _staffSummaryComponent = new StaffSummaryComponent {
                IncludeDeactivatedItems = false, HostedMode = true
            };
            _staffSummaryComponent.SummarySelectionChanged += OnSummaryComponentSummarySelectionChanged;
            _staffSummaryComponent.ItemDoubleClicked       += OnSummaryComponentItemDoubleClicked;

            _staffGroupSummaryComponent = new StaffGroupSummaryComponent {
                IncludeDeactivatedItems = false, HostedMode = true
            };
            _staffGroupSummaryComponent.SummarySelectionChanged += OnSummaryComponentSummarySelectionChanged;
            _staffGroupSummaryComponent.ItemDoubleClicked       += OnSummaryComponentItemDoubleClicked;

            _tabComponentContainer = new TabComponentContainer();
            _tabComponentContainer.Pages.Add(new TabPage(SR.TitleStaff, _staffSummaryComponent));
            _tabComponentContainer.Pages.Add(new TabPage(SR.TitleStaffGroups, _staffGroupSummaryComponent));

            _tabComponentContainerHost = new ChildComponentHost(this.Host, _tabComponentContainer);
            _tabComponentContainerHost.StartComponent();

            base.Start();
        }