Exemple #1
0
        public void CloseWindow(IWindow iwindow)
        {
            try
            {
                WindowInfo windowInfo = iwindow.windowInfo;

                if (!mShownWindowDic.ContainsKey(windowInfo))
                {
                    Log.Error(string.Format("mAllWindowDic does not contains {0}. THAT IS SO NOT RIGHT !", windowInfo.name));
                    return;
                }

                if (windowInfo.showMode == ShowMode.Normal)
                {
                    if (mWindowStack.Count > 0)
                    {
                        var topStackdata = mWindowStack.Peek();
                        if (topStackdata.windowInfo != windowInfo)
                        {
                            Log.Error(string.Format("You shall not close {0} in this way !", windowInfo.name));
                            return;
                        }

                        this.PushToWindowCache(iwindow, true);

                        switch (windowInfo.openAction)
                        {
                        case OpenAction.HideAll:
                        case OpenAction.HideNormalsMains:
                            for (int i = 0; i < topStackdata.historyWindows.Count; ++i)
                            {
                                IWindow tempScript = topStackdata.historyWindows[i];
                                this.PullFromWindowCache(tempScript.windowInfo, false, null);
                            }
                            break;

                        case OpenAction.DoNothing:
                        default:
                            break;
                        }
                        mWindowStack.Pop();
                    }
                    else                     // some error happened in stack...
                    {
                        WindowInfo previousWindowInfo = iwindow.PreviousWindowInfo;
                        this.PushToWindowCache(iwindow, true);
                        // open default previous window.
                        OpenWindow(previousWindowInfo);
                    }
                }
                else if (windowInfo.showMode == ShowMode.Popup)
                {
                    this.PushToWindowCache(iwindow, true);
                }
                else
                {
                    Log.Error("You are trying to close a window with ShowMode which is neither 'Normal' nor 'Popup', which shouldn't happen. Check the window's WindowInfo.");
                }
            }
            catch (UnityException ue)
            {
                Log.Error(ue.ToString());
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
Exemple #2
0
        public void CloseWindow(WindowInfo windowInfo)
        {
            IWindow iwindow = this.GetWindow(windowInfo);

            this.CloseWindow(iwindow);
        }