// in order to react to more than one zone edit mode at once // use + as OR public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || parameter == null) { return(false); } ZoneEditType zet = ZoneEditType.NO_EDIT; if (value is ZoneEditType) { zet = (ZoneEditType)value; } string str_param = parameter.ToString(); string[] str_params_OR = str_param.Split(new char[] { '+' }); if (str_params_OR.Count() < 2) { return(zet == ZoneEditModeManager.GetEditModeType(str_param)); } else { foreach (string p in str_params_OR) { if (zet == ZoneEditModeManager.GetEditModeType(p)) { return(true); } } return(false); } }
public ZoneEditType SetEditMode(string _str_zet) { if (_str_zet == null) { return(ZoneEditType.NO_EDIT); } ZoneEditType zet = GetEditModeType(_str_zet); return(SetEditMode(zet)); }
public ZoneEditType SetEditMode(ZoneEditType _zet) { int ind_mode = (int)_zet; if (ind_mode == 0) { this.setModes = Enumerable.Repeat(false, NR_EDIT_MODES).ToList(); return(ZoneEditType.NO_EDIT); } bool mode_New = !(this.setModes[ind_mode]); this.setModes = Enumerable.Repeat(false, NR_EDIT_MODES).ToList(); this.setModes[ind_mode] = mode_New; if (mode_New) { return((ZoneEditType)ind_mode); } else { return(ZoneEditType.NO_EDIT); } }