Fix tutorial bug

This commit is contained in:
vczh
2021-10-12 12:53:13 -07:00
parent 8c7f4bcd16
commit 5cb8145e7a
18 changed files with 410 additions and 166 deletions
@@ -173,6 +173,7 @@ namespace demo
if ((__vwsn_switch_0 == static_cast<::vl::vint>(0)))
{
::vl::__vwsn::This(this->self)->SaveAsPrivateFormat(::vl::__vwsn::This(this->dialogSaveDoc)->GetFileName());
::vl::__vwsn::This(this->document)->NotifyModificationSaved();
}
else if ((__vwsn_switch_0 == static_cast<::vl::vint>(1)))
{
@@ -186,6 +187,40 @@ namespace demo
}
}
bool DocumentEditorBase::CancelWindowClose()
{
if (::vl::__vwsn::This(this->document)->GetModified())
{
{
auto __vwsn_switch_1 = ::vl::__vwsn::This(this->dialogQueryClose)->ShowDialog();
if ((__vwsn_switch_1 == ::vl::presentation::INativeDialogService::MessageBoxButtonsOutput::SelectYes))
{
if (::vl::__vwsn::This(this->dialogSaveDocPrivate)->ShowDialog())
{
::vl::__vwsn::This(this->self)->SaveAsPrivateFormat(::vl::__vwsn::This(this->dialogSaveDocPrivate)->GetFileName());
return false;
}
else
{
return true;
}
}
else if ((__vwsn_switch_1 == ::vl::presentation::INativeDialogService::MessageBoxButtonsOutput::SelectNo))
{
return false;
}
else
{
return true;
}
}
}
else
{
return false;
}
}
DocumentEditorBase::DocumentEditorBase()
: ::vl::presentation::controls::GuiCustomControl(::vl::presentation::theme::ThemeName::CustomControl)
, __vwsn_prop_EditModeCommand(static_cast<::vl::presentation::controls::GuiToolstripCommand*>(nullptr))
@@ -152,6 +152,7 @@ namespace demo
private:
void SaveDocument();
public:
bool CancelWindowClose();
DocumentEditorBase();
void __vwsn_instance_ctor_();
~DocumentEditorBase();
@@ -2956,6 +2956,32 @@ namespace demo
{
::vl::__vwsn::This(this->self)->AddComponent(static_cast<::vl::presentation::controls::GuiComponent*>(this->dialogSaveDoc));
}
(this->dialogSaveDocPrivate = new ::vl::presentation::controls::GuiSaveFileDialog());
{
::vl::__vwsn::This(this->dialogSaveDocPrivate)->SetOptions(::vl::presentation::INativeDialogService::FileDialogOptions::FileDialogPromptOverwriteFile);
}
{
::vl::__vwsn::This(this->dialogSaveDocPrivate)->SetFilter(::vl::WString(L"Private Format (*.bin)|*.bin", false));
}
{
::vl::__vwsn::This(this->dialogSaveDocPrivate)->SetTitle(::vl::WString(L"Save a GacUI Document", false));
}
{
::vl::__vwsn::This(this->self)->AddComponent(static_cast<::vl::presentation::controls::GuiComponent*>(this->dialogSaveDocPrivate));
}
(this->dialogQueryClose = new ::vl::presentation::controls::GuiMessageDialog());
{
::vl::__vwsn::This(this->dialogQueryClose)->SetIcon(::vl::presentation::INativeDialogService::MessageBoxIcons::IconQuestion);
}
{
::vl::__vwsn::This(this->dialogQueryClose)->SetInput(::vl::presentation::INativeDialogService::MessageBoxButtonsInput::DisplayYesNoCancel);
}
{
::vl::__vwsn::This(this->dialogQueryClose)->SetText(::vl::WString(L"The document has been changed since the last time it was saved as a Private Format file. Do you want to save this file?", false));
}
{
::vl::__vwsn::This(this->self)->AddComponent(static_cast<::vl::presentation::controls::GuiComponent*>(this->dialogQueryClose));
}
(this->__vwsn_precompile_0 = new ::vl::presentation::compositions::GuiTableComposition());
{
::vl::__vwsn::This(this->__vwsn_precompile_0)->SetAlignmentToParent([&](){ ::vl::presentation::Margin __vwsn_temp__; __vwsn_temp__.left = static_cast<::vl::vint>(0); __vwsn_temp__.top = static_cast<::vl::vint>(0); __vwsn_temp__.right = static_cast<::vl::vint>(0); __vwsn_temp__.bottom = static_cast<::vl::vint>(0); return __vwsn_temp__; }());
@@ -3255,6 +3281,9 @@ namespace demo
::vl::__vwsn::EventAttach(::vl::__vwsn::This(__vwsn_created_subscription_.Obj())->ValueChanged, LAMBDA(::vl_workflow_global::__vwsnf3_EditorBase_demo_DocumentEditorBaseConstructor___vwsn_demo_DocumentEditorBase_Initialize_(this)));
::vl::__vwsn::This(__vwsn_this_)->AddSubscription(__vwsn_created_subscription_);
}
{
::vl::__vwsn::This(this->dialogQueryClose)->SetTitle(::vl::__vwsn::This(this->self)->GetText());
}
{
auto __vwsn_event_handler_ = LAMBDA(::vl_workflow_global::__vwsnf4_EditorBase_demo_DocumentEditorBaseConstructor___vwsn_demo_DocumentEditorBase_Initialize_(this));
::vl::__vwsn::EventAttach(::vl::__vwsn::This(this->document)->ActiveHyperlinkExecuted, __vwsn_event_handler_);
@@ -3658,6 +3687,8 @@ namespace demo
, dialogOpen(static_cast<::vl::presentation::controls::GuiOpenFileDialog*>(nullptr))
, dialogOpenDoc(static_cast<::vl::presentation::controls::GuiOpenFileDialog*>(nullptr))
, dialogSaveDoc(static_cast<::vl::presentation::controls::GuiSaveFileDialog*>(nullptr))
, dialogSaveDocPrivate(static_cast<::vl::presentation::controls::GuiSaveFileDialog*>(nullptr))
, dialogQueryClose(static_cast<::vl::presentation::controls::GuiMessageDialog*>(nullptr))
, menuContainer(static_cast<::vl::presentation::compositions::GuiCellComposition*>(nullptr))
, toolstripContainer(static_cast<::vl::presentation::compositions::GuiCellComposition*>(nullptr))
, document(static_cast<::vl::presentation::controls::GuiDocumentViewer*>(nullptr))
@@ -226,6 +226,8 @@ namespace demo
::vl::presentation::controls::GuiOpenFileDialog* dialogOpen;
::vl::presentation::controls::GuiOpenFileDialog* dialogOpenDoc;
::vl::presentation::controls::GuiSaveFileDialog* dialogSaveDoc;
::vl::presentation::controls::GuiSaveFileDialog* dialogSaveDocPrivate;
::vl::presentation::controls::GuiMessageDialog* dialogQueryClose;
::vl::presentation::compositions::GuiCellComposition* menuContainer;
::vl::presentation::compositions::GuiCellComposition* toolstripContainer;
::vl::presentation::controls::GuiDocumentViewer* document;
@@ -43,6 +43,7 @@ namespace vl
CLASS_MEMBER_BASE(::demo::DocumentEditorBaseConstructor)
CLASS_MEMBER_CONSTRUCTOR(::demo::DocumentEditorBase*(), NO_PARAMETER)
CLASS_MEMBER_METHOD(__vwsn_instance_ctor_, NO_PARAMETER)
CLASS_MEMBER_METHOD(CancelWindowClose, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetEditModeCommand, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetHasEditableSelection, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetHasEditableSelectionInSingleParagraph, NO_PARAMETER)
@@ -115,7 +116,9 @@ namespace vl
CLASS_MEMBER_FIELD(dialogNotImpl)
CLASS_MEMBER_FIELD(dialogOpen)
CLASS_MEMBER_FIELD(dialogOpenDoc)
CLASS_MEMBER_FIELD(dialogQueryClose)
CLASS_MEMBER_FIELD(dialogSaveDoc)
CLASS_MEMBER_FIELD(dialogSaveDocPrivate)
CLASS_MEMBER_FIELD(document)
CLASS_MEMBER_FIELD(menuContainer)
CLASS_MEMBER_FIELD(self)