Beispiel #1
0
        public override void Execute(LogicalView view)
        {
            var curControl = GetParentLayout(view.Control);

            if (curControl == null)
            {
                return;
            }

            view.IsActive = true;

            var oldPrent = curControl.Parent;

            curControl.RemoveFromParent(false);

            double initScale = GetInitScale(curControl);  //必须放在 parent.Content = null;之前

            //Title
            var title = string.Empty;

            if (view.ChildBlock == null)
            {
                title = view.Meta.Label;
            }
            else
            {
                title = view.ChildBlock.ViewMeta.Label;
            }

            //window
            App.Windows.ShowDialog(curControl, win =>
            {
                win.ResizeMode = ResizeMode.CanResize;
                win.Title      = title.Translate();
                win.Buttons    = ViewDialogButtons.None;

                #region 窗体设置

                //不要显示最大化,根据屏幕分辨率获取高度和宽度,上面留一块儿
                win.WindowStartupLocation = WindowStartupLocation.Manual;
                win.Top     = 100;
                win.Left    = 0;
                win.Width   = SystemParameters.PrimaryScreenWidth;
                win.Height  = SystemParameters.PrimaryScreenHeight - 200;
                win.Topmost = false;

                #endregion

                Zoom.EnableZoom(win, initScale);
            });

            curControl.LayoutTransform = null;
            curControl.RemoveFromParent();

            curControl.AttachToParent(oldPrent);
        }