예제 #1
0
        public BO_Param(FormMain parent, String NomFichierXML)
        {
            this.parent = parent;
            this.NomFichierXML = NomFichierXML;

            // création des 3 tableaux pour les 3 onglets

            ReadFile_General = new string[5];
            ReadFile_RS232 = new string[8];
            ReadFile_Graphiques = new string[9];
            WriteFile_General = new string[5];
            WriteFile_RS232 = new string[8];
            WriteFile_Graphiques = new string[9];

            int i;

            for (i = 0; i < 5; i++)
            {
                ReadFile_General[i] = parent.SM.file.Tables["GENERAL"].Rows[0].ItemArray[i].ToString();
            }

            for (i = 0; i < 8; i++)
            {
                ReadFile_RS232[i] = parent.SM.file.Tables["RS232"].Rows[0].ItemArray[i].ToString();
            }

            for (i = 0; i < 9; i++)
            {
                ReadFile_Graphiques[i] = parent.SM.file.Tables["GRAPHIQUES"].Rows[0].ItemArray[i].ToString();
            }

            // création de la fenêtre de config

            Configuration = new FormParam(NomFichierXML, this, parent);
            Configuration.Show();
        }
        public void initialisation(FormMain parent, String NomFichierXML)
        {
            this.parent        = parent;
            this.NomFichierXML = NomFichierXML;

            // lecture du fichier XML
            filedata = new xml_reader(NomFichierXML);
            file     = filedata.getFileSet();

            // creation de la BO graphes/BD
            BO_graphiques = new BO_Graphes(this);

            // creation de la BO de communication serie

            string[] tabSerie = new String[8];

            chargementRS232(tabSerie);

            BO_communication = new BO_serie(this, Convert.ToInt32(tabSerie[0]),
                                            Convert.ToInt32(tabSerie[1]),
                                            tabSerie[2],
                                            tabSerie[3],
                                            Convert.ToInt32(tabSerie[4]),
                                            Convert.ToInt32(tabSerie[5]),
                                            Convert.ToInt32(tabSerie[6]),
                                            Convert.ToInt32(tabSerie[7])
                                            );
            //flag_A);

            // création des class
            ConsignesBallasts  = new MoteursBallasts();
            PositionsBallasts  = new CapteursBallasts();
            ConsignePropulsion = new MoteursPropulsion();
            VitessesPropulsion = new CapteursPropulsion();
            Profondeur         = new CapteurProfondeur();
            Inclinaison        = new CapteurInclinaison();

            // création de la fenêtre télécommande
            Telecommande = new FormTelecommande(this);

            // initialisation positions et tailles des fenêtres
            initialisationFenetres();

            // rafraichissement automatique de la BD
            TimerRafraichissementBD          = new Timer();
            TimerRafraichissementBD.Interval = 1000;
            TimerRafraichissementBD.Tick    += new EventHandler(TimerRafraichissementBD_Tick);

            // mise à jour des valeurs
            RafraichissementParamGeneraux();
            RafraichissementTelecommande();
            RafraichissementGraphiques();
            BO_graphiques.RafraichissementGraphes();
            BO_graphiques.StartRafraichissementGraphes();

            // affichage des fenêtres
            Telecommande.MdiParent = parent;
            Telecommande.Show();
            BO_graphiques.Graphiques.MdiParent = parent;
            BO_graphiques.Graphiques.Show();
            BO_communication.Console.MdiParent = parent;
            BO_communication.Console.Show();

            // rafraichissement automatique de la télécommande
            TimerTelecommande          = new Timer();
            TimerTelecommande.Interval = 1000;
            TimerTelecommande.Start();
            TimerTelecommande.Tick += new EventHandler(TimerTelecommande_Tick);

            // rafraichissement automatique de la console
            compteurARebours          = new Timer();
            compteurARebours.Interval = 1;
            compteurARebours.Start();
            compteurARebours.Tick += new EventHandler(compteurARebours_Tick);
        }
 public SousMarin(FormMain parent, String NomFichierXML)
 {
     initialisation(parent, NomFichierXML);
 }
        public FormParam(String NomFichierXML, BO_Param parent, FormMain main)
        {
            InitializeComponent();

            // intégration de la form FormParam_OngletGeneral dans le 1er tab
            General = new FormParam_OngletGeneral();
            General.TopLevel = false;
            General.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[0].Controls.Add(General);
            General.Size = OngletsParam.TabPages[0].ClientSize;
            General.Show();

            // intégration de la form FormParam_OngletRS232 dans le 2e tab
            RS232 = new FormParam_OngletRS232();
            RS232.TopLevel = false;
            RS232.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[1].Controls.Add(RS232);
            RS232.Size = OngletsParam.TabPages[1].ClientSize;
            RS232.Show();

            // intégration de la form FormParam_OngletGraphiques dans le 3e tab
            Graphiques = new FormParam_OngletGraphiques();
            Graphiques.TopLevel = false;
            Graphiques.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[2].Controls.Add(Graphiques);
            Graphiques.Size = OngletsParam.TabPages[2].ClientSize;
            Graphiques.Show();

            // intégration de la form FormParam_OngletBD dans le 4e tab
            BaseDeDonnees = new FormParam_OngletBD(this);
            BaseDeDonnees.TopLevel = false;
            BaseDeDonnees.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[3].Controls.Add(BaseDeDonnees);
            BaseDeDonnees.Size = OngletsParam.TabPages[3].ClientSize;
            BaseDeDonnees.Show();

            // set dans l'onglet du get dans la BO
            this.parent = parent;
            this.main = main;

            General.setText_nomSM(parent.getNom());
            General.setText_poidsSM(parent.getPoids());
            General.setText_longueurSM(parent.getLongueur());
            General.setText_largeurSM(parent.getLargeur());
            General.setText_hauteurSM(parent.getHauteur());

            RS232.setText_baudrate(parent.getBaudrate());
            RS232.setText_nbBits(parent.getNombreDeBits());
            RS232.setText_nbBitsStop(parent.getNombreDeBitsDeStop());
            RS232.setText_parity(parent.getParite());
            RS232.setText_timeOutSortie(parent.getTimeOutSortie());
            RS232.setText_timeOutEntree(parent.getTimeOutEntree());
            RS232.setText_bufferEntree(parent.getTailleBufferEntree());
            RS232.setText_bufferSortie(parent.getTailleBufferSortie());

            Graphiques.setText_TauxRafraichissement(Convert.ToInt16(parent.getTauxRafraichissement()));
            Graphiques.setText_TailleFenetre(Convert.ToInt16(parent.getTailleFenetre()));
            Graphiques.setText_CapteurGraphe1(parent.getCapteurGraphe1());
            Graphiques.setText_CouleurCourbe1(parent.getCouleurCourbe1());
            Graphiques.setText_CouleurFond1(parent.getCouleurFond1());
            Graphiques.setText_CapteurGraphe2(parent.getCapteurGraphe2());
            Graphiques.setText_CouleurCourbe2(parent.getCouleurCourbe2());
            Graphiques.setText_CouleurFond2(parent.getCouleurFond2());

            BaseDeDonnees.setCheckboxAcquisition(parent.getActivationAcquisition());
        }
        public FormParam(String NomFichierXML, BO_Param parent, FormMain main)
        {
            InitializeComponent();

            // intégration de la form FormParam_OngletGeneral dans le 1er tab
            General                 = new FormParam_OngletGeneral();
            General.TopLevel        = false;
            General.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[0].Controls.Add(General);
            General.Size = OngletsParam.TabPages[0].ClientSize;
            General.Show();

            // intégration de la form FormParam_OngletRS232 dans le 2e tab
            RS232                 = new FormParam_OngletRS232();
            RS232.TopLevel        = false;
            RS232.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[1].Controls.Add(RS232);
            RS232.Size = OngletsParam.TabPages[1].ClientSize;
            RS232.Show();

            // intégration de la form FormParam_OngletGraphiques dans le 3e tab
            Graphiques                 = new FormParam_OngletGraphiques();
            Graphiques.TopLevel        = false;
            Graphiques.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[2].Controls.Add(Graphiques);
            Graphiques.Size = OngletsParam.TabPages[2].ClientSize;
            Graphiques.Show();

            // intégration de la form FormParam_OngletBD dans le 4e tab
            BaseDeDonnees                 = new FormParam_OngletBD(this);
            BaseDeDonnees.TopLevel        = false;
            BaseDeDonnees.FormBorderStyle = FormBorderStyle.None;
            OngletsParam.TabPages[3].Controls.Add(BaseDeDonnees);
            BaseDeDonnees.Size = OngletsParam.TabPages[3].ClientSize;
            BaseDeDonnees.Show();

            // set dans l'onglet du get dans la BO
            this.parent = parent;
            this.main   = main;

            General.setText_nomSM(parent.getNom());
            General.setText_poidsSM(parent.getPoids());
            General.setText_longueurSM(parent.getLongueur());
            General.setText_largeurSM(parent.getLargeur());
            General.setText_hauteurSM(parent.getHauteur());

            RS232.setText_baudrate(parent.getBaudrate());
            RS232.setText_nbBits(parent.getNombreDeBits());
            RS232.setText_nbBitsStop(parent.getNombreDeBitsDeStop());
            RS232.setText_parity(parent.getParite());
            RS232.setText_timeOutSortie(parent.getTimeOutSortie());
            RS232.setText_timeOutEntree(parent.getTimeOutEntree());
            RS232.setText_bufferEntree(parent.getTailleBufferEntree());
            RS232.setText_bufferSortie(parent.getTailleBufferSortie());

            Graphiques.setText_TauxRafraichissement(Convert.ToInt16(parent.getTauxRafraichissement()));
            Graphiques.setText_TailleFenetre(Convert.ToInt16(parent.getTailleFenetre()));
            Graphiques.setText_CapteurGraphe1(parent.getCapteurGraphe1());
            Graphiques.setText_CouleurCourbe1(parent.getCouleurCourbe1());
            Graphiques.setText_CouleurFond1(parent.getCouleurFond1());
            Graphiques.setText_CapteurGraphe2(parent.getCapteurGraphe2());
            Graphiques.setText_CouleurCourbe2(parent.getCouleurCourbe2());
            Graphiques.setText_CouleurFond2(parent.getCouleurFond2());

            BaseDeDonnees.setCheckboxAcquisition(parent.getActivationAcquisition());
        }
        public void initialisation(FormMain parent, String NomFichierXML)
        {
            this.parent = parent;
            this.NomFichierXML = NomFichierXML;

            // lecture du fichier XML
            filedata = new xml_reader(NomFichierXML);
            file = filedata.getFileSet();

            // creation de la BO graphes/BD
            BO_graphiques = new BO_Graphes(this);

            // creation de la BO de communication serie

            string[] tabSerie = new String[8];

            chargementRS232(tabSerie);

            BO_communication = new BO_serie(this, Convert.ToInt32(tabSerie[0]),
                                                    Convert.ToInt32(tabSerie[1]),
                                                    tabSerie[2],
                                                    tabSerie[3],
                                                    Convert.ToInt32(tabSerie[4]),
                                                    Convert.ToInt32(tabSerie[5]),
                                                    Convert.ToInt32(tabSerie[6]),
                                                    Convert.ToInt32(tabSerie[7])
                                                    );
                                                    //flag_A);

            // création des class
            ConsignesBallasts = new MoteursBallasts();
            PositionsBallasts = new CapteursBallasts();
            ConsignePropulsion = new MoteursPropulsion();
            VitessesPropulsion = new CapteursPropulsion();
            Profondeur = new CapteurProfondeur();
            Inclinaison = new CapteurInclinaison();

            // création de la fenêtre télécommande
            Telecommande = new FormTelecommande(this);

            // initialisation positions et tailles des fenêtres
            initialisationFenetres();

            // rafraichissement automatique de la BD
            TimerRafraichissementBD = new Timer();
            TimerRafraichissementBD.Interval = 1000;
            TimerRafraichissementBD.Tick += new EventHandler(TimerRafraichissementBD_Tick);

            // mise à jour des valeurs
            RafraichissementParamGeneraux();
            RafraichissementTelecommande();
            RafraichissementGraphiques();
            BO_graphiques.RafraichissementGraphes();
            BO_graphiques.StartRafraichissementGraphes();

            // affichage des fenêtres
            Telecommande.MdiParent = parent;
            Telecommande.Show();
            BO_graphiques.Graphiques.MdiParent = parent;
            BO_graphiques.Graphiques.Show();
            BO_communication.Console.MdiParent = parent;
            BO_communication.Console.Show();

            // rafraichissement automatique de la télécommande
            TimerTelecommande = new Timer();
            TimerTelecommande.Interval = 1000;
            TimerTelecommande.Start();
            TimerTelecommande.Tick += new EventHandler(TimerTelecommande_Tick);

            // rafraichissement automatique de la console
            compteurARebours = new Timer();
            compteurARebours.Interval = 1;
            compteurARebours.Start();
            compteurARebours.Tick += new EventHandler(compteurARebours_Tick);
        }
 public SousMarin(FormMain parent, String NomFichierXML)
 {
     initialisation(parent, NomFichierXML);
 }