/// <summary> /// enter to specific object /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void enterObjectCanvas(object sender, MouseButtonEventArgs e) { Canvas c = (Canvas)sender; enterEditMode(c.Tag + ""); jsonModel jsonModelChoosen = listOfJsonModel.Find((j) => { return(j.GetHashCode() == int.Parse(c.Tag + "")); }); putInformationToEditScreen(jsonModelChoosen); showAddCanvas(); }
/// <summary> /// save a object to list /// </summary> private void saveObject() { jsonModel jsonObjTemp; if (editMode)//if we edit exits object { jsonObjTemp = listOfJsonModel.Find((j) => { return(j.GetHashCode() == int.Parse(hashCodeOfEditObject)); }); } else { jsonObjTemp = new jsonModel(); } foreach (var item in ListOfTextBoxAdd) { dynamic valueToAdd; FieldInfo fieldInfo = jsonObjTemp.GetType().GetField(item.Tag + ""); valueToAdd = parseSelect(fieldInfo.FieldType, item.Text); fieldInfo.SetValue(jsonObjTemp, valueToAdd); } if (!editMode) { listOfJsonModel.Add(jsonObjTemp); } }