Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            viewPorts = new BindingSource();
            windows = new BindingSource();
            viewPorts.DataSource = typeof(ViewPort);
            windows.DataSource = typeof(ViewPortForm);

            if (File.Exists(configFile))
            {
                loadedCfg = Helpers.LoadConfig(configFile);
                viewPorts.DataSource = (BindingList<ViewPort>)loadedCfg.ViewPorts;

            }
            else
            {// should move this to helper
                MessageBox.Show(configFile + " not found! Please create a config File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1
                   , MessageBoxOptions.ServiceNotification);
                this.Close();
            }

            foreach (ViewPort vp in viewPorts)
            {
                ViewPortForm vpWindow = new ViewPortForm(vp);
                vpWindow.Size = new Size(vp.SizeX, vp.SizeY);
                vpWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                vpWindow.Text = vp.Name;
                vpWindow.Show();
                vpWindow.DesktopLocation = new Point(vp.ScreenPositionX, vp.ScreenPositionY);
                windows.Add(vpWindow);
            }

        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            viewPorts            = new BindingSource();
            windows              = new BindingSource();
            viewPorts.DataSource = typeof(ViewPort);
            windows.DataSource   = typeof(ViewPortForm);

            if (File.Exists(configFile))
            {
                loadedCfg            = Helpers.LoadConfig(configFile);
                viewPorts.DataSource = (BindingList <ViewPort>)loadedCfg.ViewPorts;
            }
            else
            {// should move this to helper
                MessageBox.Show(configFile + " not found! Please create a config File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1
                                , MessageBoxOptions.ServiceNotification);
                this.Close();
            }

            foreach (ViewPort vp in viewPorts)
            {
                ViewPortForm vpWindow = new ViewPortForm(vp);
                vpWindow.Size            = new Size(vp.SizeX, vp.SizeY);
                vpWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                vpWindow.Text            = vp.Name;
                vpWindow.Show();
                vpWindow.DesktopLocation = new Point(vp.ScreenPositionX, vp.ScreenPositionY);
                windows.Add(vpWindow);
            }
        }
Beispiel #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            viewPorts            = new BindingSource();
            windows              = new BindingSource();
            viewPorts.DataSource = typeof(ViewPort);
            windows.DataSource   = typeof(ViewPortForm);

            if (File.Exists(configFile))
            {
                loadedCfg            = Helpers.LoadConfig(configFile);
                viewPorts.DataSource = (BindingList <ViewPort>)loadedCfg.ViewPorts;
            }
            else
            {// should move this to helper
                MessageBox.Show(configFile + " not found! Please create a config File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1
                                , MessageBoxOptions.ServiceNotification);
                this.Close();
            }

            foreach (ViewPort vp in viewPorts)
            {
                ViewPortForm vpWindow = new ViewPortForm(vp);
                vpWindow.MinimumSize     = new Size(16, 16);
                vpWindow.Size            = new Size(vp.SizeX, vp.SizeY);
                vpWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                vpWindow.Text            = vp.Name;
                vpWindow.Show();
                vpWindow.DesktopLocation = new Point(vp.ScreenPositionX, vp.ScreenPositionY);
                if (vp.Name == "Background")
                {
                    // This is the special case viewport used for the background to avoid us
                    // having to set a desktop background and remove all of the icons
                    vpWindow.SendToBack();
                    vpWindow.BackColor = System.Drawing.Color.FromArgb(0x5b, 0x7e, 0x96);
                }
                windows.Add(vpWindow);
            }
            // Minimize the parent form.
            this.WindowState = FormWindowState.Minimized;
        }