public static void CloseIfNotMainWindow(this FrameworkElement element, bool dialogResult)
        {
            WindowBase parentWindow = element.GetParentWindow();

            if (parentWindow == null || parentWindow == Application.Current.MainWindow)
            {
                return;
            }

            //parentWindow.DialogResult = dialogResult;
            //if (System.Windows.Interop.ComponentDispatcher.IsThreadModal)
            //if (parentWindow.IsModel)
            //{
            //}
            //else
            //{   // This is for closing the ControlDialog when not Modal
            //  parentWindow.SetPropertyValue("DialogResult", dialogResult);
            //}
            parentWindow.SetPropertyValue("DialogResult", dialogResult);

            parentWindow.Close();
        }
示例#2
0
    private void Test()
    {
        if (Application.platform == RuntimePlatform.Android && (Input.GetKeyDown(KeyCode.Escape)))
        {
            TipManager.Instance.Alert("", "你确定要退出游戏吗?", "确定", "取消", (res) =>
            {
                if (res)
                {
                    Application.Quit();
                }
            });
        }
        if (Input.GetKeyDown(KeyCode.F1))
        {
            WindowBase window = WindowManager.Instance.GetWindow(WindowID.MissionDebugAttach);
            if (null == window)
            {
                WindowManager.Instance.OpenWindow(WindowID.MissionDebugAttach);
            }
            else
            {
                if (window.IsOpen())
                {
                    window.Close();
                }
                else
                {
                    WindowManager.Instance.OpenWindow(WindowID.MissionDebugAttach);
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.C) || Input.touchCount == 3)
        {
            string filepath = ResourceManager.Instance.GetStreamAssetPath() + "/config.xml";

            ResourceManager.Instance.LoadStreamingAssetsData(filepath, (www) =>
            {
                SysConfig tmp = XmlConfigBase.DeSerialize <SysConfig>(www.text);
                Debuger.LogError("system config decode result : " + tmp == null);
                if (tmp != null)
                {
                    Debuger.LogError(tmp.ServerConfigPath);
                    Debuger.LogError(tmp.ClientConfigPath);
                    Debuger.LogError(tmp.ExcelPath);
                    Debuger.LogError(tmp.ConfigCenterUrl);
                    Debuger.LogError(tmp.UploadUrl);

                    Debuger.LogError("begin encode resoult");
                    string res = XmlConfigBase.Serialize(tmp);
                    Debuger.LogError("encode result:" + res);
                    FileUtils.WriteStringFile(Application.persistentDataPath + "/tesw.xml", res);

                    tmp = XmlConfigBase.DeSerialize <SysConfig>(res);
                    Debuger.LogError("xxx system config decode result : " + tmp == null);
                    if (tmp != null)
                    {
                        Debuger.LogError(tmp.ServerConfigPath);
                        Debuger.LogError(tmp.ClientConfigPath);
                        Debuger.LogError(tmp.ExcelPath);
                        Debuger.LogError(tmp.ConfigCenterUrl);
                        Debuger.LogError(tmp.UploadUrl);

                        Debuger.LogError("begin encode resoult");
                        res = XmlConfigBase.Serialize(tmp);
                        Debuger.LogError("encode result:" + res);
                        FileUtils.WriteStringFile(Application.persistentDataPath + "/tesw1.xml", res);
                    }
                }
            });
        }
    }