partial void OnRefresh(NSObject sender) { nint row = SearchResultOutlineView.SelectedRow; if (isObjectSelected(row)) { DirectoryNonExpandableNode node = SearchResultOutlineView.ItemAtRow(row) as DirectoryNonExpandableNode; node.PerformRefreshNode(); } }
private async Task GetPage() { resultStatusLabel.Text = VMDirConstants.STAT_SR_FETCHING_PG; IntPtr _timeout = Marshal.AllocCoTaskMem(sizeof(int)); Marshal.WriteInt32(_timeout, VMDirConstants.SEARCH_TIMEOUT_IN_SEC); try { _qdto.TimeOut = _timeout; _serverDTO.Connection.PagedSearch(_qdto, _pageSize, _cookie, _morePages, delegate(ILdapMessage ldMsg, IntPtr ck, bool moreP, List <ILdapEntry> entries) { _cookie = ck; _morePages = moreP; _totalCount += entries.Count(); _pageNumber++; foreach (var entry in entries) { var ocList = new List <string>(entry.getAttributeValues(VMDirConstants.ATTR_OBJECT_CLASS).Select(x => x.StringValue).ToArray()); var node = new DirectoryNonExpandableNode(entry.getDN(), ocList, _serverDTO, this.propertiesControl1); node.NodeProperties = _serverDTO.Connection.GetEntryProperties(entry); _result.Add(node); } }); _totalPage = _totalCount / _pageSize; if (_totalCount % _pageSize > 0) { _totalPage++; } if (_morePages) { resultStatusLabel.Text = VMDirConstants.STAT_SR_MORE_PG; } else { resultStatusLabel.Text = VMDirConstants.STAT_SR_NO_MORE_PG; } } catch (Exception e) { resultStatusLabel.Text = VMDirConstants.STAT_SR_FAILED_PG; VMDirEnvironment.Instance.Logger.LogException(e); MiscUtilsService.ShowError(e); } finally { Marshal.FreeCoTaskMem(_timeout); } }
private void performDelete(DirectoryNonExpandableNode node) { MiscUtilsService.CheckedExec(delegate() { if (!MMCDlgHelper.ShowQuestion(string.Format(CommonConstants.CONFIRM_DELETE, "object", Text))) { return; } node.Delete(); this.resultTreeView.Nodes.Remove(node); if (_result != null) { _result.Remove(node); } }); }
private void GetPage() { SetHeaderText(VMDirConstants.STAT_SR_FETCHING_PG); //_qdto.TimeOut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32))); //Marshal.WriteInt32(_qdto.TimeOut, VMDirConstants.SEARCH_TIMEOUT_IN_SEC); try { _serverDTO.Connection.PagedSearch(_qdto, _pageSize, _cookie, _morePages, delegate(ILdapMessage ldMsg, IntPtr ck, bool moreP, List <ILdapEntry> entries) { _cookie = ck; _morePages = moreP; _totalCount += entries.Count(); _pageNumber++; foreach (var entry in entries) { var ocList = new List <string>(entry.getAttributeValues(VMDirConstants.ATTR_OBJECT_CLASS).Select(x => x.StringValue).ToArray()); var node = new DirectoryNonExpandableNode(entry.getDN(), ocList, _serverDTO); node.NodeProperties = _serverDTO.Connection.GetEntryProperties(entry); _resultList.Add(node); } }); _totalPage = _totalCount / _pageSize; if (_totalCount % _pageSize > 0) { _totalPage++; } if (_morePages) { SetHeaderText(VMDirConstants.STAT_SR_MORE_PG); } else { SetHeaderText(VMDirConstants.STAT_SR_NO_MORE_PG); } } catch (Exception e) { UIErrorHelper.ShowError(e.Message); } finally { //Marshal.FreeHGlobal(_qdto.TimeOut); } }
//Right click menu event for the outlineview. public override NSMenu MenuForEvent(NSEvent theEvent) { int row = (int)this.SelectedRow; if (row >= (nint)0) { NSObject obj = this.ItemAtRow(row); if (obj != null) { NSMenu menu = new NSMenu(); if (obj is DirectoryNonExpandableNode) { DirectoryNonExpandableNode node = obj as DirectoryNonExpandableNode; if (node.ObjectClass.Contains(VMDirConstants.USER_OC)) { menu.AddItem(NSMenuItem.SeparatorItem); NSMenuItem addUsertoGroup = new NSMenuItem("Add to a Group", node.AddUserToGroup); menu.AddItem(addUsertoGroup); NSMenuItem resetPassword = new NSMenuItem("Reset Password", node.RestUserPassword); menu.AddItem(resetPassword); NSMenuItem verifyUserPassword = new NSMenuItem("Verify Password", node.VerifyUserPassword); menu.AddItem(verifyUserPassword); menu.AddItem(NSMenuItem.SeparatorItem); } else if (node.ObjectClass.Contains(VMDirConstants.GROUP_OC)) { menu.AddItem(NSMenuItem.SeparatorItem); NSMenuItem addGrouptoGroup = new NSMenuItem("Add to a Group", node.AddUserToGroup); menu.AddItem(addGrouptoGroup); menu.AddItem(NSMenuItem.SeparatorItem); } NSMenuItem delete = new NSMenuItem("Delete", node.Delete); menu.AddItem(delete); NSMenuItem refresh = new NSMenuItem("Refresh", node.RefreshNode); menu.AddItem(refresh); } NSMenu.PopUpContextMenu(menu, theEvent, theEvent.Window.ContentView); } } return(base.MenuForEvent(theEvent)); }
void resultTreeView_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Point p = new Point(e.X, e.Y); DirectoryNonExpandableNode node = resultTreeView.GetNodeAt(p) as DirectoryNonExpandableNode; if (node != null) { resultTreeView.SelectedNode = node; cmuResultTreeView.Items.Clear(); cmuResultTreeView.Items.Add(tsmiAddToGroup); cmuResultTreeView.Items.Add(tsmiDelete); cmuResultTreeView.Items.Add(tsmiRefresh); if (node.ObjectClass.Contains(VMDirConstants.USER_OC)) { cmuResultTreeView.Items.Add(tsmiResetUserPassword); cmuResultTreeView.Items.Add(tsmiVerifyUserPassword); } cmuResultTreeView.Show(resultTreeView, p); } } }