コード例 #1
0
        /// <summary>
        /// Schedules the specified action.
        /// </summary>
        /// <param name="action">The action to be performed.</param>
        private void Schedule(AccordionAction action)
        {
#if SILVERLIGHT
            if (DesignerProperties.GetIsInDesignMode(this) && ExpandSite != null)
            {
                switch (action)
                {
                case AccordionAction.None:
                    break;

                case AccordionAction.Collapse:
                    ExpandSite.Percentage = 0;
                    break;

                case AccordionAction.Expand:
                case AccordionAction.Resize:
                    ExpandSite.Percentage = 1;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("action");
                }
                return;
            }
#endif

            ScheduledAction = action;

            if (ParentAccordion == null)
            {
                // no parentaccordion to notify, so just execute.
                StartAction();
            }
            else
            {
                bool directExecute = ParentAccordion.ScheduleAction(this, action);
                if (directExecute)
                {
                    StartAction();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Schedules the specified action.
        /// </summary>
        /// <param name="action">The action to be performed.</param>
        private async void Schedule(AccordionAction action)
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled && ExpandSite != null)
            {
                switch (action)
                {
                case AccordionAction.None:
                    break;

                case AccordionAction.Collapse:
                    ExpandSite.Percentage = 0;
                    break;

                case AccordionAction.Expand:
                case AccordionAction.Resize:
                    ExpandSite.Percentage = 1;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("action");
                }
                return;
            }

            ScheduledAction = action;

            if (ParentAccordion == null)
            {
                // no parentaccordion to notify, so just execute.
                StartAction();
            }
            else
            {
                bool directExecute = await ParentAccordion.ScheduleAction(this, action);

                if (directExecute)
                {
                    StartAction();
                }
            }
        }