public void DeleteFormula(Formula f) { formulaDatabase.Delete (f.ID); if (ui != null) { ui.UpdateFormulaList (GetFormulasSorted ()); } }
public void SaveFormula(Formula f) { formulaDatabase.Save (f); if (ui != null) { ui.UpdateFormulaList (GetFormulasSorted ()); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.FormulaDetails); Globals.Logic = new AppLogic (null, Globals.Logic); // Get our edittext views nameText = (EditText)FindViewById (Resource.Id.formulaName); expressionText = (EditText)FindViewById (Resource.Id.formulaExpression); FindViewById (Resource.Id.saveButton).Click += delegate { OnSave (); }; FindViewById (Resource.Id.cancelButton).Click += delegate { OnCancel (); }; int formulaID = Intent.GetIntExtra ("formulaID", DatabaseConstants.ID_UNASSIGNED); if (formulaID != DatabaseConstants.ID_UNASSIGNED) { // we are editing an existing formula formula = Globals.Logic.GetFormula (formulaID); nameText.Text = formula.Name; expressionText.Text = formula.Expression; } else { // we are creating a new formula formula = new Formula(); } string formulaExpression = Intent.GetStringExtra("formulaExpression"); if (formulaExpression != null) { expressionText.Text = formulaExpression; } }
public void UseFormula(Formula f) { if (ui != null) { ui.InsertFormulaText ("[" + f.Name + "]"); } f.Uses++; formulaDatabase.Save (f); // don't update the ui because it would be confusing to have formulas move around as you use them. }