Example #1
0
        /// <summary>
        /// Sets up all windows of the application, showing the match
        /// information window on the secondary screen, if possible.
        /// </summary>
        private void SetupForms()
        {
            // maximize main form
            mainForm             = new MainForm(this);
            mainForm.WindowState = FormWindowState.Maximized;

            // create new match form
            matchForm = new MatchForm();

            // move match form to secondary screen, if possible
            if (Screen.AllScreens.Length > 1)
            {
                foreach (Screen screen in Screen.AllScreens)
                {
                    if (!screen.Primary)
                    {
                        matchForm.StartPosition = FormStartPosition.Manual;
                        matchForm.Location      = screen.WorkingArea.Location;
                        break;
                    }
                }
            }

            // maximize and show match form
            matchForm.WindowState = FormWindowState.Maximized;
            matchForm.Show();
        }
Example #2
0
        private void tsOrder_Click(object sender, EventArgs e)
        {
            switch ((sender as ToolStripMenuItem).Name)
            {
            case "tsOrder":
                if (!OrderForm.Created)
                {
                    OrderForm.Show(dockPanel1, DockState.Document);
                }
                OrderForm.Activate();
                break;

            case "tsCancel":
                if (!CancelForm.Created)
                {
                    CancelForm.Show(dockPanel1, DockState.Document);
                }
                CancelForm.Activate();
                break;

            case "tsMatch":
                if (!MatchForm.Created)
                {
                    MatchForm.Show(dockPanel1, DockState.Document);
                }
                MatchForm.Activate();
                break;

            case "tsError":
                if (!ErrForm.Created)
                {
                    ErrForm.Show(dockPanel1, DockState.Document);
                }
                ErrForm.Activate();
                break;

            case "tsSummary":
                if (!SummaryForm.Created)
                {
                    SummaryForm.Show(dockPanel1, DockState.Document);
                }
                SummaryForm.Activate();
                break;

            case "tsPosition":
                if (!PositionForm.Created)
                {
                    PositionForm.Show(dockPanel1, DockState.Document);
                }
                PositionForm.Activate();
                break;
            }
        }
Example #3
0
        /// <summary>
        /// 載入視窗設定
        /// </summary>
        private void LoadLayout()
        {
            int[] bounds = Array.ConvertAll(Utility.Load <string>("FORM", "LOCATION").Split(','), (input) =>
            {
                int re = default(int);
                int.TryParse(input, out re);
                return(re);
            });
            if (!File.Exists(m_DockLayoutFile))
            {
                SettingForm.Show(dockPanel1, DockState.DockRight);
                OrderSettingForm.Show(SettingForm.Pane, SettingForm);
                LogForm.Show(dockPanel1, DockState.DockBottomAutoHide);

                frmTick tick = Core.Instance.CreateTickForm(string.Empty);
                if (tick != null)
                {
                    tick.Show(dockPanel1);
                }
                OrderForm.Show(tick.Pane, DockAlignment.Right, 0.6);
                MatchForm.Show(OrderForm.Pane, DockAlignment.Bottom, 0.5);
            }
            else
            {
                dockPanel1.LoadFromXml(m_DockLayoutFile, delegate(string persistString)
                {
                    if (persistString == typeof(frmSetting).ToString())
                    {
                        return(SettingForm);
                    }
                    if (persistString == typeof(frmLog).ToString())
                    {
                        return(LogForm);
                    }
                    if (persistString == typeof(frmOrder).ToString())
                    {
                        return(OrderForm);
                    }
                    if (persistString == typeof(frmSummary).ToString())
                    {
                        return(SummaryForm);
                    }
                    if (persistString == typeof(frmMatch).ToString())
                    {
                        return(MatchForm);
                    }
                    if (persistString == typeof(frmErr).ToString())
                    {
                        return(ErrForm);
                    }
                    if (persistString == typeof(frmCancel).ToString())
                    {
                        return(CancelForm);
                    }
                    if (persistString == typeof(frmPosition).ToString())
                    {
                        return(PositionForm);
                    }
                    if (persistString == typeof(frmOrderSetting).ToString())
                    {
                        return(OrderSettingForm);
                    }
                    if (persistString == typeof(frmTick).ToString())
                    {
                        return(Core.Instance.CreateTickForm(string.Empty));
                    }
                    return(null);
                });
            }
            if (bounds.Length == 4)
            {
                SetBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
            }
        }