Exemplo n.º 1
0
 public virtual void ExecuteCommand(string command, CommandEventArgsCustom args)
 {
     if (OnCommand != null)
     {
         OnCommand(command, args);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Fonction appeler lorsque la commande du boutton sauvegardé est lancer. La signature dois être conforme, a celle présenté dans l'exemple.
        /// </summary>
        /// <param name="args">Arguments qui peuvent provenir de l'interface utilisateur lors de l'envois de la commande</param>
        /// <param name="view">Vue incluant les données en provenance de l'interface utilisateur</param>
        /// <param name="presenter">Offre un accès au présenteur parent</param>
        public void Sauvegarder(CommandEventArgsCustom args, IModelVue view, MKS.Core.Presenter.Interfaces.IPresenter presenter)
        {
            ObjContact obj = new ObjContact();

            obj.Nom       = view.Nom.Text;
            obj.Prenom    = view.Prenom.Text;
            obj.Telephone = view.Telephone.Text;

            ServiceMetier s = new ServiceMetier();

            obj = s.Ajouter(obj);

            //si il n'y a aucune erreur le processus continue et affiche le message suivant.
            view.ShowMessage("Information", "Ajout avec succes", Severity.Success);

            //Assigne l'identifiant à la vue.
            view.LabelIdentifiant = new Label(obj.Id.ToString());

            //Reactive le bouton About
            Button btAbout = new Button("Apropos");

            btAbout.Command = "About";
            btAbout.Enabled = true;
            view.About      = btAbout;
        }
Exemplo n.º 3
0
        public void Test(CommandEventArgsCustom args, IVuePersonne view, IPresenter presenter)
        {
            ServicePersonne s  = new ServicePersonne();
            SearchPersonne  sp = new SearchPersonne();

            sp.Nom = "LOLO";
            s.SelectList(sp);
        }
Exemplo n.º 4
0
        //Fonction appelé lorsque la commande About est lancé
        public void About(CommandEventArgsCustom args, IModelVue view, MKS.Core.Presenter.Interfaces.IPresenter presenter)
        {
            //Permet de naviguer dans d'autre formulaire web, forms ou autres en fonction des la commandes.
            //La définition de la navigation est e fonction de la technologie d'interface utilisateur
            //Dans les deux exemples le Global.asax pour le UI TestPresenter contient la navigation

            Dictionary <string, object> d = new Dictionary <string, object>();

            d.Add("VIEW", view);
            view.Navigate(view.About.Command, d);
        }
Exemplo n.º 5
0
        public virtual TView ExecuteCommandParameters(List <Parameters> parameters, string command)
        {
            //List<Parameters> parameter = JsonUtility.Deserialize<List<Parameters>>parameters);

            TView view = new TView();

            IPresenter controler = (IPresenter)Activator.CreateInstance(typeof(TPresenterLogic), view);

            controler.Start(IsAutoInitialDisplay);

            CommandEventArgsCustom cm = new CommandEventArgsCustom(parameters);

            //envoie la commande
            controler.ExecuteCommand(command, cm);

            return(view);
        }
Exemplo n.º 6
0
        public virtual TView ExecuteCommandFormObject(object parameters, string command)
        {
            //List<Parameters> parameter = JsonUtility.Deserialize<List<Parameters>>(parameters);
            Dictionary <string, object> dic = (Dictionary <string, object>)parameters;

            TView view = new TView();



            //foreach (var item in dic)
            //{
            //    Type myType = view.GetType();
            //    IList<PropertyInfo> props = new List<PropertyInfo>(myType.GetProperties());

            //    foreach (PropertyInfo prop in props)
            //    {
            //        if(item.Key == prop.Name)
            //        {
            //            switch (prop.PropertyType.Name)
            //            {
            //                case "Input":
            //                    Input i = new Input(item.Value as string);
            //                    prop.SetValue(view,i);
            //                    break;
            //                case "Label":
            //                    MKS.Core.Presenter.UI.Label l = new MKS.Core.Presenter.UI.Label(item.Value as string);
            //                    prop.SetValue(view,l);
            //                    break;
            //                case "Menu":
            //                    //MKS.Core.Presenter.UI.Menu i = new MKS.Core.Presenter.UI.Menu(item.Value);
            //                    //prop.SetValue(view,i);
            //                    break;
            //                case "Option":
            //                    MKS.Core.Presenter.UI.Option o = new MKS.Core.Presenter.UI.Option();
            //                    o.Value - item.Value as bool;
            //                    prop.SetValue(view,o);
            //                    break;
            //                case "CheckBox":
            //                    MKS.Core.Presenter.UI.CheckBox c = new MKS.Core.Presenter.UI.CheckBox();
            //                    ci.Value = item.Value as bool;
            //                    prop.SetValue(view,ci);
            //                    break;
            //                case "NumericInput":
            //                    NumericInput n = new NumericInput();
            //                    n.Value = item.Value as int;
            //                    prop.SetValue(view,n);
            //                    break;
            //                case "NumericInputLong":
            //                    NumericInputLong lo = new NumericInputLong();
            //                    lo.Value = item.Value as long;
            //                    prop.SetValue(view,lo);
            //                    break;
            //                case "NumericInputDecimal":
            //                    NumericInputDecimal d = new NumericInputDecimal();
            //                    d.Value = item.Value as decimal;
            //                    prop.SetValue(view,d);
            //                    break;
            //                case "NumericInputDouble":
            //                    NumericInputDouble dob = new NumericInputDouble();
            //                    dob.Value = item.Value as double;
            //                    prop.SetValue(view,dob);
            //                    break;
            //                case "DateInput":
            //                    DateInput dt = new DateInput(item.Value as DateTime);
            //                    prop.SetValue(view,dt);
            //                    break;
            //                case "Button":
            //                    //MKS.Core.Presenter.UI.Button i = new MKS.Core.Presenter.UI.Button(item.Value);
            //                    //prop.SetValue(view,i);
            //                    break;
            //                case "Tab":


            //                    break;
            //                case "Grid":
            //                    break;
            //                default:
            //                    prop.SetValue(view, item.Value);
            //                    break;
            //            }
            //            prop.SetValue(view, item.Value);
            //        }


            //        // Do something with propValue
            //    }
            //}



            IPresenter controler = (IPresenter)Activator.CreateInstance(typeof(TPresenterLogic), view);

            controler.Start(IsAutoInitialDisplay);

            CommandEventArgsCustom cm = new CommandEventArgsCustom(parameters);

            //envoie la commande
            controler.ExecuteCommand(command, cm);
            //controler.ExecuteCommand(command);

            return(view);
        }