コード例 #1
0
 public TreeListOperationFindNodeByProductAndCountryValues(object productID, object countryID)
 {
     this.productIDCore = productID;
     this.countryIDCore = countryID;
     this.nodeCore      = null;
     this.isNullCore    = TreeListData.IsNull(productIDCore) || TreeListData.IsNull(countryIDCore);
 }
コード例 #2
0
        private bool FindNodeBySettings_Sophis(Sophis.Util.GUI.CustomTreeList objTreeList, int iDepths, int iCurrentDep, string[] arrNodeSearchItems, ref TreeListNode objCurrentNode, int iColumn)
        {
            Logger.logBegin("FindNodeBySettings_Sophis");
            ReflectorForCSharp objReflector = new ReflectorForCSharp();

            try
            {
                TreeListData objData = objReflector.GetMember <TreeListData>(objTreeList, "Data");
                if (objData == null)
                {
                    Logger.Info("FindNodeBySettings_Sophis", "Can't get Data from object instance via reflection.");
                    return(false);
                }
                if (objData.DataList == null)
                {
                    Logger.Info("FindNodeBySettings_Sophis", "DataList is null");
                    return(false);
                }

                /** +		virtualDataHelper	{Sophis.Util.GUI.CustomTLVDH}	DevExpress.XtraTreeList.TreeList.TreeListVirtualDataHelper {Sophis.Util.GUI.CustomTLVDH}
                 * -		objData.DataHelper	{DevExpress.XtraTreeList.Data.TreeListDataHelper}	DevExpress.XtraTreeList.Data.TreeListDataHelper
                 *
                 *
                 * object o = objData.GetValue(0, 0);
                 * string strCellDis = objTreeList.Nodes[0].GetDisplayText(objTreeList.Columns[0]) ;
                 * object or = objData.GetDataRow(objTreeList.Nodes[0].Id);
                 * strCellDis = objData.GetDisplayText(objTreeList.Nodes[0].Id, objTreeList.Columns[0].AbsoluteIndex, objTreeList.Nodes[0]);
                 * object oc = objReflector.GetMember<object>(objTreeList, "CurrencyManager");
                 * object ov = objReflector.CallPrivateMethod<object>(objTreeList, "GetNodeValue", new object[] {objTreeList.Nodes[0],objTreeList.Columns[0] });
                 * object objHelper0 = objReflector.GetMember<object>(objTreeList, "VirtualDataHelper");
                 * object objHelper2 = objReflector.GetPrivateProperty<object>(objTreeList, "VirtualDataHelper");
                 * TreeList.TreeListVirtualDataHelper objDataHelper = (TreeList.TreeListVirtualDataHelper)(objHelper0) ;
                 * object objCellData = objDataHelper.GetCellDataViaEvent(((VirtualDataRow)objData.DataList[0]).Node, objTreeList.Columns[0]);
                 * objCellData = objDataHelper.GetCellDataViaEvent(objTreeList.Nodes[0], objTreeList.Columns[0]);
                 * objCellData = objDataHelper.GetCellDataViaInterface(((VirtualDataRow)objData.DataList[0]).Node, objTreeList.Columns[0], null);
                 * objCellData = objDataHelper.GetCellDataViaInterface(objTreeList.Nodes[0], objTreeList.Columns[0], null);
                 * object value = typeof(TreeListVirtualData).GetField("virtualNodeToDataRowCache", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(objData);
                 *  **/
                //DevExpress.XtraTreeList.TreeList.TreeListVirtualDataHelper objHelper1 = objReflector.GetPrivateProperty<DevExpress.XtraTreeList.TreeList.TreeListVirtualDataHelper>(objTreeList, "virtualDataHelper");
                //GetCellDataViaEvent
                for (int i = 0; i < objData.DataList.Count; i++)
                {
                    object objRawItem = objData.DataList[i];
                    if (!(objRawItem is VirtualDataRow))
                    {
                        /** I don't know what it could be **/
                        continue;
                    }
                    VirtualDataRow objRow = (VirtualDataRow)objRawItem;

                    if (objRow.VirtualNode == null)
                    {
                        continue;
                    }
                    string strCaption = objRow.VirtualNode.ToString();
                    if (TigerMarsUtil.RegularTest(arrNodeSearchItems[iCurrentDep], strCaption))
                    {
                        /** find **/
                        Logger.Info("FindNodeBySettings_Sophis", string.Format("Find Level [{0}] node information [{1}], with node value is:[{2}]", iCurrentDep, arrNodeSearchItems[iCurrentDep], strCaption));
                        if (iCurrentDep == iDepths - 1)
                        {
                            objCurrentNode          = objTreeList.Nodes[i];
                            objTreeList.FocusedNode = objTreeList.Nodes[i];
                        }
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception e)
            {
                Logger.Error("FindNodeBySettings_Sophis", string.Format("Exceptions when trying to get data via Reflection. Exception:[{0}]", e.Message), e);
                return(false);
            }
        }