Beispiel #1
0
 private void GetData()
 {
     try
     {
         if (SessionObject.LstAppareil != null && SessionObject.LstAppareil.Count != 0)
         {
             foreach (var item in SessionObject.LstAppareil)
             {
                 DonnesDatagrid.Add(item);
             }
             dtgAppareils.ItemsSource = DonnesDatagrid;
             return;
         }
         LayoutRoot.Cursor = Cursors.Wait;
         Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
         service.GetAllAppareilCompleted += (ssender, args) =>
         {
             if (args.Cancelled || args.Error != null)
             {
                 LayoutRoot.Cursor = Cursors.Arrow;
                 string error = args.Error.Message;
                 Message.Show(error, _title);
                 return;
             }
             DonnesDatagrid.Clear();
             if (args.Result != null)
             {
                 foreach (var item in args.Result)
                 {
                     DonnesDatagrid.Add(item);
                 }
             }
             dtgAppareils.ItemsSource = DonnesDatagrid;
             LayoutRoot.Cursor        = Cursors.Arrow;
         };
         service.GetAllAppareilAsync();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }