00001 00002 using System; 00003 using Foodolini.Activities; 00004 using Foodolini.BusinessLogic; 00005 using Gtk; 00006 00007 namespace Foodolini.Activities.Person 00008 { 00009 [System.ComponentModel.ToolboxItem(true)] 00010 public partial class PersonEditorDialog : Gtk.Dialog 00011 { 00012 private Foodolini.BusinessLogic.Person currentUser; 00013 00014 public PersonEditorDialog() 00015 { 00016 this.Build(); 00017 00018 } 00019 00023 public void SetDetails(Foodolini.BusinessLogic.Person currentUser){ 00024 00025 this.currentUser = currentUser; 00026 lbUserProfile.Markup = "<b><big>" + currentUser.FullName + "</big></b>"; 00027 entry1FullName.Text = currentUser.FullName; 00028 entry2UserName.Text = currentUser.UserName; 00029 calendarDateOfBirth.Date = currentUser.BirthDate; 00030 spWeight.Value = currentUser.Weight; 00031 spHeight.Value = currentUser.Height; 00032 comboboxGender.Active = (int)currentUser.Gender; 00033 00034 } 00035 00036 00040 00041 protected virtual void ValidateEntries (object sender, System.EventArgs e){ 00042 00043 if(entry1FullName.Text != "" | entry2UserName.Text != "" | spHeight.Value != 0 | spWeight.Value != 0 ){ 00044 btOk.Sensitive = true; 00045 } 00046 else{ 00047 btCancel.Sensitive = false; 00048 } 00049 } 00050 00051 protected virtual void btOkOnClicked (object sender, System.EventArgs e) 00052 { 00053 00054 currentUser.FullName = entry1FullName.Text; 00055 currentUser.UserName = entry2UserName.Text; 00056 currentUser.BirthDate = calendarDateOfBirth.Date; 00057 currentUser.Gender = (Gender)comboboxGender.Active; 00058 currentUser.Height = spHeight.Value; 00059 currentUser.Weight = spWeight.Value; 00060 currentUser.Save(); 00061 00062 } 00063 00064 protected virtual void CancelOnClick (object sender, System.EventArgs e) 00065 { 00066 } 00067 } 00068 }