From 7feebbc78f4884baa5df15f41c61d561eec7edf7 Mon Sep 17 00:00:00 2001 From: sakuraxp Date: Sat, 28 May 2022 00:32:50 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=80=9A=E8=BF=87=E5=A4=8D=E5=88=B6=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E6=96=87=E4=BB=B6=E7=9A=84=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E8=A7=84=E9=81=BF=E4=BA=86=E8=87=AA=E5=8A=A8=E6=88=98=E6=96=97?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=96=87=E4=BB=B6=E4=B8=8D=E8=83=BD=E7=94=A8?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E8=B7=AF=E5=BE=84=E6=88=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=9A=84bug=E3=80=82=202.=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=A0=8F=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E5=99=A8=E5=92=8CIP=E7=AB=AF=E5=8F=A3=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAsstGui/ViewModels/CopilotViewModel.cs | 4 +++- src/MeoAsstGui/ViewModels/RootViewModel.cs | 7 +++++++ src/MeoAsstGui/ViewModels/SettingsViewModel.cs | 15 +++++++++++++++ src/MeoAsstGui/Views/RootView.xaml | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/MeoAsstGui/ViewModels/CopilotViewModel.cs b/src/MeoAsstGui/ViewModels/CopilotViewModel.cs index df0159ddf9..53cd66bd3d 100644 --- a/src/MeoAsstGui/ViewModels/CopilotViewModel.cs +++ b/src/MeoAsstGui/ViewModels/CopilotViewModel.cs @@ -133,7 +133,9 @@ namespace MeoAsstGui return; } - asstProxy.AsstStartCopilot(data["stage_name"].ToString(), Filename, Form); + const string _newfilename = "resource/_temp_copilot.json"; + File.WriteAllText(_newfilename, data.ToString()); + asstProxy.AsstStartCopilot(data["stage_name"].ToString(), _newfilename, Form); Idle = false; AddLog("Star Burst Stream!"); } diff --git a/src/MeoAsstGui/ViewModels/RootViewModel.cs b/src/MeoAsstGui/ViewModels/RootViewModel.cs index f087096616..579b932390 100644 --- a/src/MeoAsstGui/ViewModels/RootViewModel.cs +++ b/src/MeoAsstGui/ViewModels/RootViewModel.cs @@ -58,6 +58,7 @@ namespace MeoAsstGui //Items.Add(ivm); Items.Add(cvm); Items.Add(svm); + svm.UpdateWindowTitle(); // 在标题栏上显示模拟器和IP端口 必须在 Items.Add(svm)之后执行。 ActiveItem = tvm; } @@ -88,5 +89,11 @@ namespace MeoAsstGui await task; } } + private string _windowTitle; + public string WindowTitle + { + get => _windowTitle; + set => SetAndNotify(ref _windowTitle, value); + } } } diff --git a/src/MeoAsstGui/ViewModels/SettingsViewModel.cs b/src/MeoAsstGui/ViewModels/SettingsViewModel.cs index 173a84b876..5dee7ee666 100644 --- a/src/MeoAsstGui/ViewModels/SettingsViewModel.cs +++ b/src/MeoAsstGui/ViewModels/SettingsViewModel.cs @@ -812,6 +812,7 @@ namespace MeoAsstGui { SetAndNotify(ref _connectAddress, value); ViewStatusStorage.Set("Connect.Address", value); + UpdateWindowTitle(); /* 姣忔淇敼杩炴帴鍦板潃鏃舵洿鏂癢IndowTitle */ } } @@ -930,6 +931,20 @@ namespace MeoAsstGui } } + /* 鏍囬鏍忔樉绀烘ā鎷熷櫒鍚嶇О鍜孖P绔彛 */ + public void UpdateWindowTitle() + { + var rvm = (RootViewModel)this.Parent; + string ConnectConfigName = ""; + foreach (CombData data in ConnectConfigList) + { + if (data.Value == ConnectConfig) + { + ConnectConfigName = data.Display; + } + } + rvm.WindowTitle = string.Format("MaaAssistantArknights - {0} ({1})", ConnectConfigName, ConnectAddress); + } //public void TryToSetBlueStacksHyperVAddress() //{ // if (AdbPath.Length == 0 || !File.Exists(AdbPath)) diff --git a/src/MeoAsstGui/Views/RootView.xaml b/src/MeoAsstGui/Views/RootView.xaml index 4e8798f2ab..5b4eaa2ab9 100644 --- a/src/MeoAsstGui/Views/RootView.xaml +++ b/src/MeoAsstGui/Views/RootView.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:s="https://github.com/canton7/Stylet" mc:Ignorable="d" - Title="MaaAssistantArknights" Height="595" Width="800"> + Title="{Binding WindowTitle}" Height="595" Width="800">