Exemplo n.º 1
0
        public static void Show(Action callback, string mes = "有一种幸福,叫做等待...")
        {
            WaitingBox win = new WaitingBox(callback);

            win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            win.Text = mes;
            win.ShowDialog();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 显示等待框,owner指定宿主视图元素,callback为需要执行的方法体(需要自己做异常处理)。
        /// 目前等等框为模式窗体
        /// </summary>
        public static void Show(FrameworkElement owner, Action callback, string mes = "有一种幸福,叫做等待...")
        {
            WaitingBox win  = new WaitingBox(callback);
            Window     pwin = Window.GetWindow(owner);

            win.Owner = pwin;
            win.Text  = mes;
            //var loc = owner.PointToScreen(new Point());
            //win.Left = loc.X + (owner.ActualWidth - win.Width) / 2;
            //win.Top = loc.Y + (owner.ActualHeight - win.Height) / 2;
            win.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            win.ShowDialog();
        }