Example #1
0
        private static bool NumericUpDownState(NumericUpDown t, Methode methode)
        {
            //variable
            bool  Filled = false;
            State state;

            //Check what the current state is
            if (t.Value == 0)
            {
                state = State.empty;
            }
            else
            {
                state = State.filled; Filled = true;
            }

            //Check what the methode is and make the action that belongs to it
            if (methode == Methode.Color)
            {
                SetState_color(t, state);
            }

            //check if a field was not filled
            return(Filled);
        }
Example #2
0
        private static bool DatePickerState(DateTimePicker t, Methode methode)
        {
            //variable
            bool  Filled = false;
            State state;

            //Check what the current state is
            if (t.Text.Length == 0)
            {
                state = State.empty;
            }
            else
            {
                state = State.filled; Filled = true;
            }

            //Check what the methode is and make the action that belongs to it
            if (methode == Methode.Color)
            {
                SetState_color(t, state);
            }

            //check if a field was not filled
            return(Filled);
        }
Example #3
0
        private static bool RichTextBoxState(RichTextBox t, Methode methode)
        {
            //variable
            bool  Filled = false;
            State state;

            //Check what the current state is
            if (t.Text == string.Empty)
            {
                state = State.empty;
            }
            else if (t.Text == "error")
            {
                state = State.error;
            }
            else
            {
                state = State.filled; Filled = true;
            }

            //Check what the methode is and make the action that belongs to it
            if (methode == Methode.Color)
            {
                SetState_color(t, state);
            }

            //check if a field was not filled
            return(Filled);
        }
Example #4
0
        private static bool PictureBoxState(PictureBox t, Methode methode)
        {
            //variable
            bool  Filled = false;
            State state;

            //Check what the current state is
            if (t.Image == null)
            {
                state = State.empty;
            }
            else
            {
                state = State.filled; Filled = true;
            }

            //Check what the methode is and make the action that belongs to it
            if (methode == Methode.Color)
            {
                SetState_color(t, state);
            }

            //check if a field was not filled
            return(Filled);
        }
Example #5
0
        /// <summary>
        /// Retourne la liste des entités du fichier
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="nsmgr"></param>
        /// <returns></returns>
        public static List <Entite> Entites(XmlDocument doc, XmlNamespaceManager nsmgr)
        {
            List <Entite> entites = new List <Entite>();
            List <string> noms    = NomsEntites(doc, nsmgr);

            for (int i = 1; i < 2; i++)
            {
                string                    descriptions         = DescriptionsEntites(doc, nsmgr, i);
                ClasseParent              classesParent        = ClasseParent.ClassesParent(doc, nsmgr, i);
                EntitePartiel             entitesPartiels      = EntitePartiel.EntitesPartiels(doc, nsmgr, i);
                List <Propriete>          proprietes           = Propriete.Proprietes(doc, nsmgr, i);
                List <ProprieteDynamique> proprietesDynamiques = ProprieteDynamique.ProprietesDynamiques(doc, nsmgr, i);
                Constructeur              constructeurs        = Constructeur.Constructeurs(doc, nsmgr, i);
                List <Methode>            methodes             = Methode.Methodes(doc, nsmgr, i);

                if (Methode.NombreMethodesEntites(doc, nsmgr, i - 1) != 0)
                {
                    entites.Add(new Entite(noms[i - 1], descriptions, entitesPartiels, classesParent, proprietes, proprietesDynamiques, constructeurs, methodes));
                }

                if (Methode.NombreMethodesEntites(doc, nsmgr, i - 1) == 0)
                {
                    entites.Add(new Entite(noms[i - 1], descriptions, entitesPartiels, classesParent, proprietes, proprietesDynamiques, constructeurs));
                }
            }
            return(entites);
        }
Example #6
0
            public void ConvertNames()
            {
                Name = UppercaseFirst(Name);
                if (Name == "Id" || Name == "MessageId")
                {
                    Name += "_";
                }
                this.IsObject = false;
                if (this.IsBoolean)
                {
                    this.Type = "bool";
                    return;
                }
                switch (Methode.ToLower())
                {
                case "short":
                case "varshort":
                    Type = "short";
                    break;

                case "int":
                case "varint":
                    Type = "int";
                    break;

                case "long":
                case "varlong":
                    Type = "long";
                    break;

                case "utf":
                    Type = "String";
                    break;

                case "byte":
                    Type = "byte";
                    break;

                case "boolean":
                    Type = "bool";
                    break;

                case "double":
                    Type = "double";
                    break;

                case "float":
                    Type = "float";
                    break;

                case "unsignedint":
                    Type = "uint";
                    break;

                default:
                    this.IsObject = true;
                    Type          = Methode;
                    break;
                }
            }
Example #7
0
        static void Main(string[] args)
        {
            MyLibrary.Class1.MonWriteLine("Knok Knok Neo, you're in the matrix");
            Console.ReadLine();

            var o = new object();

            // Type anonyme
            var x = new { Nom = "Connor", Prenom = "John" };

            MyLibrary.Class1 c = new MyLibrary.Class1();

            // Setter privé donc marche pas
            // c.Test = "ok";

            Console.WriteLine("assert " + c.Test + " == KO");
            c.Execute();
            Console.WriteLine("assert " + c.Test + " == coucou");

            // Indirection de méthodes
            ProchaineExecution.Invoke();
            ProchaineExecution = ExecuteAuRevoir;
            Console.WriteLine("assert " + Test + " == bonjour");

            ProchaineExecution.Invoke();
            Console.WriteLine("assert " + Test + " == aurevoir");

            // Méthodes anonymes
            ProchaineExecution = delegate() { Test = "deletage methode"; };
            Console.WriteLine("assert " + Test + " == deletage methode");

            // LAMBDA
            ProchaineExecution = () => Test = "Lambda OK";
            Console.WriteLine("assert " + Test + " == Lambda OK");
        }
Example #8
0
        static void Main(string[] args)
        {
            MyLibrary.Class1.MonWriteLine("Knok Knok Neo, you're in the matrix");
            Console.ReadLine();

            var o = new object();

            // Type anonyme
            var x = new { Nom = "Connor", Prenom = "John" };

            MyLibrary.Class1 c = new MyLibrary.Class1();

            // Setter privé donc marche pas
            // c.Test = "ok";

            Console.WriteLine("assert " + c.Test + " == KO");
            c.Execute();
            Console.WriteLine("assert " + c.Test + " == coucou");

            // Indirection de méthodes
            ProchaineExecution.Invoke();
            ProchaineExecution = ExecuteAuRevoir;
            Console.WriteLine("assert " + Test + " == bonjour");

            ProchaineExecution.Invoke();
            Console.WriteLine("assert " + Test + " == aurevoir");

            // Méthodes anonymes
            ProchaineExecution = delegate() { Test = "deletage methode"; };
            Console.WriteLine("assert " + Test + " == deletage methode");

            // LAMBDA
            ProchaineExecution = () => Test = "Lambda OK";
            Console.WriteLine("assert " + Test + " == Lambda OK");
        }
        public async Task <ActionResult <Methode> > Put([FromBody] Methode etu)
        {
            var k      = new PutGeneric <Methode>(etu);
            var result = await _mediator.Send(k);

            return(Ok(result));
        }
        public async Task <ActionResult <Methode> > PostAsync(Methode entity)
        {
            var k      = new AddGeneric <Methode>(entity);
            var result = await _mediator.Send(k);

            return(Ok(result));
        }
        private static void Test03()
        {
            Methode b = new Methode(ObtientNomComplet);

            string resultat = b("Pierre", "Desmazes");

            Console.WriteLine("Résultat : " + resultat);

            /*
             * Résultat : Pierre Desmazes
             * */
        }
Example #12
0
        //Decision maker
        internal static bool _Ctrl(Control[] con, Methode methode)
        {
            //notfilled is that not everything has been filled yet
            bool NotFilled = false;

            //strart loop foreach control
            foreach (Control c in con)
            {
                //determ what type of control it is
                if (c.Enabled)
                {
                    if (c is TextBox)
                    {
                        if (!TextBoxState(c as TextBox, methode))//if not filled
                        {
                            NotFilled = true;
                        }
                    }

                    else if (c is RichTextBox)
                    {
                        if (!RichTextBoxState(c as RichTextBox, methode))
                        {
                            NotFilled = true;
                        }
                    }

                    else if (c is ComboBox)
                    {
                        if (!ComboBoxState(c as ComboBox, methode))
                        {
                            NotFilled = true;
                        }
                    }

                    else if (c is PictureBox)
                    {
                        if (!PictureBoxState(c as PictureBox, methode))
                        {
                            NotFilled = true;
                        }
                    }

                    else if (c is Label)
                    {
                        if (!LabelState(c as Label, methode))
                        {
                            NotFilled = true;
                        }
                    }

                    else if (c is DateTimePicker)
                    {
                        if (!DatePickerState(c as DateTimePicker, methode))
                        {
                            NotFilled = true;
                        }
                    }

                    else if (c is NumericUpDown)
                    {
                        if (!NumericUpDownState(c as NumericUpDown, methode))
                        {
                            NotFilled = true;
                        }
                    }

                    //if nothing above is returned
                    else
                    {
                        MessageBox.Show("Unknown Control! Or not not added yet :P");
                    }
                }
                //if control is diabled set color state to white
                else
                {
                    c.BackColor = Color.White;
                }
            }

            //check if a field was not filled
            if (NotFilled)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }