Exemplo n.º 1
0
            protected override void Execute(Csla.Rules.RuleContext context)
            {
                BackgroundWorker worker = new BackgroundWorker();

                worker.DoWork             += (o, e) => Thread.Sleep(3000);
                worker.RunWorkerCompleted += (o, e) =>
                {
                    string val = (string)context.InputPropertyValues[PrimaryProperty];
                    if (val == "Error")
                    {
                        context.AddErrorResult("Invalid data!");
                    }
                    else if (val == "Warning")
                    {
                        context.AddWarningResult("This might not be a great idea!");
                    }
                    else if (val == "Information")
                    {
                        context.AddInformationResult("Just an FYI!");
                    }
                    context.Complete();
                };
                worker.RunWorkerAsync();
            }