浏览代码

WinRT: Add illustration for not downloading

Lou Yihua 7 年之前
父节点
当前提交
588c94eee8

+ 6 - 6
winrt/SDLPal.Common/MainPage.xaml.cpp

@@ -204,20 +204,20 @@ void SDLPal::MainPage::CheckResourceFolder()
 		concurrency::create_task(msgbox->ShowAsync()).then([this](IUICommand^ command)->IAsyncOperation<IUICommand^>^ {
 			if (command->Id == nullptr)
 			{
-				return concurrency::create_async([]()->IUICommand^ { return nullptr; });
+				return (ref new MessageDialog(m_resLdr->GetString("MBFolderManually")))->ShowAsync();
 			}
 
 			auto msgbox = ref new MessageDialog(m_resLdr->GetString("MBDownloadOption"), m_resLdr->GetString("MBDownloadTitle"));
 			msgbox->Commands->Append(ref new UICommand(m_resLdr->GetString("MBButtonFromURL"), nullptr, 1));
-			msgbox->Commands->Append(ref new UICommand(m_resLdr->GetString("MBButtonFromBaiyou"), nullptr, nullptr));
+			msgbox->Commands->Append(ref new UICommand(m_resLdr->GetString("MBButtonFromBaiyou"), nullptr, -1));
 			msgbox->DefaultCommandIndex = 0;
 			msgbox->CancelCommandIndex = 1;
 			return msgbox->ShowAsync();
 		}).then([this](IUICommand^ command)->IAsyncOperation<IUICommand^>^ {
-			if (command && !command->Id)
+			if (command && command->Id && (int)command->Id == -1)
 			{
 				auto msgbox = ref new MessageDialog(m_resLdr->GetString("MBDownloadMessage"), m_resLdr->GetString("MBDownloadTitle"));
-				msgbox->Commands->Append(ref new UICommand(m_resLdr->GetString("MBButtonOK")));
+				msgbox->Commands->Append(ref new UICommand(m_resLdr->GetString("MBButtonOK"), nullptr, -1));
 				return msgbox->ShowAsync();
 			}
 			else
@@ -225,7 +225,7 @@ void SDLPal::MainPage::CheckResourceFolder()
 				return concurrency::create_async([command]()->IUICommand^ { return command; });
 			}
 		}).then([this](IUICommand^ command) {
-			if (!command)
+			if (!command || !command->Id)
 			{
 				ClearResourceFolder();
 				return;
@@ -236,7 +236,7 @@ void SDLPal::MainPage::CheckResourceFolder()
 			{
 				auto file = AWait(folder->CreateFileAsync("pal98.zip", CreationCollisionOption::ReplaceExisting), g_eventHandle);
 				auto stream = AWait(file->OpenAsync(FileAccessMode::ReadWrite), g_eventHandle);
-				bool from_url = (command->Id != nullptr);
+				bool from_url = ((int)command->Id == 1);
 				concurrency::create_task(this->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, folder, file, stream, from_url]() {
 					m_dlg = ref new DownloadDialog(m_resLdr, folder, stream, ActualWidth, ActualHeight, from_url);
 				}))).then([this]()->IAsyncOperation<ContentDialogResult>^ {

+ 3 - 0
winrt/SDLPal.Common/Strings/en/Resources.resw

@@ -362,4 +362,7 @@ Please choose the correct folder or download game resource from the offical webs
   <data name="URL.Header" xml:space="preserve">
     <value>URL of the game resource's Zip archive</value>
   </data>
+  <data name="MBFolderManually" xml:space="preserve">
+    <value>Please put game resource files into the folder before you select it.</value>
+  </data>
 </root>

+ 3 - 0
winrt/SDLPal.Common/Strings/zh-hans/Resources.resw

@@ -361,4 +361,7 @@
   <data name="URL.Header" xml:space="preserve">
     <value>游戏资源 Zip 压缩包地址</value>
   </data>
+  <data name="MBFolderManually" xml:space="preserve">
+    <value>请先将游戏资源文件放入后再选取该文件夹!</value>
+  </data>
 </root>

+ 3 - 0
winrt/SDLPal.Common/Strings/zh-hant/Resources.resw

@@ -361,4 +361,7 @@
   <data name="URL.Header" xml:space="preserve">
     <value>遊戲資源 Zip 壓縮包地址</value>
   </data>
+  <data name="MBFolderManually" xml:space="preserve">
+    <value>請先將遊戲資源檔放入後再選取該資料夾!</value>
+  </data>
 </root>