public static settingsPropertyEntryWithContext getSPEC(this Object input, String propertyPath) { // PropertyInfo pi = input.getProperty(propertyPath); List <string> propPath = propertyPath.SplitSmart("."); //.getPropertyPathElements("."); Type ti = input.GetType(); //.getTypology(); // pt = input.GetType(); PropertyInfo c = null; PropertyInfo pi = null; Object parent = input; foreach (String pe in propPath) { pi = ti.GetProperty(pe); if (pi != null) { ti = pi.PropertyType; if (propPath.Last() != pe) { parent = parent.imbGetPropertySafe(pi.Name); //parent.GetPropertyValue(pi.Name); } } c = pi; //c.property = ti.getPropertyInfo(pe); //c.parentInstance = c.propertyValue; //ti = c.property.type.getTypology(); } settingsPropertyEntryWithContext sPEWC = new settingsPropertyEntryWithContext(pi, parent); return(sPEWC); }
public static void DeployProperties(this DirectedGraph graph, Node node, Object nodeSource, settingsEntriesForObject SEO) { foreach (KeyValuePair <string, settingsPropertyEntryWithContext> spe in SEO.spes) { settingsPropertyEntryWithContext sPEC = spe.Value; graph.PropertyDeclaration.RegisterProperty(spe.Value); node.Properties.Add(sPEC.pi.GetGUI(), sPEC.pi.GetValue(nodeSource, null).toStringSafe(), ""); } }
/// <summary> /// Gets the data table fpr presenter /// </summary> /// <param name="items">The items.</param> /// <param name="presenter">The presenter.</param> /// <param name="isPreviewTable">if set to <c>true</c> [is preview table].</param> /// <param name="runMonitorCheck">if set to <c>true</c> [run monitor check].</param> /// <returns></returns> internal virtual DataTable getDataTable(IEnumerable items, dataUnitPresenter presenter, bool isPreviewTable, bool runMonitorCheck = false) { if (presenter == complete_Table) { if (tableShema.Columns.Count == 0) { tableShema = buildDataTableShema(presenter); } } DataTable output = selectDataTableShema(tableShema, presenter); if (runMonitorCheck) { map.monitor.prepare(); } int rowLimit = -1; if (isPreviewTable) { rowLimit = output.ExtendedProperties.getProperInt32(-1, templateFieldDataUnit.previewRowLimit); } int c = 0; foreach (object item in items) { DataRow dr = output.NewRow(); if (runMonitorCheck) { map.monitor.runFunctions(item); } foreach (DataColumn dc in output.Columns) { settingsPropertyEntryWithContext sce = dc.ExtendedProperties.getProperField(templateFieldDataTable.col_propertyInfo) as settingsPropertyEntryWithContext; dr[dc] = sce.pi.GetValue(item, null); } if (runMonitorCheck) { map.monitor.unlock(); } output.Rows.Add(dr); c++; if ((rowLimit > 0) && (c > rowLimit)) { break; } } return(output); }
protected void changeValue(settingsPropertyEntryWithContext spec, Boolean forward, Int32 step = 1) { if (spec.pi.PropertyType.isBoolean()) { Boolean bvl = !spec.value.imbToBoolean(); spec.value = bvl; //extraLine += "[SPACE] Toggle to " + bvl.ToString() + " [+] True [-] False"; } else if (spec.type.IsEnum) { if (forward) { spec.value = spec.acceptableValues.takeItemRelativeTo(spec.value, step); } else { spec.value = spec.acceptableValues.takeItemRelativeTo(spec.value, -step); } // extraLine += "[+][-] Select value"; } else if (spec.type.isText()) { // extraLine += "[SPACE] Edit value"; } else if (spec.type.isNumber()) { if (!forward) { step = -step; } if (spec.type == typeof(Double)) { spec.value = spec.value.changeValueDouble(step); } else { spec.value = spec.value.changeValueAsInt32(step); } // extraLine += "[SPACE] Edit value [+][-] Change value | with [Alt] 5x | with [Ctrl] 10x"; } else { // extraLine += "[SPACE] Edit value"; } }
/// <summary> /// Gets the monitoring function. /// </summary> /// <param name="propertyEntry">The property entry.</param> /// <param name="instanceType">Type of the instance.</param> /// <returns>null if function not found or set to none</returns> public static dataUnitRowMonitoringDefinition getMonitoringFunction(this settingsPropertyEntryWithContext propertyEntry, Type instanceType) { if (!propertyEntry.attributes.ContainsKey(imbAttributeName.reporting_function)) { return(null); } monitoringFunctionEnum function = propertyEntry.attributes.getProperEnum <monitoringFunctionEnum>(monitoringFunctionEnum.none, imbAttributeName.reporting_function); if (function == monitoringFunctionEnum.none) { return(null); } string toWatch = propertyEntry.attributes.getProperString(imbAttributeName.measure_operand); var wpi = instanceType.GetProperty(toWatch); dataUnitRowMonitoringDefinition output = new dataUnitRowMonitoringDefinition(wpi, propertyEntry.pi, function); return(output); }
protected void changeValue(settingsPropertyEntryWithContext spec, ConsoleKeyInfo keyInfo) { Int32 step = 1; Boolean forward = true; switch (currentOutput.consoleKey.Modifiers) { case ConsoleModifiers.Alt: step = 5; break; case ConsoleModifiers.Control: step = 10; break; case ConsoleModifiers.Shift: step = 25; break; } switch (currentOutput.consoleKey.Key) { case ConsoleKey.Backspace: break; case ConsoleKey.RightArrow: case ConsoleKey.OemPlus: forward = true; break; case ConsoleKey.LeftArrow: case ConsoleKey.OemMinus: forward = false; break; } changeValue(spec, forward, step); }
public override void resetContent() { base.resetContent(); setupFieldFormat("{0}", 15, 30); cursor.moveToCorner(textCursorZoneCorner.UpLeft); if (!String.IsNullOrEmpty(menu.menuTitle)) { // setStyle(textSectionLineStyleName.heading); writeField(menu.menuTitle, printHorizontal.middle); //setStyle(textSectionLineStyleName.content); if (!String.IsNullOrEmpty(menu.menuDescription)) { writeField(menu.menuDescription, printHorizontal.left); insertSplitLine(); } insertSplitLine(); } settingsPropertyEntryWithContext spec = null; var items = pageManager.getPageElements(menu); Int32 c = 0; foreach (aceMenuItem it in items) { var id = renderSelectBox(it, menu.isDisabled(it), menu.isSelected(it), menu.isDefault(it)).add(it.itemName); writeField(id, printHorizontal.left); spec = it.metaObject as settingsPropertyEntryWithContext; //it.metaObject a Object vl = spec.value; String valString = ""; var tname = spec.type.toStringTypeTitle(); valString = spec.value.toStringSafe(); //if (spec.pi.PropertyType.IsEnum) //{ // tname = "Enumeration"; // valString = vl.ToString(); //} else if (spec.pi.PropertyType.isCompatibileWith(typeof(ICollection))) //{ // tname = "Collection"; // ICollection icl = vl as ICollection; // valString = "[" + icl.Count.ToString() + "]"; //} else if (spec.pi.PropertyType.isCompatibileWith(typeof(INotifyPropertyChanged))) //{ // valString = "[object]"; //} else if (spec.pi.PropertyType.IsPrimitive) //{ // valString = vl.toStringSafe(); //} else if (spec.pi.PropertyType.isText()) //{ // valString = vl.toStringSafe(); //} else //{ // valString = "(..)"; //} if (String.IsNullOrEmpty(valString)) { valString = vl.toStringSafe(); } writeField(valString, printHorizontal.middle); writeField(tname, printHorizontal.right); c++; cursor.nextLine(); } cursor.nextLine(pageManager.pageCapacaty - c); insertSplitLine(); if (menu.selected != null) { spec = menu.selected.metaObject as settingsPropertyEntryWithContext; } if (spec != null) { //String sl = spec.description; writeLine(spec.displayName.add(spec.description, " : "), -1, false, 5); } insertSplitLine(); if (spec != null) { var extraLine = ""; if (spec.type.isBoolean()) { Boolean bvl = !spec.value.imbToBoolean(); extraLine += "[SPACE] Toggle to " + bvl.ToString() + " [+] True [-] False"; } else if (spec.type.IsEnum) { extraLine += "[+][-] Select value"; } else if (spec.type.isText()) { setAndWriteValueLine(spec.value as string); insertSplitLine(); extraLine += "[ENTER] Edit value"; } else if (spec.type.isNumber()) { setAndWriteValueLine(spec.value.ToString()); insertSplitLine(); extraLine += "[ENTER] Edit value [+][-] Change value | with [Alt] 5x | with [Ctrl] 10x"; } else { if (editorTarget is IList) { if (spec == null) { insertLine("[INS] New item"); } else if (spec.index == -1) { insertLine("[INS] New item"); } else { insertLine("[INS] New item | [ENTER] Edit | [DEL] Delete | [F5] Duplicate"); } } else { extraLine += "[ENTER] Open in editor"; } } if (extraLine.Length > 0) { insertLine(extraLine, -1, false, 2); } } else { if (editorTarget is IList) { insertLine("[INS] New item"); } } // insertLine("On leaving this screen changes will be saved.", -1, false); writeLine("[UP][DOWN] Select | [ESC] Done | [BACKSPACE] Revert values", -1, false); // insertLine("[UP][DOWN] Select | [INS] New item | [ESC] Done"); // insertLine("[F2] Load preset | [F5] Save preset | [F12] Reset to default", -1, false); cutSectionAtCursor(); // instructions = "Use letter key to select <ENTER> to confirm (" + menu.getSelectedKey() + ")"; }
public smartCollectionEditor(settingsPropertyEntryWithContext __target, int _height, int __width, int __leftRightMargin = 0, int __leftRightPadding = 0) : base(new aceMenu(), _height, __width, __leftRightMargin, __leftRightPadding) { target = __target; }