mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-03-24 08:54:21 +08:00
AddressBook EditContact
This commit is contained in:
@@ -15,11 +15,13 @@ Ptr<GuiImageData> folderImage;
|
||||
Ptr<GuiImageData> contactBigImage;
|
||||
Ptr<GuiImageData> 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -168,6 +168,19 @@
|
||||
]]>
|
||||
</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandEditContact" Image-uri="res://Images/Edit">
|
||||
<att.Enabled-bind>ViewModel.SelectedContact is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
var window = new demo::NewContactWindow*(ViewModel.SelectedContact);
|
||||
window.ForEdit = true;
|
||||
window.MoveToScreenCenter();
|
||||
window.ShowModalAndDelete(self, func():void{});
|
||||
}
|
||||
]]>
|
||||
</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandDeleteContact" Image-uri="res://Images/Delete">
|
||||
<att.Enabled-bind>ViewModel.SelectedContact is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>
|
||||
@@ -262,6 +275,7 @@
|
||||
<ToolstripToolBar>
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
<ToolstripButton Command-ref="commandNewContact"/>
|
||||
<ToolstripButton Command-ref="commandEditContact"/>
|
||||
<ToolstripButton Command-ref="commandDeleteContact"/>
|
||||
<ToolstripSplitter/>
|
||||
<ToolstripButton Command-ref="commandBigIcon"/>
|
||||
@@ -350,9 +364,10 @@
|
||||
|
||||
<Instance name="NewContactWindowResource">
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::NewContactWindow">
|
||||
<ref.Property Name="ForEdit" Type="bool" Value="false"/>
|
||||
<ref.Property Name="Ready" Type="bool" Value="true"/>
|
||||
<ref.Parameter Name="Contact" Class="demo::IContact"/>
|
||||
<Window ref.Name="self" Text="New Contact" ClientSize="x:480 y:360" MaximizedBox="false" MinimizedBox="false" SizeBox="false">
|
||||
<Window ref.Name="self" Text-bind="self.ForEdit ? 'Edit Contact' : 'New Contact'" ClientSize="x:480 y:360" MaximizedBox="false" MinimizedBox="false" SizeBox="false">
|
||||
|
||||
<Table CellPadding="5" AlignmentToParent="left:0 top:0 right:0 bottom:0">
|
||||
<att.Rows>
|
||||
|
||||
@@ -150,6 +150,8 @@ namespace vl
|
||||
CLASS_MEMBER_CONSTRUCTOR(demo::NewContactWindow*(Ptr<demo::IContact>), { 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)
|
||||
|
||||
@@ -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<TImpl>;
|
||||
private:
|
||||
Ptr<demo::IContact> 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<bool>(vl::reflection::description::Value::From(L"false", reflection::description::GetTypeDescriptor<bool>()));
|
||||
this->Ready_ = vl::reflection::description::UnboxValue<bool>(vl::reflection::description::Value::From(L"true", reflection::description::GetTypeDescriptor<bool>()));
|
||||
}
|
||||
|
||||
@@ -181,6 +186,19 @@ namespace demo
|
||||
return Contact_;
|
||||
}
|
||||
|
||||
vl::Event<void()> ForEditChanged;
|
||||
|
||||
bool GetForEdit()
|
||||
{
|
||||
return ForEdit_;
|
||||
}
|
||||
|
||||
void SetForEdit(bool value)
|
||||
{
|
||||
ForEdit_ = value;
|
||||
ForEditChanged();
|
||||
}
|
||||
|
||||
vl::Event<void()> ReadyChanged;
|
||||
|
||||
bool GetReady()
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user