private void DragSource_Drop(object sender, Infragistics.DragDrop.DropEventArgs e) { var data = e.Data as PolicyElementViewModel; var drca = e.DropTarget as XamDataTreeNodeControl; if (drca != null && data != null) { var node = drca.Node; if (node != null) { var ndata = node.Data as DirectoryNode; var listPolicyAssign = new List <PolicyAssign>(); var pa = new PolicyAssign { Color = data.ExpanderBackgroundColor, ObjectId = ndata.NodeId, ObjectType = ndata.IsFolder?0:1, PolicyAgentId = data.Id }; listPolicyAssign.Add(pa); var policyAssigningBg = new BackgroundWorkerHelper(); policyAssigningBg.AddDoWork(SaveBackgroundWorker_DoWork) .DoWork(listPolicyAssign); } } }
private void OnMoveCommand(object args) { var listPolicyAssign = new List <PolicyAssign>(); var policyId = ApplicationContext.PoliciesList[0].Id; var policyColor = ApplicationContext.PoliciesList[0].ExpanderBackgroundColor; foreach (var sn in ApplicationContext.SelectedTargetNodes) { var policyAssign = new PolicyAssign { Color = policyColor, PolicyAgentId = policyId, ObjectId = sn.NodeId, ObjectType = sn.IsFolder ? 0 : 1 }; listPolicyAssign.Add(policyAssign); } _mainWindowViewModel.ShowMessage("Policy Assigning..."); var policyAssigningBg = new BackgroundWorkerHelper(); policyAssigningBg.AddDoWork(SaveBackgroundWorker_DoWork) .AddRunWorkerCompleted(OnSaveData_RunWorkerCompleted) .DoWork(listPolicyAssign); }