Exemplo n.º 1
0
        /// <summary>
        /// Shows a dialog to allow user to resolve the specified query to a single staff.
        /// The query may consist of part of the surname,
        /// optionally followed by a comma and then part of the given name (e.g. "sm, b" for smith, bill).
        /// The method returns true if the name is successfully resolved, or false otherwise.
        /// </summary>
        /// <param name="query"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public override bool ResolveNameInteractive(string query, out StaffSummary result)
        {
            result = null;

            var staffComponent = new StaffSummaryComponent(true, _staffTypesFilter);

            staffComponent.IncludeDeactivatedItems = this.IncludeDeactivatedItems;
            if (!string.IsNullOrEmpty(query))
            {
                var names = query.Split(',');
                if (names.Length > 0)
                {
                    staffComponent.LastName = names[0].Trim();
                }
                if (names.Length > 1)
                {
                    staffComponent.FirstName = names[1].Trim();
                }
            }

            var exitCode = ApplicationComponent.LaunchAsDialog(
                _desktopWindow, staffComponent, SR.TitleStaff);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                result = (StaffSummary)staffComponent.SummarySelection.Item;
            }

            return(result != null);
        }
Exemplo n.º 2
0
        public void Launch()
        {
            if (_workspace == null)
            {
                try
                {
                    StaffSummaryComponent component = new StaffSummaryComponent();

                    _workspace = ApplicationComponent.LaunchAsWorkspace(
                        this.Context.DesktopWindow,
                        component,
                        SR.TitleStaff);
                    _workspace.Closed += delegate { _workspace = null; };
                }
                catch (Exception e)
                {
                    // failed to launch component
                    ExceptionHandler.Report(e, this.Context.DesktopWindow);
                }
            }
            else
            {
                _workspace.Activate();
            }
        }
        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();
        }