コード例 #1
0
        void SupprimerUtilisateur()
        {
            try
            {
                AdministrationServiceClient delete = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                delete.DeleteUserCompleted += (senderdel, resultDel) =>
                {
                    try
                    {
                        if (resultDel.Cancelled || resultDel.Error != null)
                        {
                            string error = resultDel.Error.Message;
                            Message.Show(Galatee.Silverlight.Resources.Administration.Langue.MsgErrorInsertUser, Galatee.Silverlight.Resources.Langue.errorTitle);
                            return;
                        }

                        if (resultDel.Result == false)
                        {
                            Message.Show(Galatee.Silverlight.Resources.Administration.Langue.MsgErrorInsertUser, Galatee.Silverlight.Resources.Langue.errorTitle);
                            return;
                        }
                        else
                        {
                            Message.Show(Galatee.Silverlight.Resources.Langue.suppressionSuccess, Galatee.Silverlight.Resources.Langue.informationTitle);
                            List <CsUtilisateur> listeuser = datagrid.ItemsSource as List <CsUtilisateur>;
                            listeuser.Remove(userselected);
                            datagrid.UpdateLayout();
                            this.DialogResult = true;
                        }
                    }
                    catch (Exception ew)
                    {
                        Message.Show(ew.Message, Langue.errorTitle);
                    }
                };
                delete.DeleteUserAsync(userselected);
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Langue.errorTitle);
            }
        }