private void OnLDAPNavExecute() { var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.LDAP; } PageNavigatorHelper.Switch(new LDAPPage()); }
private void OnQuarantineNavExecute() { var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.Transfer; } PageNavigatorHelper.Switch(new POCQuarantinePage()); }
private void OnAssignmentNavExecute() { var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.Assignment; } PageNavigatorHelper.Switch(new DirectoryAssignmentPage()); }
private void OnNeighborhoodNavExecute() { var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.NeighborhoodWatch; } PageNavigatorHelper.Switch(new NeighborhoodWatchPage()); }
private void OncolorNavExecute() { var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.Colors; } PageNavigatorHelper.Switch(new ColorCodePage()); }
private void OnFromLDAPCommand(object arg) { _view.BdAddButton.Visibility = Visibility.Collapsed; _view.menugrid.Visibility = Visibility.Hidden; var leftViewModel = PageNavigatorHelper.GetLeftElementViewModel(); if (leftViewModel != null) { leftViewModel.SelectedLDAPNavigation(); PageNavigatorHelper.Switch(new LDAPPage()); } }
private void OnSoftwareNavExecute() { SubEndpointVisibility = 0.99; SubDiscoveryVisibility = 0.99; SubPolicyVisibility = 0.99; SubReportingVisibility = 0.99; SubSoftwareVisibility = SubSoftwareVisibility == 1 ? 0.99 : 1; var mainModel = GetMainModel(); if (mainModel != null) { mainModel.NavigationIndex = (int)NavigationIndexes.Software; } PageNavigatorHelper.Switch(new SoftwarePage()); }
/// <summary> /// Executes the cancel. /// </summary> /// <param name="obj">The object.</param> private void ExecuteCancel(object obj) { _directoryComputerImporter = null; if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); var selectedFolderIds = new List <int>(); var selectedEndpointIds = new List <int>(); selectedFolderIds.Add(CurrentDirectoryNode.NodeId); viewModel.SetParamsValueForDirectory(selectedFolderIds, selectedEndpointIds, ApplicationContext.SearchText, false, Guid.NewGuid(), ""); viewModel.GetData(); FilePath = string.Empty; }
private void OnImportFromFileExecute(object pars) { _view.menugrid.Visibility = Visibility.Hidden; _view.BdAddButton.Visibility = Visibility.Collapsed; //Show Import From File dialog //_view.ShowImportFileDialog(ApplicationContext.NodeId); //Navigation to Import Page var importFilePage = new ImportFilePage(ApplicationContext.NodesSelected.Count > 0 ? ApplicationContext.NodesSelected[0].NodeId : 1); var leftModel = PageNavigatorHelper.GetLeftElementViewModel(); if (leftModel != null) { if (NavigationIndex != (int)NavigationIndexes.Endpoint && NavigationIndex != (int)NavigationIndexes.Label) { leftModel.ChangeEndpointNavigationState(); } } PageNavigatorHelper.Switch(importFilePage); }
private void OnTabSelected(Button btn) { if (btn == null) { return; } switch (btn.Content.ToString()) { case "Infos": if (!PageNavigatorHelper.IsCurrent <EndPointViewPage>()) { PageNavigatorHelper.Switch(new EndPointViewPage()); var viewModel = PageNavigatorHelper.GetMainContentViewModel <EndpointViewModel>(); viewModel.SetParams(ApplicationContext.NodesSelected[0].NodeId); viewModel.ReloadData(); } break; case UIConstant.GroupPolicies: if (!PageNavigatorHelper.IsCurrent <PolicyEnhancementPage>()) { PageNavigatorHelper.Switch(new PolicyEnhancementPage()); } break; case UIConstant.TaskListPage: if (!PageNavigatorHelper.IsCurrent <TaskListPage>()) { var taskListPage = new TaskListPage(); PageNavigatorHelper.Switch(taskListPage); } break; default: //Endpoint break; } }
private void OnPOCAgentNavExecute() { var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.POCAgent; ApplicationContext.IsRebuildTree = true; if (ApplicationContext.FolderPolicyList == null) { Functions.LoadFolderPolicy(); } if (ApplicationContext.EndpointPolicyList == null) { Functions.LoadEndpointPolicy(); } var rightVM = PageNavigatorHelper.GetRightElementViewModel(); rightVM.ReBuildTree(ApplicationContext.NodesSelected); } PageNavigatorHelper.Switch(new POCAgentPage()); }
private void CanTabSelected(Button btn) { if (btn == null || ApplicationContext.NodesSelected == null || ApplicationContext.NodesSelected.Count == 0 || ApplicationContext.IsFromLabel) { return; } List <DirectoryNode> folders = new List <DirectoryNode>(); List <DirectoryNode> endpoints = new List <DirectoryNode>(); foreach (var n in ApplicationContext.NodesSelected) { if (n.IsFolder) { folders.Add(n); } else { endpoints.Add(n); } } var mainViewModel = PageNavigatorHelper.GetMainModel(); if (mainViewModel != null) { mainViewModel.NavigationIndex = (int)NavigationIndexes.Colors; } //PageNavigatorHelper.Switch(new ColorCodePage(folders[0])); if (folders.Count == 0) { PageNavigatorHelper.Switch(new ColorCodePage(endpoints[0])); } else { PageNavigatorHelper.Switch(new ColorCodePage(folders[0])); } }
/// <summary> /// event selected collection changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DataTree_SelectedNodesCollectionChanged(object sender, NodeSelectionEventArgs e) { if (e.CurrentSelectedNodes.Count < 1) { if (DataTree.Equals(sender)) { ApplicationContext.IsError = true; ApplicationContext.NodesSelected = new List <DirectoryNode>(); } else { ApplicationContext.LabelNodesSelected = new List <DirectoryNode>(); } } else { if (SoftwareDataTree.Equals(sender)) { ApplicationContext.SoftwareSelectedNodeId = (e.CurrentSelectedNodes[0].Data as DirectoryNode).NodeId; if (PageNavigatorHelper.IsCurrent <SoftwarePage>()) { var viewModel = PageNavigatorHelper.GetMainContentViewModel <SoftwareViewModel>(); viewModel.SourceName = (e.CurrentSelectedNodes[0].Data as DirectoryNode).Title.ToUpper(); viewModel.BuidPage(); } return; } if (CheckScreenWithoutRefresh()) { return; } if (ApplicationContext.IsRebuildTree) { if (!LabelDataTree.Equals(sender) && e.CurrentSelectedNodes.Count == ApplicationContext.NodesSelected.Count) { ApplicationContext.IsRebuildTree = false; } if (LabelDataTree.Equals(sender) && e.CurrentSelectedNodes.Count == ApplicationContext.LabelNodesSelected.Count) { ApplicationContext.IsRebuildTree = false; } return; } var ln = new List <DirectoryNode>(); var fids = new List <DirectoryNode>(); var eids = new List <int>(); foreach (var cn in e.CurrentSelectedNodes) { var cnode = cn.Data as DirectoryNode; if (cnode != null) { ln.Add(cnode); if (cnode.IsFolder) { fids.Add(cnode); } else { eids.Add(cnode.NodeId); } } } var node = e.CurrentSelectedNodes[0].Data as DirectoryNode; if (node != null) { if (LabelDataTree.Equals(sender)) { if (Model.DirectoryPushed) { return; } ApplicationContext.LabelNodesSelected = ln; ApplicationContext.IsFromLabel = true; if (CheckEndpointNavigationClicked()) { if (e.CurrentSelectedNodes.Count == 1) { if (node.IsFolder) { var listResult = new List <ListLableEndpointResponse>(); foreach (var fid in fids) { var result = Model.GetEndpointByLabel(fid.NodeId, fid.Title); listResult.Add(result); } if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); viewModel.SetParamsValueForLabel(listResult, eids); viewModel.GetLabelData(); } else { //dislay EndpointView page if (!PageNavigatorHelper.IsCurrent <EndPointViewPage>()) { PageNavigatorHelper.Switch(new EndPointViewPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <EndpointViewModel>(); viewModel.SetParams(node.NodeId); viewModel.ReloadData(); } } else { var listResult = new List <ListLableEndpointResponse>(); foreach (var fid in fids) { var result = Model.GetEndpointByLabel(fid.NodeId, fid.Title); listResult.Add(result); } if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); viewModel.SetParamsValueForLabel(listResult, eids); viewModel.GetLabelData(); } } } else { if (!Model.DirectoryPushed) { return; } ApplicationContext.IsFromLabel = false; ApplicationContext.IsError = !node.IsFolder; ApplicationContext.NodeId = node.NodeId; //after add a note, select one node only if (ApplicationContext.IsAddNode) { var ns = new List <DirectoryNode>(); ns.Add(ln[0]); ln = ns; ApplicationContext.IsAddNode = false; if (CheckEndpointNavigationClicked()) { if (node.IsFolder) { //dislay GroupView page PageNavigatorHelper.Switch(new EndPointListPage()); var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); var selectedFolderIds = new List <int>(); var selectedEndpointIds = new List <int>(); selectedFolderIds.Add(node.NodeId); viewModel.SetParamsValueForDirectory(selectedFolderIds, selectedEndpointIds, ApplicationContext.SearchText, true, node.Guid, node.Title); viewModel.EditOrAdd(); } else { //dislay EndpointView page PageNavigatorHelper.Switch(new EndPointViewPage()); var viewModel = PageNavigatorHelper.GetMainContentViewModel <EndpointViewModel>(); viewModel.SetParams(node.NodeId); viewModel.EditOrAdd(node.Title, true); } } } else if (ApplicationContext.IsEditNode) { var ns = new List <DirectoryNode>(); ns.Add(ln[0]); ln = ns; ApplicationContext.IsEditNode = false; if (CheckEndpointNavigationClicked()) { if (node.IsFolder) { //dislay GroupView page if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); var selectedFolderIds = new List <int>(); var selectedEndpointIds = new List <int>(); selectedFolderIds.Add(node.NodeId); viewModel.SetParamsValueForDirectory(selectedFolderIds, selectedEndpointIds, ApplicationContext.SearchText, false, Guid.NewGuid(), ""); viewModel.EditOrAdd(); } else { //dislay EndpointView page if (!PageNavigatorHelper.IsCurrent <EndPointViewPage>()) { PageNavigatorHelper.Switch(new EndPointViewPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <EndpointViewModel>(); viewModel.SetParams(node.NodeId); viewModel.EditOrAdd(node.Title); } } } else { if (ApplicationContext.IsDeleteNode) { ApplicationContext.IsDeleteNode = false; } if (CheckEndpointNavigationClicked()) { if (e.CurrentSelectedNodes.Count == 1) { if (e.OriginalSelectedNodes.Count == 0) { if (node != null) { if (node.IsFolder) { ApplicationContext.NodesSelected = ln; var pageViewModel = PageNavigatorHelper.GetMainContentViewModel <PageViewModelBase>(); //if (pageViewModel != null && // pageViewModel.GetType() == typeof (ColorCodePageViewModel)) //{ // Model.GetBelowNode(node); // return; //} //if (pageViewModel != null && // pageViewModel.GetType() == typeof (AssignmentViewModel)) //{ // var assignmentVM = pageViewModel as AssignmentViewModel; // if (assignmentVM != null) // assignmentVM.GetRuleByFolder(); // Model.GetBelowNode(node); // return; //} if (pageViewModel != null && pageViewModel.GetType() == typeof(PolicyEnhancementPageViewModel)) { var assignmentVM = pageViewModel as PolicyEnhancementPageViewModel; if (assignmentVM != null) { assignmentVM.BuidPage(); } Model.GetBelowNode(node); return; } if (pageViewModel != null && pageViewModel.GetType() == typeof(TaskListViewModel)) { return; } //dislay GroupView page if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); var selectedFolderIds = new List <int>(); var selectedEndpointIds = new List <int>(); selectedFolderIds.Add(node.NodeId); viewModel.SetParamsValueForDirectory(selectedFolderIds, selectedEndpointIds, ApplicationContext.SearchText, false, Guid.NewGuid(), ""); viewModel.GetData(); } else { if (PageNavigatorHelper.IsCurrent <PolicyEnhancementPage>()) { ApplicationContext.NodesSelected = ln; var pageVM = PageNavigatorHelper.GetMainContentViewModel <PolicyEnhancementPageViewModel>(); if (pageVM != null) { pageVM.BuidPage(); } Model.GetBelowNode(node); return; } else if (PageNavigatorHelper.IsCurrent <TaskListPage>()) { ApplicationContext.NodesSelected = ln; var pageVM = PageNavigatorHelper.GetMainContentViewModel <TaskListViewModel>(); if (pageVM != null) { pageVM.Refresh(); } return; } //dislay EndpointView page if (!PageNavigatorHelper.IsCurrent <EndPointViewPage>()) { PageNavigatorHelper.Switch(new EndPointViewPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <EndpointViewModel>(); viewModel.SetParams(node.NodeId); viewModel.ReloadData(); } } } else { var oriNote = e.OriginalSelectedNodes[0].Data as DirectoryNode; if (e.OriginalSelectedNodes.Count == 1 && oriNote.IsFolder == node.IsFolder && oriNote.NodeId == node.NodeId) { //doing nothing because re-selected itself } else { if (node != null) { if (node.IsFolder) { if (PageNavigatorHelper.IsCurrent <ColorCodePage>()) { var viewModel = PageNavigatorHelper .GetMainContentViewModel <ColorCodePageViewModel>(); viewModel.SetParams(node); viewModel.GetData(); } else if (PageNavigatorHelper.IsCurrent <DirectoryAssignmentPage>()) { ApplicationContext.NodesSelected = ln; var viewModel = PageNavigatorHelper .GetMainContentViewModel <AssignmentViewModel>(); viewModel.GetRuleByFolder(); } else if (PageNavigatorHelper.IsCurrent <PolicyEnhancementPage>()) { ApplicationContext.NodesSelected = ln; var viewModel = PageNavigatorHelper.GetMainContentViewModel <PolicyEnhancementPageViewModel>(); if (viewModel != null) { viewModel.BuidPage(); } } else if (PageNavigatorHelper.IsCurrent <TaskListPage>()) { ApplicationContext.NodesSelected = ln; var viewModel = PageNavigatorHelper.GetMainContentViewModel <TaskListViewModel>(); if (viewModel != null) { viewModel.Refresh(); } } //dislay GroupView page else { if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); var selectedFolderIds = new List <int>(); var selectedEndpointIds = new List <int>(); selectedFolderIds.Add(node.NodeId); viewModel.SetParamsValueForDirectory(selectedFolderIds, selectedEndpointIds, ApplicationContext.SearchText, false, Guid.NewGuid(), ""); viewModel.GetData(); } } else { ApplicationContext.NodesSelected = ln; if (PageNavigatorHelper.IsCurrent <PolicyEnhancementPage>()) { var pageViewModel = PageNavigatorHelper.GetMainContentViewModel <PolicyEnhancementPageViewModel>(); if (pageViewModel != null) { pageViewModel.BuidPage(); } } else if (PageNavigatorHelper.IsCurrent <TaskListPage>()) { var taskListViewModel = PageNavigatorHelper.GetMainContentViewModel <PageViewModelBase>(); taskListViewModel.Refresh(); } else { //dislay EndpointView page if (!PageNavigatorHelper.IsCurrent <EndPointViewPage>()) { PageNavigatorHelper.Switch(new EndPointViewPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <EndpointViewModel>(); viewModel.SetParams(node.NodeId); viewModel.ReloadData(); } } } } } } else { if (PageNavigatorHelper.IsCurrent <PolicyEnhancementPage>()) { ApplicationContext.NodesSelected = ln; var pageViewModel = PageNavigatorHelper.GetMainContentViewModel <PolicyEnhancementPageViewModel>(); if (pageViewModel != null) { pageViewModel.BuidPage(); } return; } //dislay GroupView page if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); viewModel.SetParamsValueForDirectory(fids.Select(r => r.NodeId).ToList(), eids, ApplicationContext.SearchText, false, Guid.NewGuid(), ""); viewModel.GetData(); } } else if (PageNavigatorHelper.IsCurrent <POCQuarantinePage>()) { var viewModel = PageNavigatorHelper.GetMainContentViewModel <POCQuarantineViewModel>(); if (e.CurrentSelectedNodes.Count == 1) { if (!node.IsFolder) { viewModel.RefreshQuarantineByComputerIds(new List <int> { node.NodeId }); } else { viewModel.RefreshQuarantineByFolder(node.NodeId); } } else { viewModel.RefreshByGroupEntities(fids.Select(r => r.NodeId).ToList(), eids); } } } ApplicationContext.NodesSelected = ln; Model.GetBelowNode(node); } } } }
/// <summary> /// Called when [tab selected]. /// </summary> /// <param name="btn">The BTN.</param> private void OnTabSelected(Button btn) { if (btn == null || ApplicationContext.NodesSelected == null || ApplicationContext.NodesSelected.Count == 0) { return; } List <DirectoryNode> folders = new List <DirectoryNode>(); List <DirectoryNode> endpoints = new List <DirectoryNode>(); foreach (var n in ApplicationContext.NodesSelected) { if (n.IsFolder) { folders.Add(n); } else { endpoints.Add(n); } } switch (btn.Content.ToString()) { case UIConstant.ColorCodes: PageNavigatorHelper.Switch(new ColorCodePage(folders[0])); break; case UIConstant.Endpoints: var fids = folders.Select(e => e.NodeId).ToList(); var eids = endpoints.Select(e => e.NodeId).ToList(); if (!PageNavigatorHelper.IsCurrent <EndPointListPage>()) { PageNavigatorHelper.Switch(new EndPointListPage()); } var viewModel = PageNavigatorHelper.GetMainContentViewModel <GroupViewModel>(); viewModel.SetParamsValueForDirectory(fids, eids, ApplicationContext.SearchText, false, Guid.NewGuid(), ""); viewModel.GetData(); break; case UIConstant.DirectoryAssignment: if (!PageNavigatorHelper.IsCurrent <DirectoryAssignmentPage>()) { var assignmentPage = new DirectoryAssignmentPage(); PageNavigatorHelper.Switch(assignmentPage); } break; case UIConstant.TaskListPage: if (!PageNavigatorHelper.IsCurrent <TaskListPage>()) { var taskListPage = new TaskListPage(); PageNavigatorHelper.Switch(taskListPage); } break; case UIConstant.GroupPolicies: if (!PageNavigatorHelper.IsCurrent <PolicyEnhancementPage>()) { PageNavigatorHelper.Switch(new PolicyEnhancementPage()); } break; } }