示例#1
0
        public bool UnRegisterSubObject(WindowObject windowObject)
        {
            if (this.subObjects.Remove(windowObject) == true)
            {
                windowObject.rootObject = null;

                {
                    switch (this.objectState)
                    {
                    case ObjectState.Initializing:
                    case ObjectState.Initialized:
                        windowObject.DoDeInit();
                        break;

                    case ObjectState.Showing:
                    case ObjectState.Shown:

                        // after OnShowEnd
                        windowObject.Hide(TransitionParameters.Default.ReplaceImmediately(true));
                        windowObject.DoDeInit();
                        break;

                    case ObjectState.Hiding:

                        // after OnHideBegin
                        WindowSystem.SetHidden(windowObject, TransitionParameters.Default.ReplaceImmediately(true));
                        windowObject.DoDeInit();
                        break;

                    case ObjectState.Hidden:

                        // after OnHideEnd
                        windowObject.DoDeInit();
                        break;
                    }
                }
                return(true);
            }

            return(false);
        }
        public bool RegisterSubObject(WindowObject windowObject)
        {
            windowObject.Setup(this.window);

            if (this.subObjects.Contains(windowObject) == false)
            {
                this.subObjects.Add(windowObject);
                windowObject.rootObject = this;

                {
                    switch (this.objectState)
                    {
                    case ObjectState.Initializing:
                    case ObjectState.Initialized:
                        if (windowObject.GetState() == ObjectState.NotInitialized)
                        {
                            windowObject.DoInit();
                        }
                        break;

                    case ObjectState.Showing:
                        if (windowObject.GetState() == ObjectState.NotInitialized)
                        {
                            windowObject.DoInit();
                        }

                        if (windowObject.hiddenByDefault == false)
                        {
                            WindowSystem.ShowInstance(windowObject, TransitionParameters.Default.ReplaceImmediately(true), internalCall: true);
                        }
                        break;

                    case ObjectState.Shown:
                        if (windowObject.GetState() == ObjectState.NotInitialized)
                        {
                            windowObject.DoInit();
                        }

                        if (windowObject.hiddenByDefault == false)
                        {
                            WindowSystem.ShowInstance(
                                windowObject,
                                TransitionParameters.Default.ReplaceImmediately(true).ReplaceCallback(() => {
                                WindowSystem.SetShown(windowObject, TransitionParameters.Default.ReplaceImmediately(true));
                            }), internalCall: true);
                        }

                        break;

                    case ObjectState.Hiding:

                        if (windowObject.GetState() == ObjectState.NotInitialized)
                        {
                            windowObject.DoInit();
                        }

                        windowObject.SetState(this.objectState);

                        break;

                    case ObjectState.Hidden:

                        if (windowObject.GetState() == ObjectState.NotInitialized)
                        {
                            windowObject.DoInit();
                        }

                        windowObject.SetState(this.objectState);

                        break;

                    case ObjectState.DeInitializing:
                    case ObjectState.DeInitialized:
                        if (windowObject.GetState() == ObjectState.NotInitialized)
                        {
                            windowObject.DoInit();
                        }

                        windowObject.DoDeInit();
                        break;
                    }
                }
                return(true);
            }

            return(false);
        }