예제 #1
0
        private void bwCreateFilterFromView_DoWork(object sender, DoWorkEventArgs e)
        {
            var argument = (object[])e.Argument;
            var worker   = (BackgroundWorker)sender;
            var items    = (ListView.SelectedListViewItemCollection)argument[0];
            var rm       = new RuleManager("savedquery", service);

            var views = (from ListViewItem item in items select(Entity) item.Tag).ToList();

            var rulesIds = rm.CreateRuleFromSystemView(views, (int)argument[1]);

            e.Result = 1;

            if (!(bool)argument[2])
            {
                ApplyTemplateToUsers(rulesIds, "Do you want to apply this new template to some users?", rm, worker);
            }
        }