Exemplo n.º 1
0
        /// <summary>
        /// Anti scintillement
        /// </summary>
        //protected override CreateParams CreateParams
        //{
        //    get
        //    {
        //        CreateParams cp = base.CreateParams;
        //        cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
        //        return cp;
        //    }
        //}

        public FenGoBot(string[] args)
        {
            InitializeComponent();
            timerSauvegarde          = new Timer();
            timerSauvegarde.Interval = 10000;
            timerSauvegarde.Tick    += timerSauvegarde_Tick;
            timerSauvegarde.Start();

            if (!Execution.DesignMode)
            {
                panelGrosRobot.Init();

                if (Screen.PrimaryScreen.Bounds.Width <= 1024)
                {
                    WindowState              = FormWindowState.Maximized;
                    FormBorderStyle          = FormBorderStyle.None;
                    tabControl.SelectedTab   = tabPandaNew;
                    tabControl.Location      = new Point(-14, -50);
                    tabControl.Width        += 100;
                    tabControl.Height       += 100;
                    panelConnexions.Visible  = false;
                    lblSimulation.Visible    = false;
                    switchBoutonSimu.Visible = false;
                    btnFenetre.Visible       = false;
                }
                else
                {
                    WindowState     = FormWindowState.Normal;
                    FormBorderStyle = FormBorderStyle.FixedSingle;
                }

                switchBoutonSimu.Value = Robots.Simulation;

                tabPrecedent = new Dictionary <TabPage, TabPage>();
                tabPrecedent.Add(tabControl.TabPages[0], null);
                for (int i = 1; i < tabControl.Controls.Count; i++)
                {
                    tabPrecedent.Add(tabControl.TabPages[i], (tabControl.TabPages[i - 1]));
                }

                List <String> fichiersElog = new List <string>();
                List <String> fichiersTlog = new List <string>();

                foreach (String chaine in args)
                {
                    if (Path.GetExtension(chaine) == ".elog")
                    {
                        fichiersElog.Add(chaine);
                    }
                    if (Path.GetExtension(chaine) == FramesLog.FileExtension)
                    {
                        fichiersTlog.Add(chaine);
                    }
                }

                if (fichiersElog.Count > 0)
                {
                    foreach (String fichier in fichiersElog)
                    {
                        panelLogsEvents.ChargerLog(fichier);
                    }
                    panelLogsEvents.Afficher();

                    if (fichiersTlog.Count == 0)
                    {
                        tabControl.SelectedTab     = tabLogs;
                        tabControlLogs.SelectedTab = tabLogEvent;
                    }
                }

                if (fichiersTlog.Count > 0)
                {
                    foreach (String fichier in fichiersTlog)
                    {
                        pnlLogFrames.LoadLog(fichier);
                    }
                    pnlLogFrames.DisplayLog();

                    tabControl.SelectedTab     = tabLogs;
                    tabControlLogs.SelectedTab = tabLogUDP;
                }

                Instance = this;

                GameBoard.MyColor = GameBoard.ColorLeftBlue;

                Connections.ConnectionMove.SendMessage(UdpFrameFactory.DemandeCouleurEquipe());
            }

            Connections.StartConnections();

            SplashScreen.CloseSplash(-1);

            pnlPower.StartGraph();

            pnlNumericIO.SetBoard(Board.RecIO);
            pnlNumericMove.SetBoard(Board.RecMove);

            panelTable.StartDisplay();

            _pagesInWindow = new List <TabPage>();

            this.Text = "GoBot 2020 - Beta";
        }