Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            MainWindow = new MainWindow() { DataContext = new MainViewModel() { Apa = "Hej" } };
            MainWindow.Show();

            base.OnStartup(e);
        }
Example #2
0
        private void Application_Startup(object sender, System.Windows.StartupEventArgs e)
        {
            mainWin = new MainWindow();

            Screen mainScreen = GetMainScreen();

            mainWin.WindowStartupLocation = WindowStartupLocation.Manual;
            var mainLocation = mainScreen.WorkingArea.Location;
            mainWin.Left = mainLocation.X;
            mainWin.Top = mainLocation.Y;
            //mainWin.Height = mainScreen.Bounds.Height;
            //mainWin.Width = mainScreen.Bounds.Width;
            mainWin.Topmost = true;
            mainWin.Background = new SolidColorBrush(Colors.Black);
            mainWin.WindowStyle = WindowStyle.None;
            mainWin.Show();
            mainWin.WindowState = WindowState.Maximized;

            //mainWin.Focus();

            if (Screen.AllScreens.Length > 1)
            {

                Screen secondScreen = GetSecondaryScreen();
                if (secondScreen != null)
                {
                    secondWin = new MainWindow();

                    secondWin.WindowStartupLocation = WindowStartupLocation.Manual;
                    var location = secondScreen.WorkingArea.Location;
                    secondWin.Left = location.X;
                    secondWin.Top = location.Y;
                    secondWin.Height = secondScreen.Bounds.Height;
                    secondWin.Width = secondScreen.Bounds.Width;
                    secondWin.Topmost = true;
                    secondWin.Background = new SolidColorBrush(Colors.Black);
                    secondWin.WindowStyle = WindowStyle.None;
                    secondWin.Show();
                    //secondWin.Focus();
                }

            }
        }