diff --git a/Tutorial/GacUI_Controls/AddressBook/Main.cpp b/Tutorial/GacUI_Controls/AddressBook/Main.cpp index e0ccbb72..58eed535 100644 --- a/Tutorial/GacUI_Controls/AddressBook/Main.cpp +++ b/Tutorial/GacUI_Controls/AddressBook/Main.cpp @@ -15,11 +15,13 @@ Ptr folderImage; Ptr contactBigImage; Ptr contactSmallImage; +class Contact; class ViewModel; class Category : public Object, public ICategory { friend class ViewModel; + friend class Contact; protected: ICategory* parent; WString name; @@ -125,6 +127,12 @@ public: birthday = _birthday; phone = _phone; address = _address; + + vint index = category->contacts.IndexOf(this); + if (index != -1) + { + category->contacts.NotifyUpdate(index, 1); + } } }; diff --git a/Tutorial/GacUI_Controls/AddressBook/UI/Resource.xml b/Tutorial/GacUI_Controls/AddressBook/UI/Resource.xml index 93010f60..d23e91ec 100644 --- a/Tutorial/GacUI_Controls/AddressBook/UI/Resource.xml +++ b/Tutorial/GacUI_Controls/AddressBook/UI/Resource.xml @@ -168,6 +168,19 @@ ]]> + + ViewModel.SelectedContact is not null + + + + ViewModel.SelectedContact is not null @@ -262,6 +275,7 @@ + @@ -350,9 +364,10 @@ + - + diff --git a/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp index 0ca1b686..d35b8d07 100644 --- a/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp @@ -150,6 +150,8 @@ namespace vl CLASS_MEMBER_CONSTRUCTOR(demo::NewContactWindow*(Ptr), { L"Contact" }) CLASS_MEMBER_PROPERTY_READONLY_FAST(Contact) + CLASS_MEMBER_EVENT(ForEditChanged) + CLASS_MEMBER_PROPERTY_EVENT_FAST(ForEdit, ForEditChanged) CLASS_MEMBER_EVENT(ReadyChanged) CLASS_MEMBER_PROPERTY_EVENT_FAST(Ready, ReadyChanged) END_CLASS_MEMBER(demo::NewContactWindow) diff --git a/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.h index 4147b1e9..ff8a469a 100644 --- a/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.h +++ b/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.h @@ -73,6 +73,7 @@ namespace demo vl::presentation::controls::GuiToolstripCommand* commandDeleteContact; vl::presentation::controls::GuiToolstripCommand* commandDeleteFolder; vl::presentation::controls::GuiToolstripCommand* commandDetail; + vl::presentation::controls::GuiToolstripCommand* commandEditContact; vl::presentation::controls::GuiToolstripCommand* commandInformation; vl::presentation::controls::GuiToolstripCommand* commandList; vl::presentation::controls::GuiToolstripCommand* commandNewContact; @@ -92,6 +93,7 @@ namespace demo GUI_INSTANCE_REFERENCE(commandDeleteContact); GUI_INSTANCE_REFERENCE(commandDeleteFolder); GUI_INSTANCE_REFERENCE(commandDetail); + GUI_INSTANCE_REFERENCE(commandEditContact); GUI_INSTANCE_REFERENCE(commandInformation); GUI_INSTANCE_REFERENCE(commandList); GUI_INSTANCE_REFERENCE(commandNewContact); @@ -115,6 +117,7 @@ namespace demo ,commandDeleteContact(0) ,commandDeleteFolder(0) ,commandDetail(0) + ,commandEditContact(0) ,commandInformation(0) ,commandList(0) ,commandNewContact(0) @@ -139,6 +142,7 @@ namespace demo friend struct vl::reflection::description::CustomTypeDescriptorSelector; private: Ptr Contact_; + bool ForEdit_; bool Ready_; protected: vl::presentation::controls::GuiDatePicker* datePickerBirthday; @@ -173,6 +177,7 @@ namespace demo ,textBoxName(0) ,textBoxPhone(0) { + this->ForEdit_ = vl::reflection::description::UnboxValue(vl::reflection::description::Value::From(L"false", reflection::description::GetTypeDescriptor())); this->Ready_ = vl::reflection::description::UnboxValue(vl::reflection::description::Value::From(L"true", reflection::description::GetTypeDescriptor())); } @@ -181,6 +186,19 @@ namespace demo return Contact_; } + vl::Event ForEditChanged; + + bool GetForEdit() + { + return ForEdit_; + } + + void SetForEdit(bool value) + { + ForEdit_ = value; + ForEditChanged(); + } + vl::Event ReadyChanged; bool GetReady() diff --git a/Tutorial/GacUI_Controls/UIRes/AddressBook.bin b/Tutorial/GacUI_Controls/UIRes/AddressBook.bin index fcf6d245..8f690e40 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/AddressBook.bin and b/Tutorial/GacUI_Controls/UIRes/AddressBook.bin differ