示例#1
0
        public Window CreateWindow(object key, WindowManagerWindowArgs args = null)
        {
            var newWindow = CreateWindowBase(key, args);

            newWindow.Show();
            return(newWindow);
        }
示例#2
0
        private Window CreateWindowBase(object key, WindowManagerWindowArgs args = null)
        {
            var args1     = args ?? WindowManagerWindowArgs.CreateDefault();
            var newWindow = new Window {
                Content = key,
                WindowStartupLocation = args1.WindowStartupLocation,
                SizeToContent         = args1.SizeToContent,
                AllowsTransparency    = args1.AllowTransparency,
                WindowStyle           = args1.WindowStyle,
                Opacity       = args1.Opacity,
                Topmost       = args1.Topmost,
                Background    = Brushes.Transparent,
                ShowInTaskbar = args1.ShowInTaskBar,
            };

            KeyToWindow.Add(key, newWindow);
            return(newWindow);
        }
示例#3
0
        public Window CreateCenteredWindow(object key, Screen screen)
        {
            var args = new WindowManagerWindowArgs(
                WindowStartupLocation.Manual,
                SizeToContent.WidthAndHeight,
                true,
                WindowStyle.None,
                1,
                true,
                false);
            var newWindow = CreateWindowBase(key, args);

            newWindow.Show();

            var scale = GetWindowsScale();

            newWindow.Left = screen.Bounds.Left + screen.Bounds.Width / (2 * scale) - newWindow.Width / 2;
            newWindow.Top  = screen.Bounds.Top + screen.Bounds.Height / (2 * scale) - newWindow.Height / 2;

            return(newWindow);
        }