public void FindScripts()
        {
            lvScripts.Items.Clear();
            tsbMainFindScripts.Enabled = false;
            tsbExportToCsv.Enabled     = false;

            WorkAsync(new WorkAsyncInfo
            {
                Message       = "Loading scripts (this can take a while...)",
                AsyncArgument = null,
                Work          = (bw, e) =>
                {
                    var lScripts = new List <ListViewItem>();

                    var sManager = new ScriptsManager(Service, bw);
                    sManager.Find(new Version(ConnectionDetail.OrganizationVersion));

                    foreach (var script in sManager.Scripts)
                    {
                        var item = new ListViewItem(script.Type)
                        {
                            Tag = script
                        };
                        item.SubItems.Add(script.EntityName);
                        item.SubItems.Add(script.EntityLogicalName);
                        item.SubItems.Add(script.Name);
                        item.SubItems.Add(script.Event);
                        item.SubItems.Add(script.Attribute);
                        item.SubItems.Add(script.AttributeLogicalName);
                        item.SubItems.Add(script.ScriptLocation);
                        item.SubItems.Add(script.MethodCalled);
                        item.SubItems.Add(script.PassExecutionContext?.ToString() ?? "");
                        item.SubItems.Add(script.Arguments);
                        item.SubItems.Add(script.IsActive?.ToString() ?? "");

                        if (script.HasProblem)
                        {
                            item.ForeColor = Color.Red;
                        }
                        lScripts.Add(item);
                    }

                    e.Result = lScripts;
                },
                PostWorkCallBack = e =>
                {
                    lvScripts.Items.AddRange(((List <ListViewItem>)e.Result).ToArray());
                    tsbMainFindScripts.Enabled = true;
                    tsbExportToCsv.Enabled     = true;
                },
                ProgressChanged = e =>
                {
                    SetWorkingMessage(e.UserState.ToString());
                }
            });
        }
示例#2
0
        public void FindScripts()
        {
            lvScripts.Items.Clear();
            tsbMainFindScripts.Enabled = false;
            tsbExportToCsv.Enabled     = false;

            WorkAsync(new WorkAsyncInfo
            {
                Message       = "Loading scripts (this can take a while...)",
                AsyncArgument = null,
                Work          = (bw, e) =>
                {
                    var lScripts = new List <ListViewItem>();

                    var sManager = new ScriptsManager(Service);
                    sManager.Find();

                    foreach (var script in sManager.Scripts)
                    {
                        var item = new ListViewItem(script.Type);
                        item.SubItems.Add(script.EntityName);
                        item.SubItems.Add(script.EntityLogicalName);
                        item.SubItems.Add(script.Name);
                        item.SubItems.Add(script.Event);
                        item.SubItems.Add(script.Attribute);
                        item.SubItems.Add(script.AttributeLogicalName);
                        item.SubItems.Add(script.ScriptLocation);
                        item.SubItems.Add(script.MethodCalled);
                        item.SubItems.Add(script.Arguments);
                        item.SubItems.Add(script.IsActive.HasValue ? script.IsActive.Value.ToString() : "");

                        if (script.HasProblem)
                        {
                            item.ForeColor = Color.Red;
                        }
                        lScripts.Add(item);
                    }

                    e.Result = lScripts;
                },
                PostWorkCallBack = e =>
                {
                    lvScripts.Items.AddRange(((List <ListViewItem>)e.Result).ToArray());
                    tsbMainFindScripts.Enabled = true;
                    tsbExportToCsv.Enabled     = true;
                }
            });
        }
示例#3
0
        public void FindScripts()
        {
            lvScripts.Items.Clear();
            tsbMainFindScripts.Enabled = false;
            tsbExportToCsv.Enabled = false;

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Loading scripts (this can take a while...)",
                AsyncArgument = null,
                Work = (bw, e) =>
                {
                    var lScripts = new List<ListViewItem>();

                    var sManager = new ScriptsManager(Service);
                    sManager.Find();

                    foreach (var script in sManager.Scripts)
                    {
                        var item = new ListViewItem(script.Type);
                        item.SubItems.Add(script.EntityName);
                        item.SubItems.Add(script.EntityLogicalName);
                        item.SubItems.Add(script.Name);
                        item.SubItems.Add(script.Event);
                        item.SubItems.Add(script.Attribute);
                        item.SubItems.Add(script.AttributeLogicalName);
                        item.SubItems.Add(script.ScriptLocation);
                        item.SubItems.Add(script.MethodCalled);
                        item.SubItems.Add(script.Arguments);
                        item.SubItems.Add(script.IsActive.HasValue ? script.IsActive.Value.ToString() : "");

                        if (script.HasProblem)
                        {
                            item.ForeColor = Color.Red;
                        }
                        lScripts.Add(item);
                    }

                    e.Result = lScripts;
                },
                PostWorkCallBack = e =>
                {
                    lvScripts.Items.AddRange(((List<ListViewItem>)e.Result).ToArray());
                    tsbMainFindScripts.Enabled = true;
                    tsbExportToCsv.Enabled = true;
                }
            });
        }
示例#4
0
        private void FindScripts()
        {
            lvScripts.Items.Clear();
            tsbMainFindScripts.Enabled = false;
            tsbExportToCsv.Enabled     = false;

            WorkAsync("Loading scripts (this can take a while...)",
                      e =>
            {
                var lScripts = new List <ListViewItem>();

                var sManager = new ScriptsManager(Service);
                sManager.Find();

                foreach (var script in sManager.Scripts)
                {
                    var item = new ListViewItem(script.Type);
                    item.SubItems.Add(script.EntityName);
                    item.SubItems.Add(script.EntityLogicalName);
                    item.SubItems.Add(script.Name);
                    item.SubItems.Add(script.Event);
                    item.SubItems.Add(script.Attribute);
                    item.SubItems.Add(script.AttributeLogicalName);
                    item.SubItems.Add(script.ScriptLocation);
                    item.SubItems.Add(script.MethodCalled);

                    if (script.HasProblem)
                    {
                        item.ForeColor = Color.Red;
                    }
                    lScripts.Add(item);
                }

                e.Result = lScripts;
            },
                      e =>
            {
                lvScripts.Items.AddRange(((List <ListViewItem>)e.Result).ToArray());
                tsbMainFindScripts.Enabled = true;
                tsbExportToCsv.Enabled     = true;
            });
        }
示例#5
0
        public void FindScripts(bool allEntities)
        {
            lvScripts.Items.Clear();
            tsddFindScripts.Enabled = false;
            tsbExportToCsv.Enabled  = false;

            var solutionList = new List <Entity>();

            if (!allEntities)
            {
                var dialog = new SolutionPicker(Service);
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    solutionList = dialog.SelectedSolution;
                }
                else
                {
                    tsddFindScripts.Enabled = true;
                    tsbExportToCsv.Enabled  = true;

                    return;
                }
            }

            WorkAsync(new WorkAsyncInfo
            {
                Message       = "Loading scripts (this can take a while...)",
                AsyncArgument = solutionList,
                Work          = (bw, e) =>
                {
                    _lScripts     = new List <ListViewItem>();
                    var solutions = (List <Entity>)e.Argument;

                    var sManager = new ScriptsManager(Service, bw);
                    sManager.Find(solutions, loadManagedEntities, new Version(ConnectionDetail.OrganizationVersion));
                    _metadata      = sManager.Metadata;
                    _forms         = sManager.Forms;
                    _views         = sManager.Views;
                    _homePageGrids = sManager.HomePageGrids;
                    _userLcid      = sManager.UserLcid;

                    foreach (var script in sManager.Scripts)
                    {
                        var item = new ListViewItem(script.Type)
                        {
                            Tag = script
                        };
                        item.SubItems.Add(script.EntityName);
                        item.SubItems.Add(script.EntityLogicalName);
                        item.SubItems.Add(script.ItemName);
                        item.SubItems.Add(script.FormType);
                        item.SubItems.Add(script.FormState);
                        item.SubItems.Add(script.Event);
                        item.SubItems.Add(script.Attribute);
                        item.SubItems.Add(script.AttributeLogicalName);
                        item.SubItems.Add(script.Library);
                        item.SubItems.Add(script.MethodCalled);
                        item.SubItems.Add(script.PassExecutionContext?.ToString() ?? "");
                        item.SubItems.Add(script.Parameters);
                        item.SubItems.Add(script.Enabled?.ToString() ?? "");
                        item.SubItems.Add(script.Problem);

                        if (script.HasProblem)
                        {
                            item.ForeColor = Color.Red;
                        }
                        _lScripts.Add(item);
                    }

                    e.Result = _lScripts;
                },
                PostWorkCallBack = e =>
                {
                    tsddFindScripts.Enabled = true;
                    tsbExportToCsv.Enabled  = true;

                    if (e.Error != null)
                    {
                        MessageBox.Show(this, e.Error.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    lvScripts.Items.AddRange(((List <ListViewItem>)e.Result).ToArray());
                    tsbApplyChanges.Enabled = lvScripts.Items.Cast <ListViewItem>().Any(i => ((Script)i.Tag).RequiresUpdate);
                },
                ProgressChanged = e =>
                {
                    SetWorkingMessage(e.UserState.ToString());
                }
            });
        }