Exemple #1
0
        public int CreateWindows()
        {
            var windows = 0;

            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, (IntPtr hMonitor, IntPtr hdcMonitor, ref RECT rect, IntPtr data) => {
                Debug.WriteLine($"monitor: {hMonitor}");

                var info = new MonitorInfo();
                info.Init();
                GetMonitorInfo(hMonitor, ref info);

                var vm = new RoomAndNoModel(info, Settings);

                var win = new MainView {
                    Left        = info.rcWork.Left,
                    Top         = info.rcWork.Top,
                    Width       = info.rcWork.Width,
                    Height      = info.rcWork.Height,
                    DataContext = vm
                                  //      Background = new ImageBrush(new BitmapImage(new Uri("ThinClientBackroundImage.jpg", UriKind.Relative)))
                };
                _screens.Add(vm);

                vm.setNetworkChangeEvent();
                win.Show();
                windows++;
                return(true);
            }, IntPtr.Zero);


            return(windows);
        }
Exemple #2
0
        public int CreateWindows()
        {
            var windows = 0;

            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, (IntPtr hMonitor, IntPtr hdcMonitor, ref RECT rect, IntPtr data) => {
                Debug.WriteLine($"monitor: {hMonitor}");

                var info = new MonitorInfo();
                info.Init();
                GetMonitorInfo(hMonitor, ref info);

                var vm  = new BgViewModel(info, Settings);
                var win = new MainView {
                    Left        = info.rcWork.Left,
                    Top         = info.rcWork.Top,
                    Width       = info.rcWork.Width,
                    Height      = info.rcWork.Height,
                    DataContext = vm
                };
                _screens.Add(vm);

                win.Show();
                windows++;
                return(true);
            }, IntPtr.Zero);

            return(windows);
        }
Exemple #3
0
        public void CreateWindows()
        {
            var windows = 0;

            foreach (var window in _windows)
            {
                window.AllowClose = true;
                window.Hide();
            }

            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, (IntPtr hMonitor, IntPtr hdcMonitor, ref Common.Rect rect, IntPtr data) =>
            {
                if (Settings.Monitor == null || Settings.Monitor == windows)
                {
                    var info = new MonitorInfo();
                    info.Init();
                    GetMonitorInfo(hMonitor, ref info);

                    var mainWindow = new MainWindow
                    {
                        Left        = info.rcWork.Left,
                        Top         = info.rcWork.Top,
                        Width       = info.rcWork.Width,
                        Height      = info.rcWork.Height,
                        DataContext = new MainWindowViewModel(Settings)
                    };

                    mainWindow.Show();
                    _windows.Add(mainWindow);
                }

                windows++;
                return(true);
            }, IntPtr.Zero);

            foreach (var window in _windows)
            {
                if (window.AllowClose)
                {
                    window.Close();
                }
            }
            _windows.RemoveAll(x => x.AllowClose == true);
        }