Beispiel #1
0
 internal MouseButton(EventClick onClick, EventDrag onDrag)
 {
     mState      = State.None;
     mOnClick    = onClick;
     mOnDrag     = onDrag;
     mDragRezult = null;
 }
Beispiel #2
0
 private void EventDispatcher(HandGestureEvent e)
 {
     if (e == null)
     {
         throw new NullReferenceException($"{nameof(HandGestureEvent)} can not be null, please check {nameof(MADUnityIntegrator)} logic.");
     }
     else if (e is HandDetected)
     {
         EventHandDetected?.Invoke((HandDetected)e);
     }
     else if (e is Click)
     {
         EventClick?.Invoke((Click)e);
     }
     else if (e is Grab)
     {
         EventGrab?.Invoke((Grab)e);
     }
     else if (e is Hold)
     {
         EventHold?.Invoke((Hold)e);
     }
     else
     {
         throw new NotImplementedException($"Fail to dispatch {nameof(HandGestureEvent)}, non implement type detected.");
     }
 }
Beispiel #3
0
 internal MouseButton(EventClick onClick, EventDrag onDrag)
 {
     mState = State.None;
     mOnClick = onClick;
     mOnDrag = onDrag;
     mDragRezult = null;
 }
Beispiel #4
0
        public HtmlSubmit(string name, bool verbose, string parameter)
            : base(verbose ? name : string.Empty)
        {
            attributes.Add(attrType = new AttrType("button"));

            attributes.Add(attrDisabled = new AttrDisabled());

            events.Add(eventClick = new EventClick(string.Format("__doPostBack('{0}', '{1}');", name, parameter)));
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            EventClick  click  = new EventClick();
            ClickButton Button = new ClickButton(new ClickCommand(click));

            Button.PressButton1();
            Button.PressButton2();
            Console.Read();
        }
        public void OnClick()
        {
            EventClick    handler = ButtonClick;
            VarEventClick e       = new VarEventClick();

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #7
0
        void TouchButton()
        {
            var comps  = gameObject.GetComponentsInChildren <Button>(true);
            int Length = comps.Length;

            for (int i = 0; i < Length; ++i)
            {
                Button button = comps[i];
                EventClick.Get(button.gameObject).onClick += onClick;
            }
        }
Beispiel #8
0
        public HtmlButton(string name, string onClick)
            : base(name)
        {
            attributes.Add(attrType = new AttrType("button"));

            attributes.Add(attrDisabled = new AttrDisabled());

            attributes.Add(attrValue = new AttrValue());

            events.Add(eventClick = new EventClick(onClick));
        }
        private void OnAddAction(object o)
        {
            EventClick.GetClick().Handler += CloseAddView;
            Planete PlaneteAjout           = new Planete();

            add      = new Fajout(PlaneteAjout);
            add.Name = "Ajout";
            add.ShowDialog();
            AlreadyExiste = false;


            if (add.ViewModelAjout.CLickOnAdd == true)
            {
                foreach (Planete p in Univers)
                {
                    if (add.ViewModelAjout.Planete.Nom.ToLower().Equals(p.Nom.ToLower()))
                    {
                        AlreadyExiste = true;
                    }
                }

                if (AlreadyExiste)
                {
                    Info info = new Info("La planète fait déjà parti de l'univers et n'as donc pas été ajouté");
                    info.ShowDialog();
                }
                else
                {
                    string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
                    string path       = (System.IO.Path.GetDirectoryName(executable));
                    AppDomain.CurrentDomain.SetData("DataDirectory", path);
                    SqlConnection conn = new SqlConnection(connectionString);

                    conn.Open();
                    Planete planeteAdd = add.ViewModelAjout.Planete;
                    string  SQLcmdAdd  = "INSERT INTO [UniversDATABase].[Planete] VALUES (@PNom,@PVol,@PMas,@PAnn,@PDec,@PSat,@PRev,@PIma);";

                    var command = new SqlCommand(SQLcmdAdd, conn);
                    command.Parameters.AddWithValue("@PNom", planeteAdd.Nom);
                    command.Parameters.AddWithValue("@PVol", planeteAdd.Volume);
                    command.Parameters.AddWithValue("@PMas", planeteAdd.Masse);
                    command.Parameters.AddWithValue("@PAnn", planeteAdd.Anneaux);
                    command.Parameters.AddWithValue("@PDec", planeteAdd.AnnéeDecouverte);
                    command.Parameters.AddWithValue("@PSat", planeteAdd.NbreSatellite);
                    command.Parameters.AddWithValue("@PRev", planeteAdd.PeriodeRevo);
                    command.Parameters.AddWithValue("@PIma", planeteAdd.PlanIm);
                    command.ExecuteReader();
                    conn.Close();

                    NotifyPropertyChanged("Univers");
                }
                Refresh();
            }
        }
 private void OnAddAction(object obj)
 {
     CLickOnAdd = true;
     if (Planete.Nom != null)
     {
         EventClick.GetClick().OnButtonPressedHandler(EventArgs.Empty);
     }
     else
     {
         Info iadd = new Info("Tous les champs doivent être completé pour ajouter une nouvelle planete");
         iadd.ShowDialog();
     }
 }
Beispiel #11
0
 public void RaisePostBackEvent(string eventArgument)
 {
     if (eventArgument.ToUpper().Contains("DAYCLICK"))
     {
         DayClick?.Invoke(this, new DayClickEventArgs()
         {
             Date = eventArgument.Replace("DAYCLICK*", "")
         });
     }
     else if (eventArgument.ToUpper().Contains("EVENTCLICK"))
     {
         EventClick?.Invoke(this, new EventClickEventArgs()
         {
             EventId = eventArgument.Replace("EVENTCLICK*", "")
         });
     }
 }
        private void OnEditCommand(object o)
        {
            EventClick.GetClick().Handler += CloseEditView;

            edit = new Fajout(Planete);                  // Factorisation de code. on utilise la même fenetre que pour l'ajout de planete
            edit.ViewModelAjout.AddOrModify = "Valider"; // changement du contenu bouton
            edit.Name = "Edit";
            edit.ShowDialog();
            if (edit.ViewModelAjout.CLickOnAdd == true)
            {
                NotifyPropertyChanged("Planete");
                Planete modifAApliquer = edit.ViewModelAjout.Planete;

                string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
                string path       = (System.IO.Path.GetDirectoryName(executable));
                AppDomain.CurrentDomain.SetData("DataDirectory", path);
                SqlConnection conn = new SqlConnection(connectionString);
                conn.Open();
                string SQLcmdAdd = "UPDATE [UniversDATABase].[Planete] SET PlaneteVolume = @PVol,PlaneteMasse = @PMas,PlaneteAnneaux = @PAnn, PlaneteDecouverte = @PDec, PlaneteNBSat = @PSat, PlanetePeriodeRevo = @PRev, PlanetePathIm = @PIma WHERE PlaneteNom = @PNom";

                var command = new SqlCommand(SQLcmdAdd, conn);
                command.Parameters.AddWithValue("@PNom", modifAApliquer.Nom);
                command.Parameters.AddWithValue("@PVol", modifAApliquer.Volume);
                command.Parameters.AddWithValue("@PMas", modifAApliquer.Masse);
                command.Parameters.AddWithValue("@PAnn", modifAApliquer.Anneaux);
                command.Parameters.AddWithValue("@PDec", modifAApliquer.AnnéeDecouverte);
                command.Parameters.AddWithValue("@PSat", modifAApliquer.NbreSatellite);
                command.Parameters.AddWithValue("@PRev", modifAApliquer.PeriodeRevo);
                command.Parameters.AddWithValue("@PIma", modifAApliquer.PlanIm);

                command.ExecuteReader();
                conn.Close();

                NotifyPropertyChanged("Planete");
                NotifyPropertyChanged("Univers");
            }
            Refresh();
        }
        private void OnDeleteCommand(object obj)
        {
            EventClick.GetClick().Handler += CloseBd;
            bd = new BoiteDeDialogue("supprimer cette planete ?");
            bd.ShowDialog();
            if (bd.ViewModelInfo._valid == true)
            {
                string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
                string path       = (System.IO.Path.GetDirectoryName(executable));
                AppDomain.CurrentDomain.SetData("DataDirectory", path);
                SqlConnection conn = new SqlConnection(connectionString);

                conn.Open();

                string SQLcmdAdd = "DELETE FROM [UniversDATABase].[Planete] WHERE PlaneteNom = @PNom"; //test
                var    command   = new SqlCommand(SQLcmdAdd, conn);
                command.Parameters.AddWithValue("@PNom", Planete.Nom);
                command.ExecuteReader();
                conn.Close();
                NotifyPropertyChanged("Univers");
            }
            Refresh();
        }
 private void OnCancelCommand(object obj)
 {
     CLickOnAdd = false; // cas ou on clic sur cancel après l'affichage de iadd
     EventClick.GetClick().OnButtonPressedHandler(EventArgs.Empty);
 }
 private void OnYesAction(object obj)
 {
     _valid = true;
     EventClick.GetClick().OnButtonPressedHandler(EventArgs.Empty);
 }
 private void CloseBd(object sender, EventArgs e)
 {
     bd.Close();
     EventClick.GetClick().Handler -= CloseBd;
 }
 private void CloseEditView(object sender, EventArgs e)
 {
     edit.Close();
     EventClick.GetClick().Handler -= CloseEditView;
 }
 private void CloseAddView(object sender, EventArgs e)
 {
     add.Close();
     EventClick.GetClick().Handler -= CloseAddView;
 }
Beispiel #19
0
 public ClickCommand(EventClick ev)
 {
     eventClick = ev;
 }
 private void OnNoAction(object obj)
 {
     EventClick.GetClick().OnButtonPressedHandler(EventArgs.Empty);
 }