コード例 #1
0
 public void AddItems()
 {
     LesElementsAAfficher.Clear();
     AjusterLesElements();
     if (TbRech.Text == "")
     {
         LesElementsAAfficher = LesElementsAAfficherB;
     }
     else
     {
         foreach (AffichableEnListeBox alb in LesElementsAAfficherB)
         {
             if (alb is ExceptionUVM)
             {
                 if (((ExceptionUVM)alb).NoMachine.ToString().ToUpper().StartsWith(TbRech.Text.ToUpper()))
                 {
                     LesElementsAAfficher.Add(alb);
                 }
             }
             if (alb is IndisponibilitéVM)
             {
                 if (((IndisponibilitéVM)alb).NoMachineIndispo.ToString().ToUpper().StartsWith(TbRech.Text.ToUpper()))
                 {
                     LesElementsAAfficher.Add(alb);
                 }
             }
         }
     }
 }
コード例 #2
0
        private void MenuSupprExcepts_OnClick(object sender, RoutedEventArgs e)
        {
            MenuItem    mi = sender as MenuItem;
            ContextMenu cm = mi.Parent as ContextMenu;
            Popup       p  = cm.Parent as Popup;
            Grid        g  = p.PlacementTarget as Grid;

            if (g.Name == "MyGrid")
            {
                DataBase.DeleteElementAAfficher(g.DataContext as ExceptionUVM);
                int res = LesElementsAAfficher.IndexOf(g.DataContext as ExceptionUVM);
                LesElementsAAfficher.RemoveAt(res);
            }
        }