diff --git a/src/MaaWpfGui/Main/Bootstrapper.cs b/src/MaaWpfGui/Main/Bootstrapper.cs index 63fef7897e..fc8264f884 100644 --- a/src/MaaWpfGui/Main/Bootstrapper.cs +++ b/src/MaaWpfGui/Main/Bootstrapper.cs @@ -39,33 +39,9 @@ namespace MaaWpfGui.Main public class Bootstrapper : Bootstrapper { private static SettingsViewModel _settingsViewModel; - private static TrayIcon _trayIconInSettingsViewModel; - - private static readonly FieldInfo _settingsViewModelIContainerFiled = - typeof(SettingsViewModel).GetField("_container", BindingFlags.NonPublic | BindingFlags.Instance); - + private static TrayIcon _trayIcon; private static ILogger _logger = Logger.None; - /// - /// Sets tray icon in . - /// - /// The instance. - /// - /// 应当只能是 在构造时调用这个函数。用反射拿 只是为了不额外修改 的定义, - /// 并顺便检查传入的 不为空(即不是随便 出来的一个 )。 - /// - internal static void SetTrayIconInSettingsViewModel(SettingsViewModel settingsViewModel) - { - _settingsViewModel = settingsViewModel; - var container = (IContainer)_settingsViewModelIContainerFiled.GetValue(settingsViewModel); - if (container != null) - { - _trayIconInSettingsViewModel = container.Get(); - } - - // TODO:出现不符合要求的settingsViewModel应当Log一下,等一个有缘人 - } - /// /// 初始化些啥自己加。 protected override void OnStart() @@ -164,10 +140,21 @@ namespace MaaWpfGui.Main /// protected override void DisplayRootView(object rootViewModel) { - var windowManager = (Helper.WindowManager)GetInstance(typeof(Helper.WindowManager)); + var windowManager = (IWindowManager)GetInstance(typeof(Helper.WindowManager)); windowManager.ShowWindow(rootViewModel); } + /// + protected override void OnLaunch() + { + var versionUpdateViewModel = (VersionUpdateViewModel)GetInstance(typeof(VersionUpdateViewModel)); + versionUpdateViewModel.ShowUpdateOrDownload(); + + // TrayIcon应该在显示rootViewModel之后再加载 + _trayIcon = (TrayIcon)GetInstance(typeof(TrayIcon)); + _settingsViewModel = (SettingsViewModel)GetInstance(typeof(SettingsViewModel)); + } + /// /// 退出时执行啥自己加。 protected override void OnExit(ExitEventArgs e) @@ -183,7 +170,7 @@ namespace MaaWpfGui.Main } // 注销任务栏图标 - _trayIconInSettingsViewModel.Close(); + _trayIcon.Close(); ConfigurationHelper.Release(); _logger.Information("MaaAssistantArknights GUI exited"); diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index c7ea5b0246..751f4f1267 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -356,10 +356,10 @@ - Identification tool + Identification Tool - Recruit tool + Recruit Tool Tip: This recognition is independent from main tab (Farming); need open up in game recruit tag selection screen then begin ~ Auto setting time Auto select 3 ★ Tags @@ -370,7 +370,7 @@ - Depot tool beta + Depot Tool This function is still a test version, please check if the recognition result is correct before using it. If there is an error, please submit the issue by compressing the debug/depot folder in the working path. Start to identify Export to Arkplanner diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index e2fcd81073..161eecb877 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -371,7 +371,7 @@ - 倉庫アイテム認識 beta + 倉庫アイテム認識 この機能はまだテスト版です。倉庫を開いた後、素材のタブを選択してから認識を行い、結果が正しいかどうか確認してください。エラーが発生した場合は、debug/depotフォルダを作業パスに圧縮して、issueを提出してください。 認識開始 Arkplannerへ出力 diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 6c1827ec2c..afce918c25 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -351,7 +351,7 @@ - 창고 정리 beta + 창고 정리 이 기능은 현재 테스트 중입니다. 인식 결과가 맞는지 확인 후에 사용해 주세요. 만약 오류가 있다면 debug/depot 폴더를 압축해서 이슈로 보내 주세요. 식별 시작 Arkplanner로 내보내기 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 4951b9b869..75ccc8dd51 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -373,7 +373,7 @@ - 仓库识别 beta + 仓库识别 该功能尚处于测试阶段,请检查结果是否准确再行使用。若有误,欢迎打包 debug/depot 文件夹后向我们提交 issue ~ 开始识别 导出至企鹅物流刷图规划 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 9d1c61205a..5254c2c097 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -305,7 +305,7 @@ - 倉庫識別 beta + 倉庫識別 該功能尚處於測試階段,請檢查結果是否準確再行使用。若有誤,歡迎打包 debug/depot 文件夾後向我們提交 issue ~ 開始識別 導出至企鵝物流刷圖規劃 diff --git a/src/MaaWpfGui/Res/Themes/Dark.xaml b/src/MaaWpfGui/Res/Themes/Dark.xaml index 05bb215bd1..73f9d85517 100644 --- a/src/MaaWpfGui/Res/Themes/Dark.xaml +++ b/src/MaaWpfGui/Res/Themes/Dark.xaml @@ -4,6 +4,7 @@ + diff --git a/src/MaaWpfGui/Res/Themes/Light.xaml b/src/MaaWpfGui/Res/Themes/Light.xaml index 1276b5fa7d..b6ac4bcdbc 100644 --- a/src/MaaWpfGui/Res/Themes/Light.xaml +++ b/src/MaaWpfGui/Res/Themes/Light.xaml @@ -4,7 +4,7 @@ - + diff --git a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs index eee2eba60e..868d9fdc4e 100644 --- a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs @@ -53,24 +53,6 @@ namespace MaaWpfGui.ViewModels.UI _asstProxy = _container.Get(); } - private int _displayId = 0; - - public int DisplayId - { - get => _displayId; - set => SetAndNotify(ref _displayId, value); - } - - public void ChangeButtenRecruit() - { - DisplayId = 0; - } - - public void ChangeButtenDepot() - { - DisplayId = 1; - } - #region Recruit private string _recruitInfo = LocalizationHelper.GetString("RecruitmentRecognitionTip"); diff --git a/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs index 4f7bb4a9b5..e01acf0620 100644 --- a/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs @@ -24,8 +24,6 @@ namespace MaaWpfGui.ViewModels.UI /// public class RootViewModel : Conductor.Collection.OneActive { - private readonly IWindowManager _windowManager; - private readonly AsstProxy _asstProxy; private readonly TaskQueueViewModel _taskQueueViewModel; private readonly RecognizerViewModel _recognizerViewModel; @@ -39,8 +37,6 @@ namespace MaaWpfGui.ViewModels.UI /// The IoC container. public RootViewModel(IContainer container) { - _windowManager = container.Get(); - _asstProxy = container.Get(); _taskQueueViewModel = container.Get(); _recognizerViewModel = container.Get(); @@ -55,7 +51,6 @@ namespace MaaWpfGui.ViewModels.UI CheckAndUpdateNow(); InitViewModels(); InitProxy(); - ShowUpdateOrDownload(); } private async void InitProxy() @@ -79,24 +74,6 @@ namespace MaaWpfGui.ViewModels.UI return _versionUpdateViewModel.CheckAndUpdateNow(); } - private async void ShowUpdateOrDownload() - { - if (_versionUpdateViewModel.IsFirstBootAfterUpdate) - { - _versionUpdateViewModel.IsFirstBootAfterUpdate = false; - _windowManager.ShowWindow(_versionUpdateViewModel); - } - else - { - var ret = await _versionUpdateViewModel.CheckAndDownloadUpdate(); - - if (ret == VersionUpdateViewModel.CheckUpdateRetT.OK) - { - _versionUpdateViewModel.AskToRestart(); - } - } - } - private string _windowTitle = "MAA"; /// @@ -111,9 +88,6 @@ namespace MaaWpfGui.ViewModels.UI protected override void OnInitialActivate() { base.OnInitialActivate(); - - // TrayIcon应该在显示rootViewModel之后再加载 - Bootstrapper.SetTrayIconInSettingsViewModel(_settingsViewModel); } /// diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index 3817b94c10..a8d5ba149c 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -43,6 +43,7 @@ namespace MaaWpfGui.ViewModels.UI /// public class VersionUpdateViewModel : Screen { + private readonly IWindowManager _windowManager; private readonly SettingsViewModel _settingsViewModel; private readonly TaskQueueViewModel _taskQueueViewModel; private readonly IHttpService _httpService; @@ -53,6 +54,7 @@ namespace MaaWpfGui.ViewModels.UI /// The IoC container. public VersionUpdateViewModel(IContainer container) { + _windowManager = container.Get(); _settingsViewModel = container.Get(); _taskQueueViewModel = container.Get(); _httpService = container.Get(); @@ -353,6 +355,26 @@ namespace MaaWpfGui.ViewModels.UI Native, } + /// + /// 如果是在更新后第一次启动,显示ReleaseNote弹窗,否则检查更新并下载更新包。 + /// + public async void ShowUpdateOrDownload() + { + if (IsFirstBootAfterUpdate) + { + IsFirstBootAfterUpdate = false; + _windowManager.ShowWindow(this); + } + else + { + var ret = await CheckAndDownloadUpdate(); + if (ret == CheckUpdateRetT.OK) + { + AskToRestart(); + } + } + } + /// /// 检查更新,并下载更新包。 /// diff --git a/src/MaaWpfGui/Views/UI/CopilotView.xaml b/src/MaaWpfGui/Views/UI/CopilotView.xaml index 9064592603..d4ce34a5f5 100644 --- a/src/MaaWpfGui/Views/UI/CopilotView.xaml +++ b/src/MaaWpfGui/Views/UI/CopilotView.xaml @@ -118,9 +118,10 @@ - @@ -138,7 +139,7 @@ - + - - -