Example #1
0
        void onAddButtonClicked()
        {
            var      dialog = new ExerciseDialog("Add exercise", this);
            Exercise ex     = dialog.getResult();

            if (ex != null)
            {
                exerciseService.Add(ex);
                store.AppendValues(ex.Distance, ex.Minutes, ex.Id);
            }
        }
Example #2
0
        void onEditButtonClicked()
        {
            TreeIter  iter;
            TreeModel model;

            if (treeView.Selection.GetSelected(out model, out iter))
            {
                int      selected_Id = (int)store.GetValue(iter, (int)Column.Id);
                Exercise ex          = exerciseService.Get(selected_Id);
                var      dialog      = new ExerciseDialog("Edit exercise", this, ex);
                ex = dialog.getResult();
                exerciseService.Update(ex);

                store.SetValue(iter, (int)Column.Distance, ex.Distance);
                store.SetValue(iter, (int)Column.Minutes, ex.Minutes);
                store.SetValue(iter, (int)Column.Id, ex.Id);
            }
        }