private void DragSource_Drop(object sender, Infragistics.DragDrop.DropEventArgs e)
        {
            var data = e.Data as NeighborhoodWatch;
            var drca = e.DropTarget as XamDataTreeNodeControl;

            if (drca != null)
            {
                var node = drca.Node;
                if (node != null)
                {
                    if (ApplicationContext.EndPointListAll.Select(r => r.MACAddress).Contains(data.MAC))
                    {
                        var messageDialog = PageNavigatorHelper._MainWindow.MessageDialogContentControl.Content as MessageDialog;
                        messageDialog.ShowMessageDialog(
                            "Cannot move, this Endpoint is existed",
                            "Message");
                        return;
                    }
                    var ndata = node.Data as DirectoryNode;

                    ApplicationContext.AllNeighborhoodWatch.Find(r => r.Id == data.Id).Managed = true;

                    Model.OnTabSelected();

                    var mainVM = PageNavigatorHelper.GetMainModel();
                    mainVM.AddComputer(ndata, data.Computer, data.MAC);
                }
            }
        }
Пример #2
0
        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);
                }
            }
        }