private void OnWatchWindowMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { InspectionData itemSelected = (InspectionData)inspectionView.SelectedItem; string newQualifiedName = string.Empty; if (null != itemSelected) { newQualifiedName = itemSelected.GetQualifiedName(); } if (currentQualifiedName == newQualifiedName) { return; } // Unhighlight through the current qualified name, if any. if (string.IsNullOrEmpty(currentQualifiedName) == false) { HighlightQualifiedName(currentQualifiedName, false); } // Highlight the new qualified name... currentQualifiedName = string.Empty; if (string.IsNullOrEmpty(newQualifiedName) == false) { if (HighlightQualifiedName(newQualifiedName, true)) { currentQualifiedName = newQualifiedName; } } }
internal string GetQualifiedName() { if (null == parentData) { return(this.expression); } string parentQualifiedName = parentData.GetQualifiedName(); if (this.arrayIndexer == -1) // This is a regular data member. { return(string.Format("{0}.{1}", parentQualifiedName, this.expression)); } // This guy has got a valid index, so it's an array indexer. return(string.Format("{0}[{1}]", parentQualifiedName, arrayIndexer)); }
/// <summary> /// This method is hit on one condition: the variable CAN be expanded by pressing the [+] /// symbol in the watch window. This means some sort of expansion should replace the silly old /// 'This is dummy' and populate it. This method goes about populating the selectedData.Derivations /// for arrays and classes (which are the only expandable variables in a watch window). /// For arrays, this method also tests if the array is larger than a certain value, indicating to /// the user that it may take some time to expand. /// </summary> /// <param name="selectedData"> InspectionData object of the variable that is to be expanded</param> public void ExpandInspection(InspectionData selectedData) { selectedData.IsExpanded = true; string qualifiedName = selectedData.GetQualifiedName(); ProtoCore.Lang.Obj stackValue = GetStackValue(qualifiedName); CreateDataRecursive(selectedData, stackValue); #if false ProtoCore.Lang.Obj dataObj = null; // Use Inspection Parser to parse the string to decipher what kind of expansion required InspectionParser parser = new InspectionParser(selectedData.Name); bool limit = false; int limitValue = 0; List<string> parsedCommands = null; // An inspection variable needs parsing when it contains: // [] (array) and/or // '.' (class properties) and/or // ',' (limit) if (parser.NeedsParsing()) { parsedCommands = parser.GetParsedCommands(); if (parser.IsValid == true) { // Use GetParsedObject method to decipher Obj from parsed string dataObj = GetParsedObject(parsedCommands, out limit); // A limit is indicated by a comma (,) if (limit) { // The limit should ALWAYS be the last item in parsed commands string val = parsedCommands[parsedCommands.Count - 1].Replace(",", string.Empty); limitValue = Convert.ToInt32(val); } } else dataObj = null; } else { dataObj = GetInnerInspectionObject(selectedData); } // If, from any level above the dataObj is null, throw an exception if (dataObj == null) { //Throw exceptions string n = selectedData.Name; string v = GetStackValuePayload(n); string t = GetStackValueType(n); // Replace the current data with the exceptions relevant for it RemoveInspectionData(selectedData); dataCollection.Insert(dataCollection.Count - 1, new InspectionData(n, v, t)); } // Otherwise expand it by one more level yo! else { if (selectedData.Type == "array") ExpandArrayInspectionData(selectedData, limit); else ExpandClassInspectionData(selectedData); } #endif }