Пример #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="ViewDialog"/>
        /// </summary>
        public ViewDialog()
        {
            InitializeComponent();

            //暂时为自动化测试关闭回车自动确定的功能
            this.YesAsDefault = false;

            WPFHelper.SetTrackFocusScope(this);
        }
Пример #2
0
        /// <summary>
        /// 弹出登录窗口,并返回是否登录成功
        /// </summary>
        /// <returns></returns>
        private bool TryLogin()
        {
            if (LoginWindowType != null)
            {
                var loginWindow = Activator.CreateInstance(LoginWindowType) as Window;
                if (loginWindow == null)
                {
                    throw new InvalidProgramException("LoginWindowType 必须是一个 Window 类型。");
                }

                loginWindow.Owner = _wpfApp.MainWindow;

                WPFHelper.SetTrackFocusScope(loginWindow);

                var result = loginWindow.ShowDialog().GetValueOrDefault();
                return(result);
            }

            return(true);
        }