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); }
internal void PopulateGrid(IEnumerable <Entity> results) { ptv.LogInfo("PopulateGrid with {0} logs", results.Count()); var asyncinfo = new WorkAsyncInfo() { Message = "Populating result view", Work = (a, args) => { ptv.UpdateUI(() => { refreshingGrid = true; crmGridView.DataSource = results; refreshingGrid = false; ptv.SendStatusMessage($"Loaded {results.Count()} trace records"); UpdateColumnsLayout(); }); }, PostWorkCallBack = (args) => { if (args.Error != null) { ptv.ShowErrorDialog(args.Error, "Populating Results"); } } }; ptv.WorkAsync(asyncinfo); }
internal void PopulateGrid(EntityCollection results) { ptv.LogInfo("PopulateGrid with {0} logs", results.Entities.Count); var asyncinfo = new WorkAsyncInfo() { Message = "Populating result view", Work = (a, args) => { ptv.UpdateUI(() => { refreshingGrid = true; crmGridView.DataSource = results; refreshingGrid = false; ptv.SendStatusMessage($"Loaded {results.Entities.Count} trace records"); UpdateColumnsLayout(); }); }, PostWorkCallBack = (args) => { if (args.Error != null) { ptv.AlertError($"Failed to populate result view:\n{args.Error.Message}", "Load"); } } }; ptv.WorkAsync(asyncinfo); }