示例#1
0
        private void GetPlugins(Action <List <string> > callback)
        {
            ptv.LogInfo("GetPlugins");
            var QEplugintracelog = new QueryExpression("plugintracelog");

            QEplugintracelog.Distinct = true;
            QEplugintracelog.ColumnSet.AddColumns("typename");
            var asyncinfo = new WorkAsyncInfo()
            {
                Message = "Loading plugin types",
                Work    = (a, args) =>
                {
                    args.Result = ptv.Service.RetrieveMultiple(QEplugintracelog);
                },
                PostWorkCallBack = (args) =>
                {
                    if (args.Error != null)
                    {
                        ptv.LogError("GetPlugins: {0}", args.Error.Message);
                        callback(new List <string>());
                    }
                    else if (args.Result is EntityCollection)
                    {
                        var entities = ((EntityCollection)args.Result).Entities;
                        var plugins  = entities.Where(e => e.Attributes.Contains("typename")).Select(e => e.Attributes["typename"].ToString()).ToList();
                        ptv.LogInfo("GetPlugins = {0}", plugins.Count);
                        callback(plugins);
                    }
                }
            };

            ptv.WorkAsync(asyncinfo);
        }
示例#2
0
 private Task Delete(ExecuteMultipleRequest batch)
 {
     return(new Task(() =>
     {
         try
         {
             ptv.SendStatusMessage($"Deleting {batch.Requests.Count} log records...");
             ptv.Service.Execute(batch);
         }
         catch (Exception ex)
         {
             // Hiding exception if something will go wrong
             ptv.LogError("Fatal error at Delete(batch):\n{0}", ex.Message);
         }
         finally
         {
             ptv.SendStatusMessage("");
         }
     }));
 }