Beispiel #1
0
        /// <summary>
        /// Deletes the description.
        /// </summary>
        /// <param name="description">The description.</param>
        /// <returns>Description.</returns>
        public Description DeleteDescription(Description description)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            ITranslate clt = null;

            try
            {
                clt = CreateClient();
                return(clt.DeleteDescription(description));
            }
            finally
            {
                CloseClient(clt);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Deletes the description asynchronous.
 /// </summary>
 /// <param name="description">The description.</param>
 /// <param name="action">The action.</param>
 public void DeleteDescriptionAsync(Description description, Action <Description> action = null)
 {
     using (System.ComponentModel.BackgroundWorker wrk = new System.ComponentModel.BackgroundWorker())
     {
         var res = (Description)null;
         wrk.DoWork += (s, e) =>
         {
             res = DeleteDescription(description);
         };
         wrk.RunWorkerCompleted += (s, e) =>
         {
             if (action != null)
             {
                 action(res);
             }
             else if (DeleteDescriptionCompleted != null)
             {
                 DeleteDescriptionCompleted(res);
             }
             wrk.Dispose();
         };
         wrk.RunWorkerAsync();
     }
 }