Example #1
0
        void GetData()
        {
            try
            {
                AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                client.GetAllStrategieSecuriteCompleted += (ss, res) =>
                {
                    if (res.Cancelled || res.Error != null)
                    {
                        string error = res.Error.Message;
                        Message.Show(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        desableProgressBar();
                        return;
                    }

                    if (res.Result == null || res.Result.Count == 0)
                    {
                        Message.Show(Galatee.Silverlight.Resources.Langue.msgNodata, Galatee.Silverlight.Resources.Langue.informationTitle);
                        desableProgressBar();
                        return;
                    }

                    donnesDatagrid.AddRange(res.Result);
                    lvwResultat.ItemsSource  = res.Result;
                    lvwResultat.SelectedItem = res.Result[0];
                    lvwResultat.Tag          = res.Result;
                };
                client.GetAllStrategieSecuriteAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        void GetData(SessionObject.ExecMode pSens, ServiceAdministration.CsStrategieSecurite pStrategy)
        {
            try
            {
                AdministrationServiceClient stragClient = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                stragClient.GetAllStrategieSecuriteCompleted += (sbrch, argbrch) =>
                {
                    if (argbrch.Cancelled || argbrch.Error != null)
                    {
                        string error = argbrch.Error.Message;
                        Message.Show(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }

                    try
                    {
                        if (pSens == SessionObject.ExecMode.Consultation || pSens == SessionObject.ExecMode.Modification)
                        {
                            ckstatusStrat.IsChecked = pStrategy.ACTIF;
                            RecupererInfoStrategy(pStrategy);
                            if (pSens == SessionObject.ExecMode.Consultation)
                            {
                                Btn_Cancel.Content = Btn_OK.Content;
                                Btn_OK.Visibility  = Visibility.Collapsed;
                                desactiverControles(false);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Message.Show(ex.Message, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
                stragClient.GetAllStrategieSecuriteAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }