static void ParseValues(XElement el, out int?address, out string unit, out TableType?tableType) { address = null; unit = null; tableType = null; XAttribute attr = el.Attribute(X_address); if (attr != null) { address = ParseHexInt((string)attr, attr); } attr = el.Attribute(X_tableType); if (attr != null) { TableType parsedType; if (TableTypes.TryParse((string)attr, out parsedType)) { tableType = parsedType; } } unit = (string)el.Attribute(X_unit); }
protected void HandleCellRendererComboEdited(object o, EditedArgs args) { TreeIter iter; if (!treeModel.GetIter(out iter, new TreePath(args.Path))) { return; } TableType ttNew; if (!TableTypes.TryParse(args.NewText, out ttNew)) { return; } int colNr = CursorColNr; // so far there's only ComboBox for TableType column var ttOld = (TableType)treeModel.GetValue(iter, colNr); if (ttOld != ttNew) { treeModel.SetValue(iter, colNr, (int)ttNew); OnTableTypeChanged(iter, ttNew); // follow it in case this column is being sorted ScrollTo(iter); } }
// FALSE if the row matches, TRUE otherwise !!! protected static bool EqualFuncTableType(string key, TableType content) { TableType parsed; if (TableTypes.TryParse(key, out parsed)) { return(parsed != content); } else { return(true); } }