/// <summary>
 /// Método invocado cuando el hilo que elimina termina la llamada al servicio web.
 /// </summary>
 /// <param name="args">Los argumentos del hilo que elimina.</param>
 protected void OnDeleteFinished(RemoverArguments args)
 {
     if (!args.Succeed)
     {
         Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.DeleteFailed, args.Message);
         Load();
     }
 }
Esempio n. 2
0
        static private void DoRemove(object rParams)
        {
            RemoverParameters removerParams = (RemoverParameters)rParams;

            bool succeed;
            Collection <Error> message = new Collection <Error>();

            try
            {
                removerParams.Entity = removerParams.Remover(removerParams.Entity, removerParams.Session);

                if (removerParams.Entity != null)
                {
                    succeed = false;
                    message = removerParams.Entity.Errors;
                }
                else
                {
                    succeed = true;
                }
            }
            catch (TargetInvocationException)
            {
                message.Add(new Error(Resources.ConnectionError, string.Empty, UtnEmall.ServerManager.Properties.Resources.DeleteFailed));
                succeed = false;
            }
            catch (EndpointNotFoundException)
            {
                message.Add(new Error(Resources.ConnectionError, string.Empty, UtnEmall.ServerManager.Properties.Resources.DeleteFailed));
                succeed = false;
            }
            catch (CommunicationException)
            {
                message.Add(new Error(Resources.ConnectionError, string.Empty, UtnEmall.ServerManager.Properties.Resources.UnknownError));
                succeed = false;
            }

            RemoverArguments args = new RemoverArguments(succeed, message);

            removerParams.Control.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new VoidCallback(delegate()
            {
                removerParams.OnFinished(args);
            }));
        }