mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-20 20:13:15 +08:00
AddressBook Contact
This commit is contained in:
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |
Binary file not shown.
|
After Width: | Height: | Size: 284 B |
@@ -15,43 +15,76 @@
|
||||
|
||||
<Script>
|
||||
<Workflow-ViewModel>
|
||||
module viewmodel;
|
||||
<![CDATA[
|
||||
module viewmodel;
|
||||
|
||||
using system::*;
|
||||
using system::*;
|
||||
|
||||
namespace demo
|
||||
{
|
||||
interface ICategory
|
||||
namespace demo
|
||||
{
|
||||
func GetParent() : ICategory*;
|
||||
prop Parent : ICategory* {GetParent}
|
||||
interface IContact
|
||||
{
|
||||
func GetName() : string;
|
||||
prop Name : string {GetName}
|
||||
|
||||
func GetBigImage() : presentation::GuiImageData^;
|
||||
prop BigImage : presentation::GuiImageData^ {GetBigImage}
|
||||
|
||||
func GetSmallImage() : presentation::GuiImageData^;
|
||||
prop SmallImage : presentation::GuiImageData^ {GetSmallImage}
|
||||
|
||||
func GetBirthday() : DateTime;
|
||||
prop Birthday : DateTime {GetBirthday}
|
||||
|
||||
func GetPhone() : string;
|
||||
prop Phone : string {GetPhone}
|
||||
|
||||
func GetAddress() : string;
|
||||
prop Address : string {GetAddress}
|
||||
|
||||
func Update(name : string, birthday : DateTime, phone : string, address : string) : void;
|
||||
}
|
||||
|
||||
interface ICategory
|
||||
{
|
||||
func GetParent() : ICategory*;
|
||||
prop Parent : ICategory* {GetParent}
|
||||
|
||||
func GetName() : string;
|
||||
prop Name : string {GetName}
|
||||
func GetName() : string;
|
||||
prop Name : string {GetName}
|
||||
|
||||
func GetImage() : presentation::GuiImageData^;
|
||||
prop Image : presentation::GuiImageData^ {GetImage}
|
||||
func GetImage() : presentation::GuiImageData^;
|
||||
prop Image : presentation::GuiImageData^ {GetImage}
|
||||
|
||||
func GetFolders() : ObservableList^;
|
||||
prop Folders : ObservableList^ {GetFolders}
|
||||
func GetFolders() : ObservableList^;
|
||||
prop Folders : ObservableList^ {GetFolders}
|
||||
|
||||
func GetContacts() : ObservableList^;
|
||||
prop Contacts : ObservableList^ {GetContacts}
|
||||
}
|
||||
func GetContacts() : ObservableList^;
|
||||
prop Contacts : ObservableList^ {GetContacts}
|
||||
}
|
||||
|
||||
interface IViewModel
|
||||
{
|
||||
func GetRootCategory() : ICategory^;
|
||||
interface IViewModel
|
||||
{
|
||||
func GetRootCategory() : ICategory^;
|
||||
|
||||
func GetSelectedCategory() : ICategory^;
|
||||
func SetSelectedCategory(value : ICategory^) : void;
|
||||
event SelectedCategoryChanged();
|
||||
prop SelectedCategory : ICategory^ {GetSelectedCategory, SetSelectedCategory : SelectedCategoryChanged}
|
||||
func GetSelectedCategory() : ICategory^;
|
||||
func SetSelectedCategory(value : ICategory^) : void;
|
||||
event SelectedCategoryChanged();
|
||||
prop SelectedCategory : ICategory^ {GetSelectedCategory, SetSelectedCategory : SelectedCategoryChanged}
|
||||
|
||||
func GetSelectedContact() : IContact^;
|
||||
func SetSelectedContact(value : IContact^) : void;
|
||||
event SelectedContactChanged();
|
||||
prop SelectedContact : IContact^ {GetSelectedContact, SetSelectedContact : SelectedContactChanged}
|
||||
|
||||
func AddCategory(name : string) : void;
|
||||
func RemoveCategory() : void;
|
||||
func AddCategory(name : string) : void;
|
||||
func RemoveCategory() : void;
|
||||
func CreateContact() : IContact^;
|
||||
func AddContact(contact : IContact^) : void;
|
||||
func RemoveContact() : void;
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</Workflow-ViewModel>
|
||||
</Script>
|
||||
|
||||
@@ -61,7 +94,8 @@
|
||||
<Image content="File" name="Delete">Delete.png</Image>
|
||||
|
||||
<Image content="File" name="Folder">Folder.png</Image>
|
||||
<Image content="File" name="Contact">Contact.png</Image>
|
||||
<Image content="File" name="ContactBig">ContactBig.png</Image>
|
||||
<Image content="File" name="ContactSmall">ContactSmall.png</Image>
|
||||
<Image content="File" name="Edit">Edit.png</Image>
|
||||
|
||||
<Image content="File" name="BigIcon">ListView_Big.png</Image>
|
||||
@@ -102,17 +136,36 @@
|
||||
</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandDeleteFolder" Image-uri="res://Images/Delete">
|
||||
<att.Enabled-bind>ViewModel.SelectedCategory is null ? false : ViewModel.SelectedCategory.Parent is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>{ ViewModel.RemoveCategory(); }</ev.Executed-eval>
|
||||
<att.Enabled-bind>ViewModel.SelectedCategory.Parent is not null ?? false</att.Enabled-bind>
|
||||
<ev.Executed-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
ViewModel.RemoveCategory();
|
||||
}
|
||||
]]>
|
||||
</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandNewContact" Image-uri="res://Images/NewContact">
|
||||
<ev.Executed>commandNewContact_Executed</ev.Executed>
|
||||
<att.Enabled-bind>ViewModel.SelectedCategory is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
}
|
||||
]]>
|
||||
</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandDeleteContact" Image-uri="res://Images/Delete">
|
||||
<ev.Executed>commandDeleteContact_Executed</ev.Executed>
|
||||
<att.Enabled-bind>ViewModel.SelectedContact is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
ViewModel.RemoveContact();
|
||||
}
|
||||
]]>
|
||||
</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
|
||||
<ToolstripCommand ref.Name="commandBigIcon" Image-uri="res://Images/BigIcon">
|
||||
<ToolstripCommand ref.Name="commandBigIcon" Image-uri="res://Images/BigIcon" Selected="true">
|
||||
<ev.Executed>commandBigIcon_Executed</ev.Executed>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandSmallIcon" Image-uri="res://Images/SmallIcon">
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace vl
|
||||
{
|
||||
#define _ ,
|
||||
IMPL_CPP_TYPE_INFO(demo::ICategory)
|
||||
IMPL_CPP_TYPE_INFO(demo::IContact)
|
||||
IMPL_CPP_TYPE_INFO(demo::IViewModel)
|
||||
IMPL_CPP_TYPE_INFO(demo::MainWindow)
|
||||
IMPL_CPP_TYPE_INFO(demo::NewFolderWindow)
|
||||
@@ -64,15 +65,39 @@ namespace vl
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Contacts, GetContacts)
|
||||
END_CLASS_MEMBER(demo::ICategory)
|
||||
|
||||
BEGIN_CLASS_MEMBER(demo::IContact)
|
||||
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
|
||||
CLASS_MEMBER_METHOD(GetName, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetBigImage, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetSmallImage, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetBirthday, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetPhone, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetAddress, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(Update, { L"name" _ L"birthday" _ L"phone" _ L"address" });
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Name, GetName)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(BigImage, GetBigImage)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(SmallImage, GetSmallImage)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Birthday, GetBirthday)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Phone, GetPhone)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Address, GetAddress)
|
||||
END_CLASS_MEMBER(demo::IContact)
|
||||
|
||||
BEGIN_CLASS_MEMBER(demo::IViewModel)
|
||||
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
|
||||
CLASS_MEMBER_METHOD(GetRootCategory, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetSelectedCategory, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(SetSelectedCategory, { L"value" });
|
||||
CLASS_MEMBER_EVENT(SelectedCategoryChanged)
|
||||
CLASS_MEMBER_METHOD(GetSelectedContact, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(SetSelectedContact, { L"value" });
|
||||
CLASS_MEMBER_EVENT(SelectedContactChanged)
|
||||
CLASS_MEMBER_METHOD(AddCategory, { L"name" });
|
||||
CLASS_MEMBER_METHOD(RemoveCategory, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(CreateContact, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(AddContact, { L"contact" });
|
||||
CLASS_MEMBER_METHOD(RemoveContact, NO_PARAMETER);
|
||||
CLASS_MEMBER_PROPERTY_EVENT(SelectedCategory, GetSelectedCategory, SetSelectedCategory, SelectedCategoryChanged)
|
||||
CLASS_MEMBER_PROPERTY_EVENT(SelectedContact, GetSelectedContact, SetSelectedContact, SelectedContactChanged)
|
||||
END_CLASS_MEMBER(demo::IViewModel)
|
||||
|
||||
BEGIN_CLASS_MEMBER(demo::MainWindow)
|
||||
@@ -80,11 +105,9 @@ namespace vl
|
||||
CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(Ptr<demo::IViewModel>), { L"ViewModel" })
|
||||
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandBigIcon_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandDeleteContact_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandDetail_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandInformation_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandList_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandNewContact_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandSmallIcon_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandTile_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
|
||||
@@ -109,6 +132,7 @@ namespace vl
|
||||
void Load(ITypeManager* manager)
|
||||
{
|
||||
ADD_TYPE_INFO(demo::ICategory)
|
||||
ADD_TYPE_INFO(demo::IContact)
|
||||
ADD_TYPE_INFO(demo::IViewModel)
|
||||
ADD_TYPE_INFO(demo::MainWindow)
|
||||
ADD_TYPE_INFO(demo::NewFolderWindow)
|
||||
|
||||
@@ -15,11 +15,24 @@ DO NOT MODIFY
|
||||
|
||||
namespace demo
|
||||
{
|
||||
class IContact;
|
||||
class ICategory;
|
||||
class IViewModel;
|
||||
class MainWindow;
|
||||
class NewFolderWindow;
|
||||
|
||||
class IContact : public virtual vl::reflection::IDescriptable, public vl::reflection::Description<IContact>
|
||||
{
|
||||
public:
|
||||
virtual vl::WString GetName() = 0;
|
||||
virtual vl::Ptr<vl::presentation::GuiImageData> GetBigImage() = 0;
|
||||
virtual vl::Ptr<vl::presentation::GuiImageData> GetSmallImage() = 0;
|
||||
virtual vl::DateTime GetBirthday() = 0;
|
||||
virtual vl::WString GetPhone() = 0;
|
||||
virtual vl::WString GetAddress() = 0;
|
||||
virtual void Update(vl::WString name, vl::DateTime birthday, vl::WString phone, vl::WString address) = 0;
|
||||
};
|
||||
|
||||
class ICategory : public virtual vl::reflection::IDescriptable, public vl::reflection::Description<ICategory>
|
||||
{
|
||||
public:
|
||||
@@ -37,8 +50,14 @@ namespace demo
|
||||
virtual vl::Ptr<demo::ICategory> GetSelectedCategory() = 0;
|
||||
virtual void SetSelectedCategory(vl::Ptr<demo::ICategory> value) = 0;
|
||||
vl::Event<void()> SelectedCategoryChanged;
|
||||
virtual vl::Ptr<demo::IContact> GetSelectedContact() = 0;
|
||||
virtual void SetSelectedContact(vl::Ptr<demo::IContact> value) = 0;
|
||||
vl::Event<void()> SelectedContactChanged;
|
||||
virtual void AddCategory(vl::WString name) = 0;
|
||||
virtual void RemoveCategory() = 0;
|
||||
virtual vl::Ptr<demo::IContact> CreateContact() = 0;
|
||||
virtual void AddContact(vl::Ptr<demo::IContact> contact) = 0;
|
||||
virtual void RemoveContact() = 0;
|
||||
};
|
||||
|
||||
template<typename TImpl>
|
||||
@@ -180,6 +199,7 @@ namespace vl
|
||||
namespace description
|
||||
{
|
||||
DECL_TYPE_INFO(demo::ICategory)
|
||||
DECL_TYPE_INFO(demo::IContact)
|
||||
DECL_TYPE_INFO(demo::IViewModel)
|
||||
DECL_TYPE_INFO(demo::MainWindow)
|
||||
DECL_TYPE_INFO(demo::NewFolderWindow)
|
||||
|
||||
@@ -16,10 +16,6 @@ namespace demo
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandDeleteContact_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandDetail_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
@@ -32,10 +28,6 @@ namespace demo
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandNewContact_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandSmallIcon_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,11 +21,9 @@ namespace demo
|
||||
|
||||
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
|
||||
void commandBigIcon_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandDeleteContact_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandDetail_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandInformation_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandList_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandNewContact_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandSmallIcon_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandTile_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void OnCreate();
|
||||
|
||||
Reference in New Issue
Block a user