public void InsererAffectation(List <CsRemiseScelles> lstScelleTouInsert, int passage, int NombreDeBoucle)
 {
     try
     {
         int res = LoadingManager.BeginLoading(Galatee.Silverlight.Resources.Accueil.Langue.En_Cours);
         Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
         service.InsertRemiseCompleted += (snder, insertR) =>
         {
             LoadingManager.EndLoading(res);
             if (insertR.Cancelled ||
                 insertR.Error != null)
             {
                 Message.ShowError(insertR.Error.Message, Languages.Commune);
                 return;
             }
             if (insertR.Result == 0)
             {
                 Message.ShowError(Languages.ErreurInsertionDonnees, Languages.Commune);
                 return;
             }
             if (passage == NombreDeBoucle)
             {
                 this.OKButton.IsEnabled = true;
                 InitControl();
             }
         };
         service.InsertRemiseAsync(lstScelleTouInsert);
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this.txtAgt_M.Tag == null)
                {
                    Message.ShowInformation("Sélèctionner l'agent récepteur", "Information");
                    return;
                }

                var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.Commune, Languages.QuestionEnregistrerDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                messageBox.OnMessageBoxClosed += (_, result) =>
                {
                    if (messageBox.Result == MessageBoxResult.OK)
                    {
                        listForInsertOrUpdate = GetInformationsFromScreen();
                        Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
                        if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0)
                        {
                            if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
                            {
                                if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0)
                                {
                                    service.InsertRemiseCompleted += (snder, insertR) =>
                                    {
                                        if (insertR.Cancelled ||
                                            insertR.Error != null)
                                        {
                                            Message.ShowError(insertR.Error.Message, Languages.Commune);
                                            return;
                                        }
                                        if (insertR.Result == 0)
                                        {
                                            Message.ShowError(Languages.ErreurInsertionDonnees, Languages.Commune);
                                            return;
                                        }
                                        InitControl();
                                    };
                                    service.InsertRemiseAsync(listForInsertOrUpdate);
                                }
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                };
                messageBox.Show();
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Languages.Commune);
            }
        }