Skip to content

Commit

Permalink
Fix wrong new contact window size bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vczh committed Oct 29, 2017
1 parent 3dcdd0c commit b2af850
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 39 deletions.
6 changes: 4 additions & 2 deletions Tools/GacGen.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ Write-Host "Compiling GacUI Resource: $FileName ..."
Start-Process-And-Wait (,("$PSScriptRoot\GacGen32.exe", "/P $FileName"))
Start-Process-And-Wait (,("$PSScriptRoot\GacGen64.exe", "/P $FileName"))

if (Test-Path -Path "$($FileName).log\x32\Error.txt") {
if (Test-Path -Path "$($FileName).log\x32\Errors.txt") {
Write-Host (Get-Content "$($FileName).log\x32\Errors.txt") -ForegroundColor Red -Separator "`r`n"
throw "Failed to compile GacUI Resource (x86): $FileName"
}
if (Test-Path -Path "$($FileName).log\x64\Error.txt") {
if (Test-Path -Path "$($FileName).log\x64\Errors.txt") {
Write-Host (Get-Content "$($FileName).log\x64\Errors.txt") -ForegroundColor Red -Separator "`r`n"
throw "Failed to compile GacUI Resource (x64): $FileName"
}

Expand Down
27 changes: 19 additions & 8 deletions Tutorial/GacUI_Controls/AddressBook/UI/Resource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@
<![CDATA[
$Async{
var contact = ViewModel.CreateContact();
var window = new demo::NewContactWindow*(contact);
var window = new demo::NewContactWindow*();
window.MoveToScreenCenter();
window.SetContact(contact);
$Await window.ShowModalAsync(self);
if (window.Ready)
Expand All @@ -154,9 +155,10 @@
<ev.Executed-eval>
<![CDATA[
$Async{
var window = new demo::NewContactWindow*(ViewModel.SelectedContact);
var window = new demo::NewContactWindow*();
window.ForEdit = true;
window.MoveToScreenCenter();
window.SetContact(ViewModel.SelectedContact);
$Await window.ShowModalAsync(self);
delete window;
}
Expand Down Expand Up @@ -352,12 +354,21 @@

<Instance name="NewContactWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::NewContactWindow">
<ref.Parameter Name="Contact" Class="demo::IContact"/>
<ref.Members>
<![CDATA[
prop ForEdit : bool = false {}
var Ready : bool = false;
var contact : IContact^ = null;
func SetContact(value : IContact^): void
{
contact = value;
textBoxName.Text = contact.Name;
textBoxPhone.Text = contact.Phone;
textBoxAddress.Text = contact.Address;
datePickerBirthday.Date = contact.Birthday;
}
]]>
</ref.Members>
<Window ref.Name="self" Text-bind="self.ForEdit ? 'Edit Contact' : 'New Contact'" ClientSize="x:480 y:400" MaximizedBox="false" MinimizedBox="false" SizeBox="false">
Expand All @@ -382,7 +393,7 @@
<Label Text="Name:"/>
</Cell>
<Cell Site="row:0 column:1 columnSpan:3">
<DocumentTextBox ref.Name="textBoxName" EditMode="Editable" Text-eval="Contact.Name">
<DocumentTextBox ref.Name="textBoxName" EditMode="Editable">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</DocumentTextBox>
</Cell>
Expand All @@ -391,7 +402,7 @@
<Label Text="Phone:"/>
</Cell>
<Cell Site="row:1 column:1 columnSpan:3">
<DocumentTextBox ref.Name="textBoxPhone" EditMode="Editable" Text-eval="Contact.Phone">
<DocumentTextBox ref.Name="textBoxPhone" EditMode="Editable">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</DocumentTextBox>
</Cell>
Expand All @@ -400,7 +411,7 @@
<Label Text="Address:"/>
</Cell>
<Cell Site="row:2 column:1 columnSpan:3">
<DocumentTextBox ref.Name="textBoxAddress" EditMode="Editable" Text-eval="Contact.Address">
<DocumentTextBox ref.Name="textBoxAddress" EditMode="Editable">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</DocumentTextBox>
</Cell>
Expand All @@ -409,7 +420,7 @@
<Label Text="Birthday:"/>
</Cell>
<Cell Site="row:3 column:1 columnSpan:3">
<DatePicker ref.Name="datePickerBirthday" Date-eval="Contact.Birthday">
<DatePicker ref.Name="datePickerBirthday">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 bottom:0"/>
</DatePicker>
</Cell>
Expand All @@ -420,7 +431,7 @@
<ev.Clicked-eval>
<![CDATA[
{
Contact.Update(textBoxName.Text, datePickerBirthday.Date, textBoxPhone.Text, textBoxAddress.Text);
self.contact.Update(textBoxName.Text, datePickerBirthday.Date, textBoxPhone.Text, textBoxAddress.Text);
self.Ready = true;
self.Close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Closures

void __vwsnf32_Demo_demo_NewContactWindowConstructor___vwsn_initialize_instance__::operator()(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs* arguments) const
{
::vl::__vwsn::This(__vwsnthis_0->Contact.Obj())->Update(::vl::__vwsn::This(__vwsnthis_0->textBoxName)->GetText(), ::vl::__vwsn::This(__vwsnthis_0->datePickerBirthday)->GetDate(), ::vl::__vwsn::This(__vwsnthis_0->textBoxPhone)->GetText(), ::vl::__vwsn::This(__vwsnthis_0->textBoxAddress)->GetText());
::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->contact.Obj())->Update(::vl::__vwsn::This(__vwsnthis_0->textBoxName)->GetText(), ::vl::__vwsn::This(__vwsnthis_0->datePickerBirthday)->GetDate(), ::vl::__vwsn::This(__vwsnthis_0->textBoxPhone)->GetText(), ::vl::__vwsn::This(__vwsnthis_0->textBoxAddress)->GetText());
(::vl::__vwsn::This(__vwsnthis_0->self)->Ready = true);
::vl::__vwsn::This(__vwsnthis_0->self)->Close();
}
Expand Down Expand Up @@ -1110,8 +1110,9 @@ Closures
if ((__vwsn_co_state_ == static_cast<::vl::vint>(0)))
{
(__vwsn_co0_contact = ::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->CreateContact());
(__vwsn_co1_window = new ::demo::NewContactWindow(__vwsn_co0_contact));
(__vwsn_co1_window = new ::demo::NewContactWindow());
::vl::__vwsn::This(__vwsn_co1_window)->MoveToScreenCenter();
::vl::__vwsn::This(__vwsn_co1_window)->SetContact(__vwsn_co0_contact);
(__vwsn_co_state_ = static_cast<::vl::vint>(2));
continue;
}
Expand Down Expand Up @@ -1259,9 +1260,10 @@ Closures
{
if ((__vwsn_co_state_ == static_cast<::vl::vint>(0)))
{
(__vwsn_co0_window = new ::demo::NewContactWindow(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetSelectedContact()));
(__vwsn_co0_window = new ::demo::NewContactWindow());
::vl::__vwsn::This(__vwsn_co0_window)->SetForEdit(true);
::vl::__vwsn::This(__vwsn_co0_window)->MoveToScreenCenter();
::vl::__vwsn::This(__vwsn_co0_window)->SetContact(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetSelectedContact());
(__vwsn_co_state_ = static_cast<::vl::vint>(2));
continue;
}
Expand Down Expand Up @@ -2000,7 +2002,6 @@ Class (::demo::NewContactWindowConstructor)
void NewContactWindowConstructor::__vwsn_initialize_instance_(::demo::NewContactWindow* __vwsn_this_)
{
(this->self = __vwsn_this_);
(this->Contact = ::vl::__vwsn::This(__vwsn_this_)->GetContact());
{
::vl::__vwsn::This(this->self)->SetSizeBox(::vl::__vwsn::Parse<bool>(::vl::WString(L"false", false)));
}
Expand Down Expand Up @@ -2239,18 +2240,6 @@ Class (::demo::NewContactWindowConstructor)
{
::vl::__vwsn::This(::vl::__vwsn::This(this->self)->GetContainerComposition())->AddChild(static_cast<::vl::presentation::compositions::GuiGraphicsComposition*>(this->__vwsn_precompile_0));
}
{
::vl::__vwsn::This(this->textBoxName)->SetText(::vl::__vwsn::This(this->Contact.Obj())->GetName());
}
{
::vl::__vwsn::This(this->textBoxPhone)->SetText(::vl::__vwsn::This(this->Contact.Obj())->GetPhone());
}
{
::vl::__vwsn::This(this->textBoxAddress)->SetText(::vl::__vwsn::This(this->Contact.Obj())->GetAddress());
}
{
::vl::__vwsn::This(this->datePickerBirthday)->SetDate(::vl::__vwsn::This(this->Contact.Obj())->GetBirthday());
}
{
auto __vwsn_event_handler_ = LAMBDA(::vl_workflow_global::__vwsnf32_Demo_demo_NewContactWindowConstructor___vwsn_initialize_instance__(this));
::vl::__vwsn::EventAttach(::vl::__vwsn::This(this->__vwsn_precompile_18)->Clicked, __vwsn_event_handler_);
Expand Down Expand Up @@ -2287,15 +2276,18 @@ Class (::demo::NewContactWindow)
}
}

::vl::Ptr<::demo::IContact> NewContactWindow::GetContact()
void NewContactWindow::SetContact(::vl::Ptr<::demo::IContact> value)
{
return this->__vwsn_parameter_Contact;
(this->contact = value);
::vl::__vwsn::This(this->textBoxName)->SetText(::vl::__vwsn::This(this->contact.Obj())->GetName());
::vl::__vwsn::This(this->textBoxPhone)->SetText(::vl::__vwsn::This(this->contact.Obj())->GetPhone());
::vl::__vwsn::This(this->textBoxAddress)->SetText(::vl::__vwsn::This(this->contact.Obj())->GetAddress());
::vl::__vwsn::This(this->datePickerBirthday)->SetDate(::vl::__vwsn::This(this->contact.Obj())->GetBirthday());
}

NewContactWindow::NewContactWindow(::vl::Ptr<::demo::IContact> __vwsn_ctor_parameter_Contact)
NewContactWindow::NewContactWindow()
: ::vl::presentation::controls::GuiWindow(::vl::presentation::theme::ThemeName::Window)
{
(this->__vwsn_parameter_Contact = __vwsn_ctor_parameter_Contact);
auto __vwsn_resource_ = ::vl::__vwsn::This(::vl::presentation::GetResourceManager())->GetResourceFromClassName(::vl::WString(L"demo::NewContactWindow", false));
auto __vwsn_resolver_ = ::vl::Ptr<::vl::presentation::GuiResourcePathResolver>(new ::vl::presentation::GuiResourcePathResolver(__vwsn_resource_, ::vl::__vwsn::This(__vwsn_resource_.Obj())->GetWorkingDirectory()));
::vl::__vwsn::This(this)->SetResourceResolver(__vwsn_resolver_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ namespace demo
protected:
::demo::NewContactWindow* self = static_cast<::demo::NewContactWindow*>(nullptr);
::vl::presentation::controls::GuiDocumentLabel* textBoxName = static_cast<::vl::presentation::controls::GuiDocumentLabel*>(nullptr);
::vl::Ptr<::demo::IContact> Contact = ::vl::Ptr<::demo::IContact>();
::vl::presentation::controls::GuiDocumentLabel* textBoxPhone = static_cast<::vl::presentation::controls::GuiDocumentLabel*>(nullptr);
::vl::presentation::controls::GuiDocumentLabel* textBoxAddress = static_cast<::vl::presentation::controls::GuiDocumentLabel*>(nullptr);
::vl::presentation::controls::GuiDatePicker* datePickerBirthday = static_cast<::vl::presentation::controls::GuiDatePicker*>(nullptr);
Expand Down Expand Up @@ -258,9 +257,9 @@ namespace demo
void SetForEdit(bool __vwsn_value_);
::vl::Event<void()> ForEditChanged;
bool Ready = false;
::vl::Ptr<::demo::IContact> __vwsn_parameter_Contact = ::vl::Ptr<::demo::IContact>();
::vl::Ptr<::demo::IContact> GetContact();
NewContactWindow(::vl::Ptr<::demo::IContact> __vwsn_ctor_parameter_Contact);
::vl::Ptr<::demo::IContact> contact = ::vl::Ptr<::demo::IContact>();
void SetContact(::vl::Ptr<::demo::IContact> value);
NewContactWindow();
~NewContactWindow();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,15 @@ namespace vl
END_CLASS_MEMBER(::demo::MainWindowConstructor)

BEGIN_CLASS_MEMBER(::demo::NewContactWindow)
CLASS_MEMBER_CONSTRUCTOR(::demo::NewContactWindow*(::vl::Ptr<::demo::IContact>), { L"__vwsn_ctor_parameter_Contact" })
CLASS_MEMBER_METHOD(GetContact, NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(::demo::NewContactWindow*(), NO_PARAMETER)
CLASS_MEMBER_METHOD(GetForEdit, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetContact, { L"value" })
CLASS_MEMBER_METHOD(SetForEdit, { L"__vwsn_value_" })
CLASS_MEMBER_EVENT(ForEditChanged)
CLASS_MEMBER_FIELD(__vwsn_parameter_Contact)
CLASS_MEMBER_FIELD(__vwsn_prop_ForEdit)
CLASS_MEMBER_PROPERTY_READONLY(Contact, GetContact)
CLASS_MEMBER_PROPERTY_EVENT(ForEdit, GetForEdit, SetForEdit, ForEditChanged)
CLASS_MEMBER_FIELD(Ready)
CLASS_MEMBER_FIELD(contact)
END_CLASS_MEMBER(::demo::NewContactWindow)

BEGIN_CLASS_MEMBER(::demo::NewContactWindowConstructor)
Expand Down Expand Up @@ -198,7 +197,6 @@ namespace vl
CLASS_MEMBER_FIELD(__vwsn_precompile_7)
CLASS_MEMBER_FIELD(__vwsn_precompile_8)
CLASS_MEMBER_FIELD(__vwsn_precompile_9)
CLASS_MEMBER_FIELD(Contact)
CLASS_MEMBER_FIELD(datePickerBirthday)
CLASS_MEMBER_FIELD(self)
CLASS_MEMBER_FIELD(textBoxAddress)
Expand Down

0 comments on commit b2af850

Please sign in to comment.