예제 #1
0
        private void btSupSujet_Click(object sender, EventArgs e)
        {
            DialogResult dr = new DialogResult();

            dr = MessageBox.Show(Properties.Resources.MsgBoxDeleteSujetText, Properties.Resources.MsgBoxDeleteSujetTitre, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
            if (dr == DialogResult.OK)
            {
                if (Outil.DeleteSujet((int)cbBxSubject.SelectedValue) != 1)
                {
                    MessageBox.Show(Properties.Resources.MsgBoxErreurDeleteSujetText, Properties.Resources.MsgBoxErreurDeleteSujetTitre);
                }
                List <Subject> subjects = Outil.GetSujetsByCategorieID((int)cbBxRubric.SelectedValue);
                if (subjects != null)
                {
                    displaycbBxSubject(subjects);
                }
            }
            if (visibiliteSujets())
            {
                PanelSujetVisible();
            }
            else
            {
                PanelSujetInvisible();
            }
        }
예제 #2
0
        private void cbBxSubject_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (visibiliteSujets())
            {
                PanelSujetVisible();
                Subject subject = (Subject)cbBxSubject.SelectedItem;
                txtDescSujet.Text = subject.Desc + Environment.NewLine + "de, " + subject.Auteur + Environment.NewLine + "le, " + subject.Date;

                if (visibilitePost())
                {
                    PanelPostVisible();
                    List <Post> posts = Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue);
                    if (posts != null)
                    {
                        displaydgVPost(posts);
                    }
                }
                else
                {
                    PanelPostInvisible();
                }
            }
            else
            {
                PanelSujetInvisible();
            }
        }
예제 #3
0
        private void btSupPost_Click(object sender, EventArgs e)
        {
            DialogResult dr = new DialogResult();

            dr = MessageBox.Show(Properties.Resources.MsgBoxDeletePostText, Properties.Resources.MsgBoxDeletePostTitre, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
            if (dr == DialogResult.OK)
            {
                if (Outil.DeleteReponse((int)dGVPost.CurrentRow.Cells["ID"].Value) != 1)
                {
                    MessageBox.Show(Properties.Resources.MsgBoxErreurDeletePostText, Properties.Resources.MsgBoxErreurDeletePostTitre);
                }
                List <Post> posts = Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue);


                if (posts != null)
                {
                    displaydgVPost(posts);
                }

                if (visibilitePost())
                {
                    PanelPostVisible();
                }
                else
                {
                    PanelPostInvisible();
                }
            }
        }
예제 #4
0
        public void TestGetRubricByID()
        {
            string expectedString = "Entraide.com";
            Rubric rubric         = Outil.GetRubricByID(1);

            Assert.AreEqual(rubric.Libelle, expectedString);
        }
예제 #5
0
 public override void Draw(SpriteBatch spriteBatch) // la camera est celle du premier joueur, risque de bug en multi
 {
     CrystalGateGame.graphics.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0);
     spriteBatch.Begin(0, null, null, null, null, null, Outil.GetJoueur(Client.id).camera.CameraMatrix);
     // DRAW Map
     Map.Draw(spriteBatch);
     // DRAW EFFETS
     foreach (Effet e in Map.effets)
     {
         e.Draw(spriteBatch);
     }
     // DRAW ITEMS
     foreach (Item i in Map.items)
     {
         spriteBatch.Draw(PackTexture.tresor, i.Position * Map.TailleTiles, Color.White);
     }
     // DRAW UNITES
     foreach (Unite o in Map.unites)
     {
         o.Draw(spriteBatch);
     }
     // DRAW INTERFACE
     Outil.GetJoueur(Client.id).Interface.Draw();
     // DRAW STRINGS
     /*spriteBatch.DrawString(gameFont, SceneHandler.level, Vector2.Zero, Color.White);*/
     spriteBatch.End();
 }
예제 #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Elevator"))
     {
         _inElevator = true;
     }
     if (collision.transform.parent && collision.transform.parent.TryGetComponent <Machine>(out Machine comp) && collision.transform.CompareTag("Btn"))
     {
         if (collision.transform.name.Equals("LeftValve"))
         {
             _valveIndex = 0;
         }
         else if (collision.transform.name.Equals("RightValve"))
         {
             _valveIndex = 1;
         }
         _MachineInContact = comp;
     }
     if (collision.CompareTag("Outil") && !hasTool)
     {
         if (collision.TryGetComponent <Outil>(out Outil outil))
         {
             outil.SetPosition(new Vector2(150, 0));
             _tool   = outil;
             hasTool = true;
         }
     }
 }
예제 #7
0
 private void btValider_Click(object sender, EventArgs e)
 {
     if (subject == null)
     {
         if (Outil.AddSujet(Accueil.CurrentUsers.Id, rubric.Id, txtBxTitreSujet.Text, txtBxDescSujet.Text) == 1)
         {
             MessageBox.Show(Properties.Resources.MsgBoxAddSujetText, Properties.Resources.MsgBoxAddSujetTitre, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show(Properties.Resources.MsgBoxErreurAddSujetText, Properties.Resources.MsgBoxErreurAddSujetTitre, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         }
     }
     else
     {
         if (Outil.ModifierSujet(subject.Id, subject.Titre, subject.Desc, txtBxTitreSujet.Text, txtBxDescSujet.Text) == 1)
         {
             MessageBox.Show(Properties.Resources.MsgBoxEditSujetText, Properties.Resources.MsgBoxEditSujetText, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show(Properties.Resources.MsgBoxErreurEditSujetText, Properties.Resources.MsgBoxErreurEditSujetTitre, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         }
     }
     this.Close();
 }
예제 #8
0
        static void Main(string[] args)
        {
            var outil    = new Outil();
            var s        = Console.ReadLine();
            var resultat = outil.Majuscule(s);

            Console.WriteLine(resultat);
            Console.ReadLine();
        }
예제 #9
0
 private void btCreerSujet_Click(object sender, EventArgs e)
 {
     using (frmCreerSujet creerSujet = new frmCreerSujet())
     {
         creerSujet.rubric = (Rubric)cbBxRubric.SelectedItem;
         creerSujet.Text   = string.Format("Ajouter le sujet dans la rubrique {0}", creerSujet.rubric.Libelle);
         creerSujet.ShowDialog();
         displaycbBxSubject(Outil.GetSujetsByCategorieID((int)cbBxRubric.SelectedValue));
     }
 }
예제 #10
0
 private void btCreerPost_Click(object sender, EventArgs e)
 {
     using (CreerPost frmCreerPost = new CreerPost())
     {
         frmCreerPost.subject = (Subject)cbBxSubject.SelectedItem;
         frmCreerPost.Text    = string.Format("Ajout du post au sujet {0}", frmCreerPost.subject.Titre);
         frmCreerPost.ShowDialog();
         displaydgVPost(Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue));
     }
 }
예제 #11
0
 private void btModifSujet_Click(object sender, EventArgs e)
 {
     using (frmCreerSujet Modifsubject = new frmCreerSujet())
     {
         Modifsubject.rubric  = (Rubric)cbBxRubric.SelectedItem;
         Modifsubject.subject = (Subject)cbBxSubject.SelectedItem;
         Modifsubject.Text    = string.Format("Changer le sujet {0} dans la rubrique {1}", Modifsubject.subject.Titre, Modifsubject.subject.Desc);
         Modifsubject.ShowDialog();
         displaycbBxSubject(Outil.GetSujetsByCategorieID((int)cbBxRubric.SelectedValue));
     }
 }
예제 #12
0
 private bool visibilitePost()
 {
     if (cbBxSubject.SelectedIndex != -1)
     {
         if (Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue) != null)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #13
0
 private bool visibiliteSujets()
 {
     if (cbBxRubric.SelectedIndex != -1)
     {
         if (Outil.GetSujetsByCategorieID((int)cbBxRubric.SelectedValue) != null)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #14
0
 private void btValider_Click(object sender, EventArgs e)
 {
     if (Outil.AddReponse(Accueil.CurrentUsers.Id, subject.Id, txtPostContent.Text) == 1)
     {
         MessageBox.Show(Properties.Resources.MsgBoxAddReponseText, Properties.Resources.MsgBoxAddReponseTitre, MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     else
     {
         MessageBox.Show(Properties.Resources.MsgBoxErreurAddReponseText, Properties.Resources.MsgBoxErreurAddReponseTitre, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
     }
 }
예제 #15
0
        private void btValider_Click(object sender, EventArgs e)
        {
            btValider.Visible = false;
            DialogResult dr = new DialogResult();

            dr = MessageBox.Show(Properties.Resources.MsgBoxConfirmChangementPasswordText, Properties.Resources.MsgBoxConfirmChangementPasswordTitre, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
            if (dr == DialogResult.Yes && (txtNewPwd.TextLength != txtConfirmNewPwd.TextLength) || !(string.IsNullOrWhiteSpace(txtNewPwd.Text) || string.IsNullOrWhiteSpace(txtConfirmNewPwd.Text)))
            {
                Outil.ModifierPassword(Accueil.CurrentUsers.Id, txtNewPwd.Text);
                btValider.Visible = true;
                Close();
            }
        }
예제 #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="idrubric"></param>
        /// <returns></returns>
        public List <Subject> GetSujetsByCategorieID(string idrubric)
        {
            int r; //Variable locale de retour (résultat)

            if (int.TryParse(idrubric, out r))
            {
                return(Outil.GetSujetsByCategorieID(r));
            }
            else
            {
                return(null);
            }
        }
예제 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id_subject"></param>
        /// <returns></returns>
        public List <Post> GetAllReponseBySujet(string id_subject)
        {
            int r; //Variable locale de retour (résultat)

            if (int.TryParse(id_subject, out r))
            {
                return(Outil.GetAllReponseBySujet(r));
            }
            else
            {
                return(null);
            }
        }
        public List <Subject> GetSujetsByCategorieID(string idrubric)
        {
            int r;

            if (int.TryParse(idrubric, out r))
            {
                return(Outil.GetSujetsByCategorieID(r));
            }
            else
            {
                return(null);
            }
        }
예제 #19
0
 private void btConnect_Click(object sender, EventArgs e)
 {
     Accueil.CurrentUsers = Outil.GetLoginPassword(txtLogin.Text, txtPwd.Text);
     if (Accueil.CurrentUsers != null)
     {
         Accueil.IsConnected = true;
         Accueil.IsRmodo     = Accueil.CurrentUsers.IsRmod;
         Close();
     }
     else
     {
         Accueil.IsConnected = false;
         MessageBox.Show("Votre Login ou votre mot de passe sont incorrect!", "Veuillez saisir vos identifiants svp", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #20
0
        private void cbBxRubric_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Subject> subjects = Outil.GetSujetsByCategorieID((int)cbBxRubric.SelectedValue);

            if (subjects != null)
            {
                PanelSujetVisible();
                displaycbBxSubject(subjects);
            }
            else
            {
                PanelSujetInvisible();
                PanelPostInvisible();
            }
        }
예제 #21
0
 private void OnDrop(InputValue value)
 {
     if (hasTool)
     {
         if (PlayerSprite.flipX)
         {
             _tool.SetPosition(new Vector2(transform.position.x - 3f, transform.position.y));
         }
         else
         {
             _tool.SetPosition(new Vector2(transform.position.x + 3f, transform.position.y));
         }
         hasTool = false;
         _tool   = null;
     }
 }
예제 #22
0
 public void DoRepareAction(ActionButtons btn, Outil t)
 {
     if (!isBroken || !_canPress)
     {
         return;
     }
     if (btn.Equals(_touche))
     {
         _pressCount++;
         _currentInactifTime = 0;
         _canPress           = false;
         t.CurrentUse++;
         StartCoroutine(CanPressAgain());
     }
     else if (!btn.Equals(ActionButtons.None))
     {
         _currentInactifTime = 0;
         _canPress           = false;
         t.CurrentUse++;
         StartCoroutine(CanPressAgain());
     }
 }
예제 #23
0
        public override void Update(GameTime gameTime)
        {
            FondSonore.Update();

            // On update les infos de la Map
            Map.Update(gameTime);
            // On update les infos des items
            foreach (Item i in Map.items)
            {
                i.Update(Map.unites);
            }
            // On update les infos des unites
            foreach (Unite u in Map.unites)
            {
                u.Update(Map.unites, Map.effets);
            }
            // On update les infos des joueurs
            Outil.GetJoueur(Client.id).Update(Map.unites);
            // On update les effets sur la carte
            foreach (Effet e in Map.effets)
            {
                e.Update();
            }
            // On update les infos des vagues
            foreach (Wave w in Map.waves)
            {
                w.Update(gameTime);
            }
            // Update de la physique
            Map.world.Step(1 / 40f);

            if (SceneEngine2.BaseScene.keyboardState.IsKeyDown(Keys.Escape) && !SceneEngine2.BaseScene.oldKeyboardState.IsKeyDown(Keys.Escape))
            {
                FondSonore.Pause();
                GamePlay.timer.Stop();
                SceneHandler.gameState = GameState.Pause;
            }
        }
예제 #24
0
        public void TestGetSujetByCategorieID()
        {
            //On instancie une liste de sujet, vide pour le moment
            List <Subject> sujetsAtt = new List <Subject>();

            //on instancie deux nouveaux sujets avec les ID 5 et 1
            Subject sujAtt = new Subject();

            sujAtt.Id = 31;

            Subject sujAtt1 = new Subject();

            sujAtt1.Id = 4;

            //on ajoute les sujets attendus dans la liste des sujets
            sujetsAtt.Add(sujAtt);
            sujetsAtt.Add(sujAtt1);

            //on instancie une liste de sujets retournés par la méthode GetSujetByCategorieID
            List <Subject> sujetsRet = new List <Subject>();

            sujetsRet = Outil.GetSujetsByCategorieID(2);
            CollectionAssert.AreEqual(sujetsAtt, sujetsRet);
        }
예제 #25
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public List <Rubric> GetAllCategories()
 {
     return(Outil.GetAllRubrics());
 }
예제 #26
0
    // Update is called once per frame
    void Update()
    {
        CheckIfAlive();
        Move();

        if (hasTool && _tool != null)
        {
            if (_tool.Useless)
            {
                hasTool = false;
                Destroy(_tool.gameObject);
                _tool = null;
            }
            _srKey.color = new Color(1, 1, 1, 1);
        }
        else
        {
            _srKey.color = new Color(1, 1, 1, 0);
        }

        if (IsAlive)
        {
            AnimateMovements();
            BePushed();
            FlipSprite();
        }

        if (_MachineInContact)
        {
            if (_MachineInContact.TryGetComponent <ValveMachine>(out ValveMachine comp))
            {
                var angle = Mathf.Round(_rotation.z);
                Angle = angle;
                if (angle == 0)
                {
                    comp.JoystickRotation(ActionButtons.None, _valveIndex);
                }
                else if (angle >= -45 && angle < 45)
                {
                    comp.JoystickRotation(ActionButtons.JoystickRight, _valveIndex);
                }
                else if (angle < -45 && angle > -135)
                {
                    comp.JoystickRotation(ActionButtons.JoystickBot, _valveIndex);
                }
                else if ((angle <= 180 && angle > 135) || (angle <= -135 && angle >= -180))
                {
                    comp.JoystickRotation(ActionButtons.JoystickLeft, _valveIndex);
                }
                else
                {
                    comp.JoystickRotation(ActionButtons.JoystickTop, _valveIndex);
                }
            }
            else if (_MachineInContact.TryGetComponent <MachineSpam>(out MachineSpam putainjesuisfatigue))
            {
                if (hasTool && _tool != null)
                {
                    putainjesuisfatigue.DoRepareAction(_activeBtn, _tool);
                }
            }
            _MachineInContact.Action(_activeBtn);
        }
    }
예제 #27
0
        public GoHInterface(bool isBackground)
        {
            this.LaListeDesCommandes = new ConcurrentBag <string>();

            this.IsBackground = isBackground;

            this.m_noir_Transparent = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));

            try
            {
                this.m_img = Get_Img_From_Bitmap(Resource1.kinect);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);

                //try
                //{
                //    this.m_img = new BitmapImage(new Uri(IMG_BACKGROUND));
                //}
                //catch (Exception ex2)
                //{
                //    Outil.Ecrire_Erreur(ex2);
                //    throw;
                //}

                throw;
            }



            string[] ts_Lines;

            string filePath;

            try
            {
                if (File.Exists(CONFIG_NAME))
                {
                    filePath = CONFIG_NAME;
                }
                else if (File.Exists(CONFIG_FOLDER + CONFIG_NAME))
                {
                    filePath = CONFIG_FOLDER + CONFIG_NAME;
                }
                else
                {
                    throw new ApplicationException(" Erreur : pas de fichier " + CONFIG_NAME);
                }

                Console.WriteLine(@" fichier de config : " + filePath);
                ts_Lines = File.ReadAllLines(filePath);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);
                throw;
            }


            if (string.IsNullOrWhiteSpace(ts_Lines[0]))
            {
                Console.WriteLine(@" Pas de parametre dans le fichier : ");
                Console.WriteLine(filePath);

                return;
            }
            else if (ts_Lines[0].StartsWith(@"http://"))
            {
                this.m_connection = new ClientGoHWeb(this.LaListeDesCommandes, ts_Lines[0]);
            }
            else
            {
                this.m_connection = new ClientGoHSsh(this.LaListeDesCommandes, filePath);
            }


            RefreshMenu();


            //Return the typeface collection for the fonts in the selected URI location.
            using (IEnumerator <Typeface> t = Fonts.GetTypefaces("file:///C:\\Windows\\Fonts\\#Georgia").GetEnumerator())
            {
                t.MoveNext();
                this.m_typeface = t.Current;
            }

            this.m_center  = new Point(X_DECALAGE_BACK, Y_DECALAGE_BACK);
            this.m_pen     = new Pen(Brushes.White, 1);
            this.m_radiusX = X_TAILLE;
            this.m_radiusY = Y_TAILLE;
        }
예제 #28
0
        public GoHInterface(bool isBackground)
        {
            this.LaListeDesCommandes = new ConcurrentBag <string>();

            this.IsBackground = isBackground;

            this.m_noir_Transparent = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));

            try
            {
                this.m_img = Get_Img_From_Bitmap(Resource1.kinect);
                this.m_hand_Transparent_Img = Get_Img_From_Bitmap(Resource1.hand_transparent);
                this.m_fist_Transparent_Img = Get_Img_From_Bitmap(Resource1.fist_transparent);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);

                throw;
            }



            string[] ts_Lines;

            string filePath;

            try
            {
                Assembly assembly = Assembly.GetEntryAssembly();

                if (assembly == null)
                {
                    throw new Exception(" assembly == null ");
                }

                string codeBase = assembly.CodeBase;

                DirectoryInfo exeFolder_Di = new FileInfo(new Uri(codeBase).LocalPath).Directory;

                FileInfo fi_02 = new FileInfo(exeFolder_Di.Parent.Parent.Parent.FullName + @"\" + CONFIG_NAME);

                if (File.Exists(CONFIG_NAME))
                {
                    filePath = CONFIG_NAME;
                }
                else if (fi_02.Exists)
                {
                    filePath = fi_02.FullName;
                }
                else
                {
                    throw new ApplicationException(" Erreur : pas de fichier " + CONFIG_NAME);
                }

                Console.WriteLine(@" fichier de config : " + filePath);
                ts_Lines = File.ReadAllLines(filePath);
            }
            catch (Exception ex)
            {
                Outil.Ecrire_Erreur(ex);
                throw;
            }


            if (string.IsNullOrWhiteSpace(ts_Lines[0]))
            {
                Console.WriteLine(@" Pas de parametre dans le fichier : ");
                Console.WriteLine(filePath);

                return;
            }
            else if (ts_Lines[0].StartsWith(@"http://"))
            {
                this.m_connection = new ClientGoHWeb(this.LaListeDesCommandes, ts_Lines[0]);
            }
            else
            {
                this.m_connection = new ClientGoHSsh(this.LaListeDesCommandes, filePath);
            }


            RefreshMenu();


            //Return the typeface collection for the fonts in the selected URI location.
            using (IEnumerator <Typeface> t = Fonts.GetTypefaces("file:///C:\\Windows\\Fonts\\#Georgia").GetEnumerator())
            {
                t.MoveNext();
                this.m_typeface = t.Current;
            }

            this.m_center  = new Point(X_DECALAGE_BACK, Y_DECALAGE_BACK);
            this.m_pen     = new Pen(Brushes.White, 1);
            this.m_radiusX = X_TAILLE;
            this.m_radiusY = Y_TAILLE;
        }
예제 #29
0
 private void frmPrincipale_Load(object sender, EventArgs e)
 {
     displaycbBxRubric(Outil.GetAllRubrics());
     displaycbBxSubject(Outil.GetSujetsByCategorieID((int)cbBxRubric.SelectedValue));
     visibiliteModerateur();
 }