}// MenuCommand private CNode CheckForDuplicateApp(AppFiles af) { // Run through this node's children to see if a node with this app file exists int iNumChildren = NumChildren; for (int i = 0; i < iNumChildren; i++) { CNode node = CNodeManager.GetNode(Child[i]); if (node is CApplication) { AppFiles afNode = ((CApplication)node).MyAppInfo; // Check the App file's name if ((af.sAppFile == null && afNode.sAppFile == null) || af.sAppFile.Equals(afNode.sAppFile)) { // Check the App File's config file if ((af.sAppConfigFile == null && afNode.sAppConfigFile == null) || af.sAppConfigFile.Equals(afNode.sAppConfigFile)) { return(node); } } } } // We couldn't find a node with that app info return(null); }// CheckForDuplicateApp
}// GetNodeByTitle //------------------------------------------------- // AddNode // // This function is called when we have created another // node and we want that node tracked by our Node Manager //------------------------------------------------- static internal int AddNode(ref CNode node) { // See if we have room from our last previous memory // allocation to fit in this new node. if (m_iNumSlots <= m_iCookieCount) { // Let's see if there are any other left-over // node slots int iOpenSpace = FindAvailableNode(m_nNodes); if (iOpenSpace != -1) { m_nNodes[iOpenSpace] = node; node.Cookie = iOpenSpace; return(iOpenSpace); } // Make our node array larger int iNewSlots = m_iNumSlots * 2; CNode[] newArray = new CNode[iNewSlots]; NullOutArray(ref newArray); for (int i = 0; i < m_iNumSlots; i++) { newArray[i] = m_nNodes[i]; } m_iNumSlots = iNewSlots; m_nNodes = newArray; } // Insert this node in the array m_nNodes[m_iCookieCount] = node; node.Cookie = m_iCookieCount; return(m_iCookieCount++); }// AddNode
}// MenuCommand internal override void TaskPadTaskNotify(Object arg, Object param, IConsole2 con, CData com) { // We want to browse this apps properties if ((int)arg == 0) { OpenMyPropertyPage(); } // We want to browse the Assembly Dependencies else if ((int)arg == 1) { CNode node = FindChild("Assembly Dependencies"); CNodeManager.SelectScopeItem(node.HScopeItem); node.MenuCommand(COMMANDS.SHOW_LISTVIEW); } // We want to Configure Assemblies else if ((int)arg == 2) { CNode node = FindChild("Configured Assemblies"); CNodeManager.SelectScopeItem(node.HScopeItem); } // We want to go to remoting node else if ((int)arg == 3) { CNode node = FindChild("Remoting Services"); CNodeManager.SelectScopeItem(node.HScopeItem); node.OpenMyPropertyPage(); } else if ((int)arg == 4) { MenuCommand(COMMANDS.FIX_APPLICATION); // Inform our Command History that we did this CCommandHistory.CommandExecuted(new CDO(this), COMMANDS.FIX_APPLICATION); } }// TaskPadTaskNotify
}// ExecuteCommand(int, bool) static private int GetResultNum(CNode node, StringCollection scResults) { // See if we can bail on this really quickly if (scResults.Count == 0) { return(-1); } // Grab the columnresultview interface IColumnResultView crv = (IColumnResultView)node; int iNumRows = crv.getNumRows(); // Let's start looking through the result items until we find the one we want for (int i = 0; i < iNumRows; i++) { // We have a good chance at a match int j; for (j = 0; j < scResults.Count; j++) { String sResultString = crv.getValues(i, j); if (!scResults[j].Equals(sResultString)) { break; } } if (j == scResults.Count) { // We found our match! return(i); } } // We couldn't find the item. return(-1); }// GetResultNum
}// AddMenuItems internal override void MenuCommand(int nCommandID, Object oResultItem) { if (nCommandID == COMMANDS.DUPLICATE_PERMISSIONSET) { NamedPermissionSet nps = (NamedPermissionSet)m_psetWrapper.PSet.Copy(); String sBaseName = nps.Name; nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:PrependtoDupPSets"), nps.Name); int nCounter = 1; // make sure it's not already used while (Security.isPermissionSetNameUsed(m_pl, nps.Name)) { nCounter++; nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:NumPrependtoDupPSets"), nCounter.ToString(), sBaseName); } CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem); CSinglePermissionSet newNode = ((CPermissionSet)node).AddPermissionSet(nps); newNode.SecurityPolicyChanged(); // Put the selection on the new permission set we just created CNodeManager.SelectScopeItem(newNode.HScopeItem); } else if (nCommandID == COMMANDS.VIEW_PERMISSION) { int iResultItem = (int)oResultItem - 1; // Pop up the Dialog Box for this permission (new CReadOnlyPermission((IPermission)m_alPermissions[iResultItem])).ShowDialog(); } else if (nCommandID == COMMANDS.ADD_PERMISSIONS) { CAddPermissionsWizard wiz = new CAddPermissionsWizard(m_psetWrapper); wiz.LaunchWizard(Cookie); if (wiz.didFinish) { SecurityPolicyChanged(); GenerateGivenPermissionsStringList(); CNodeManager.Console.SelectScopeItem(HScopeItem); } } else if (nCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (nCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskpad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForPermissionSet", "yes"); RefreshResultView(); } }// MenuCommand
}// RemoveSpecificChild protected void RemoveSpecificChildByIndex(int nIndex) { // Have this child remove all his children nodes as well ArrayList al = new ArrayList(); al.Add(CNodeManager.GetNode(Child[nIndex])); int i = 0; while (i < al.Count) { // Put all this guy's children in the queue as well CNode node = (CNode)al[i]; for (int j = 0; j < node.NumChildren; j++) { al.Add(CNodeManager.GetNode(node.Child[j])); } i++; } // Start from the bottom and work our way up while (al.Count > 0) { CNode node = (CNode)al[al.Count - 1]; // First, close any property pages associated with it node.CloseAllMyPropertyPages(); // Inform MMC of this removal CNodeManager.CNamespace.DeleteItem(node.HScopeItem, 1); // Remove this node from the list CNodeManager.RemoveNode(node.Cookie); al.RemoveAt(al.Count - 1); } }// RemoveSpecificChildByIndex
}// TaskPadTaskNotify internal bool AddConfiguredAssembly(BindingRedirInfo bri) { // Let's trace through our parents looking for an Application node // If this node's parent is an Application node, then we know we're // configuring assemblies on a per app basis CNode node = null; if (ParentHScopeItem != -1) { node = CNodeManager.GetNodeByHScope(ParentHScopeItem); } String sPostFix = ""; // If this is an application node, make sure we tell the config store // about it if (node is CApplication) { sPostFix = "," + ((CApplication)node).AppConfigFile; } if (!CConfigStore.SetSetting("ConfiguredAssemblies" + sPostFix, bri)) { return(false); } // Now we'll tell out node to Refresh itself, // but only if we're showing the list view if (m_oResults == this) { RefreshResultView(); } return(true); }// AddConfiguredAssembly
}// InsertPropSheetPageControls //------------------------------------------------- // PutValuesinPage // // This function put data onto the property page //------------------------------------------------- private void PutValuesinPage() { // Get info that we'll need from the node CNode node = CNodeManager.GetNode(m_iCookie); // This should be ok now, but if we need this functionality // off of different nodes..... CVersionPolicy vp = (CVersionPolicy)node; m_txtAssemName.Text = m_bri.Name; m_txtPublicKeyToken.Text = m_bri.PublicKeyToken; // Figure out the current Publisher Policy Setting String sGetSettingString = "PublisherPolicyFor" + m_bri.Name + "," + m_bri.PublicKeyToken; // If we are getting this from an App config file, let's add that info m_sConfigFile = vp.ConfigFile; if (m_sConfigFile != null) { sGetSettingString += "," + m_sConfigFile; bool fUsePubPolicy = (bool)CConfigStore.GetSetting(sGetSettingString); m_chkPubPolicy.Checked = fUsePubPolicy; } // If this isn't an app config file, we don't want to show the // 'Apply Publisher Policy' Checkbox or description else { m_chkPubPolicy.Visible = false; m_lblPublisherPolicyHelp.Visible = false; } }// PutValuesinPage
}// QueryDataObject //------------------------------------------------- // GetResultViewType // // This function is called when MMC needs to display // a specific node's information in the result pane. //------------------------------------------------- public int GetResultViewType(int cookie, out IntPtr ppViewType, out uint pViewOptions) { CNode node = CNodeManager.GetNode(cookie); CNodeManager.DisplayedNode = node; node.Showing(); // We never want the "view" menu to appear pViewOptions = MMC_VIEW_OPTIONS.NOLISTVIEWS | MMC_VIEW_OPTIONS.CREATENEW; // CNode.Result can be potientially expensive... make sure // we catch the result here. String res = node.Result; // We don't have a HTML (or taspad) to display, so we'll just show a // standard list view if (res == null) { ppViewType = (IntPtr)0; return(HRESULT.S_FALSE); } // Ok, we're displaying a HTML page or a Taskpad ppViewType = Marshal.StringToCoTaskMemUni(res); return(HRESULT.S_OK); }// GetResultViewType
}// QueryDataObject //------------------------------------------------- // GetDisplayInfo // // This function is called by MMC whenever it needs to // display a node in the scope pane. //------------------------------------------------- public void GetDisplayInfo(ref SCOPEDATAITEM sdi) { // First let's find this node we want info on.... CNode NodeWeWant = CNodeManager.GetNode((int)sdi.lParam); NodeWeWant.GetDisplayInfo(ref sdi); }// GetDisplayInfo
}// CIntroTaskPad internal override void Notify(Object arg, Object param, IConsole2 con, CData com) { String sNodeToOpen = null; // We want to browse the shared assemblies if ((int)arg == 1) { sNodeToOpen = "Assembly Cache"; } // We want to Configure Assemblies else if ((int)arg == 2) { sNodeToOpen = "Configured Assemblies"; } // We want to set Security Policy else if ((int)arg == 3) { sNodeToOpen = "Runtime Security Policy"; } // We want to go to remoting node else if ((int)arg == 4) { CNode node = m_myNode.FindChild("Remoting Services"); CNodeManager.SelectScopeItem(node.HScopeItem); node.OpenMyPropertyPage(); } // We want to go to the applications node else if ((int)arg == 5) { sNodeToOpen = "Applications"; } // This is a CommandHistory item else if ((int)arg >= 100) { CCommandHistory.FireOffCommand((int)arg); } else { MessageBox(0, "Error in web page! I don't know what to do!", "", 0); } if (sNodeToOpen != null) { CNode node = m_myNode.FindChild(sNodeToOpen); // This node must have a shared assemblies node... if it doesn't, then the // node hasn't added it's children yet. We'll force it to do that, and try // again if (node == null) { m_myNode.CreateChildren(); node = m_myNode.FindChild(sNodeToOpen); } CNodeManager.Console.SelectScopeItem(node.HScopeItem); } }// Notify
}// onDoubleClick internal override int onDelete(Object o) { String sMessage; if (o is ArrayList) { sMessage = CResourceStore.GetString("CVersionPolicy:ConfirmDeleteConfig"); } else { sMessage = String.Format(CResourceStore.GetString("CVersionPolicy:ConfirmDeleteSingleConfig"), ((BindingRedirInfo)o).Name); } int nRes = MessageBox(sMessage, CResourceStore.GetString("CVersionPolicy:ConfirmDeleteConfigTitle"), MB.ICONQUESTION | MB.YESNO); if (nRes == MB.IDYES) { // Let's trace through our parents looking for an Application node CNode node = CNodeManager.GetNode(m_iCookie); // If this node's parent is an Application node, then we know we're // configuring assemblies on a per app basis int iParentHScope = node.ParentHScopeItem; if (iParentHScope != -1) { node = CNodeManager.GetNodeByHScope(iParentHScope); } String sPostFix = ""; // If this is an application node, make sure we tell the config store // about it if (node is CApplication) { sPostFix = "," + ((CApplication)node).AppConfigFile; } if (o is ArrayList) { ArrayList al = (ArrayList)o; int nLen = al.Count; for (int i = 0; i < nLen; i++) { int iResultNum = ((int)al[i]) - 1; CConfigStore.SetSetting("ConfiguredAssembliesDelete" + sPostFix, ((BindingRedirInfo)m_ol[iResultNum])); } } else { CConfigStore.SetSetting("ConfiguredAssembliesDelete" + sPostFix, (BindingRedirInfo)o); } // Now we'll Refresh ourselves RefreshResultView(); } return(HRESULT.S_OK); }// onDelete
}// IgnoreCommandForHistory static internal void CommandExecuted(CDO cdo, int iMenuCommand) { // See if we actually care about this command if (IgnoreCommandForHistory(iMenuCommand)) { return; } // If this is a command on a result item, but we don't have an // index number, then we can't create a shortcut for this item if (cdo.Data != null && !(cdo.Data is int)) { return; } // Pull the data we need out of the CDO interface CNode node = cdo.Node; int iResultNum = cdo.Data == null?-1:(int)cdo.Data; // Let's build the string of what the user actually did String sAction = TranslateMenuCommandToString(node, iResultNum, iMenuCommand); if (sAction == null) { // We don't know how to represent this command as a string... let's bail return; } // IncrementCommand will return false if we don't know about this command. if (!IncrementCommand(sAction)) { // We need to add this command CommandHistory ch = new CommandHistory(); ch.scPathToNode = BuildPathToNode(cdo.Node); ch.iNumHits = 3; ch.iMenuCommand = iMenuCommand; ch.sCommand = sAction; // Let's get the result item name ch.scResultItem = new StringCollection(); if (iResultNum != -1) { // We're dealing with a result item here IColumnResultView crv = (IColumnResultView)node; int iNumCols = crv.getNumColumns(); // iResultNum needs to be zero-based for (int i = 0; i < iNumCols; i++) { ch.scResultItem.Add(crv.getValues(iResultNum - 1, i)); } } m_olCommands.Add(ch); } }// CommandExecuted
internal CSecurityPolicyTaskPad(CNode n, String sPolicyLevel, String sCurrentPolFile, String sRealPolFile, bool fReadOnly) : base(n) { m_sPolicyLevel = sPolicyLevel; m_sRealPolicyFile = sRealPolFile; m_sCurrentPolicyFile = sCurrentPolFile; m_fReadOnly = fReadOnly; }// CSecurityPolicyTaskPad
protected void SecurityPolicyChanged() { // Let's tell our parent that security policy changed... CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem); if (node is CSecurityNode) { ((CSecurityNode)node).SecurityPolicyChanged(); } } // SecurityPolicyChanged
}// Destroy //------------------------------------------------- // QueryDataObject // // When MMC wants a data object for a specific cookie, // this function will be called. //------------------------------------------------- public void QueryDataObject(int cookie, uint type, out IDataObject ppDataObject) { CNode node = CNodeManager.GetNode(cookie); if (node == null) { node = m_rn; } ppDataObject = new CDO(node); }// QueryDataObject
}// GetResultViewType //------------------------------------------------- // GetDisplayInfo // // This function is called by MMC whenever it needs to // display a node in the result view. //------------------------------------------------- public void GetDisplayInfo(ref RESULTDATAITEM ResultDataItem) { // The low word in the lParam contains the index of the node // we're interested in. CNode NodeWeWant = CNodeManager.GetNode((int)ResultDataItem.lParam & 0xffff); // We'll let the node take care of its own Result Data NodeWeWant.GetResultDisplayInfo(ref ResultDataItem); }// GetDisplayInfo
}// Location //------------------------------------------------- // Init // // This function is called when we're ready to use // the property page. We pass in the cookie of the // node that this property page belongs to, and we // should do any setup information (with the exception // of creating Winform controls) here. //------------------------------------------------- internal virtual void Init(int iCookie, IntPtr routerhandle) { m_iCookie = iCookie; // We won't cache the node, in case it changes somehow // during the life of the property page CNode node = CNodeManager.GetNode(m_iCookie); m_hIcon = node.IconHandle; m_hPropertyPageRouter = routerhandle; }// Init
}// InsertChildren internal void InsertSpecificChild(int iChild) { SCOPEDATAITEM sdi = new SCOPEDATAITEM(); CNode nChild = CNodeManager.GetNode(iChild); sdi.mask = SDI.STR | SDI.PARAM | SDI.PARENT | SDI.IMAGE | SDI.OPENIMAGE | SDI.CHILDREN; // The image index is going to be the same as the cookie value sdi.nImage = CResourceStore.GetIconCookie(nChild.IconHandle); // The open image is the same as the closed image sdi.nOpenImage = sdi.nImage; sdi.relativeID = m_iHScopeItem; // We set displayname to -1 to initiate a callback for the string // (We need to do it this way... it's an MMCism) sdi.displayname = (IntPtr)(-1); sdi.lParam = nChild.Cookie; // The children field is set to either 0 or 1 (if it has children or not) sdi.cChildren = (nChild.NumChildren == 0)?0:1; // Once the item has been inserted, we're given the HScopeItem value for the node // MMC uses this value to uniquely identify the node. We'll store it for future // use. nChild.HScopeItem = CNodeManager.InsertItem(sdi); // We'll also put in the parent's HScopeItem nChild.m_iParentHScopeItem = HScopeItem; // Also, we can be slick and expand this child's node too // We don't care about perf savings after startup... do the expansion now // Also, if we have a non MMC host, we're not sure how it will behave // if it doesn't have all the nodes. Let's force the expand if we're not // running under MMC if (m_fInitialCreationDone || CNodeManager.Console is INonMMCHost) { // Expand this child CNodeManager.ExpandNodeNamespace(nChild.HScopeItem); } else if (Cookie == 0) { Thread t = new Thread(new ThreadStart(nChild.LazyExpand)); t.Start(); } }// InsertSpecificChild
internal CWizard() { // Register this Wizard with the node manager CNode me = this; m_nCookie = CNodeManager.AddNode(ref me); // Set our Property Page Template to use that of wizards m_sPropPageTemplate = "IDD_WFCWRAPPERWIZARD"; m_fFinish = false; m_fBack = false; m_fNext = false; m_fDisabledFinish = false; }// CWizard
}// CreatePropertyPages internal CSinglePermissionSet AddPermissionSet(NamedPermissionSet nps) { // Run up until we come to the policy node CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem); while (!(node is CSecurityPolicy)) { node = CNodeManager.GetNodeByHScope(node.ParentHScopeItem); } // Ok, we have the policy node. Let's tell it to add this permission set return(((CSecurityPolicy)node).AddPermissionSet(nps)); }// AddPermissionSet
}// AddMenuItems internal override void MenuCommand(int iCommandID, Object oResultNum) { if (iCommandID == COMMANDS.ADD_ASSEMBLY) { CApplicationDepends appDepends = null; // Let's trace through our parents looking for an Application node CNode node = CNodeManager.GetNode(m_iCookie); // If this node's parent is an Application node, then we know we're // configuring assemblies on a per app basis int iParentHScope = node.ParentHScopeItem; if (iParentHScope != -1) { node = CNodeManager.GetNodeByHScope(iParentHScope); } // If this is an application node, make sure we tell the config store // about it if (node is CApplication) { // Cool, we have a dependent assemblies node appDepends = ((CApplication)node).AppDependsNode; } CConfigAssemWizard wiz = new CConfigAssemWizard(appDepends); wiz.LaunchWizard(Cookie); if (wiz.NewAssembly != null) { if (AddConfiguredAssembly(wiz.NewAssembly)) { onDoubleClick(wiz.NewAssembly); } } } else if (iCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (iCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskPad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForConfigAssem", "yes"); RefreshResultView(); } }// MenuCommand
}// IncrementCommand static private StringCollection BuildPathToNode(CNode node) { StringCollection sc = new StringCollection(); int iParentHScope = node.ParentHScopeItem; sc.Add(node.Name); while (iParentHScope != -1) { node = CNodeManager.GetNodeByHScope(iParentHScope); iParentHScope = node.ParentHScopeItem; sc.Add(node.Name); } return(sc); }// BuildPathToNode
}// AddMenuItems internal override void MenuCommand(int iCommandID) { if (iCommandID == COMMANDS.NEW_PERMISSIONSET) { CNewPermSetWizard wiz = new CNewPermSetWizard(m_pl); wiz.LaunchWizard(Cookie); if (wiz.CreatedPermissionSet != null) { CNode node = AddPermissionSet(wiz.CreatedPermissionSet); SecurityPolicyChanged(); // Now select the permission set we just created CNodeManager.SelectScopeItem(node.HScopeItem); } } }// MenuCommand
}// InsertSpecificChild internal CNode FindChild(String s) { int iNumChildren = NumChildren; for (int i = 0; i < iNumChildren; i++) { CNode node = CNodeManager.GetNode(Child[i]); if (node.Name.Equals(s)) { return(node); } } // We couldn't find that child return(null); }// FindChild
}// Paste //------------------------------------------------- // CreateChildren // // This function creates the node's children, registers // the nodes with the node manager, and places the node's // cookies in it's child array //------------------------------------------------- internal override void CreateChildren() { CNode node = null; int iCookie = 0; // Let's scrounge together a permission set enumerator IEnumerator permsetEnumerator = m_pl.NamedPermissionSets.GetEnumerator(); while (permsetEnumerator.MoveNext()) { NamedPermissionSet permSet = (NamedPermissionSet)permsetEnumerator.Current; node = new CSinglePermissionSet(permSet, m_pl, ReadOnly); iCookie = CNodeManager.AddNode(ref node); AddChild(iCookie); } }// CreateChildren
private Object m_Data; // Some data that could be passed //------------------------------------------------- // CDO // // The constructor is responsible for loading the about images // that will be displayed in the MMC //------------------------------------------------- internal CDO(CNode initData) { // Set the Node this Data Object will be responsible for m_NodeData = initData; m_Data = null; // Get the Clipboard Format Numbers for these various items. // MMC should have already registered these Clipboard Formats, // so this call just gives us the id assigned for each format. m_cfDisplayName = RegisterClipboardFormat("CCF_DISPLAY_NAME"); m_cfNodeType = RegisterClipboardFormat("CCF_NODETYPE"); m_cfSZNodeType = RegisterClipboardFormat("CCF_SZNODETYPE"); m_cfSnapinClsid = RegisterClipboardFormat("CCF_SNAPIN_CLASSID"); m_cfMultiSelect = RegisterClipboardFormat("CCF_OBJECT_TYPES_IN_MULTI_SELECT"); }// CDO
}// Notify //------------------------------------------------- // Destroy // // This cleans up whatever needs to be cleaned up. // Normally, this would be used to release any interfaces // we had that traced back to the console. We can do this // by removing any references we have to the interfaces... //------------------------------------------------- public void Destroy() { if (m_Component != null) { CNodeManager.Shutdown(); CResourceStore.Shutdown(); CHTMLFileGen.Shutdown(); CCommandHistory.Shutdown(); m_Component = null; m_rn = null; } if ((m_ucsole != null) && (Marshal.IsComObject(m_ucsole))) { Marshal.ReleaseComObject(m_ucsole); } }// Destroy
}// PermissionSetNode //------------------------------------------------- // CreateChildren // // This function creates the node's children, registers // the nodes with the node manager, and places the node's // cookies in it's child array //------------------------------------------------- internal override void CreateChildren() { CNode node = null; int iCookie = 0; node = new CCodeGroups(ref m_pl, ReadOnly); iCookie = CNodeManager.AddNode(ref node); AddChild(iCookie); node = new CPermissionSet(m_pl, ReadOnly); iCookie = CNodeManager.AddNode(ref node); AddChild(iCookie); node = new CTrustedAssemblies(m_pl, ReadOnly); iCookie = CNodeManager.AddNode(ref node); AddChild(iCookie); } // CreateChildren
}// onDeleteEntireRow private void PutValuesinPage() { // Get info that we'll need from the node CNode node = CNodeManager.GetNode(m_iCookie); // This should be ok now, but if we need this functionality // off of different nodes..... CVersionPolicy vp = (CVersionPolicy)node; String sGetSettingString = "BindingPolicyFor" + m_bri.Name + "," + m_bri.PublicKeyToken; // If we are getting this from an App config file, let's add that info m_sConfigFile = vp.ConfigFile; if (m_sConfigFile != null) { sGetSettingString += "," + m_sConfigFile; } BindingPolicy bp = (BindingPolicy)CConfigStore.GetSetting(sGetSettingString); int iLen = bp.scBaseVersion.Count; for (int i = 0; i < iLen; i++) { DataRow newRow; newRow = m_dt.NewRow(); newRow["Requested Version"] = bp.scBaseVersion[i]; newRow["New Version"] = bp.scRedirectVersion[i]; m_dt.Rows.Add(newRow); } // We want to have at least 1 row while (m_dt.Rows.Count < 1) { DataRow newRow; newRow = m_dt.NewRow(); newRow["Requested Version"] = ""; newRow["New Version"] = ""; m_dt.Rows.Add(newRow); } m_dg.CurrentCell = new DataGridCell(iLen, 0); }// PutValuesinPage