diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index d75b43a..8bc67f9 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -238,6 +238,44 @@ namespace VPet_Simulator.Windows public void LoadDIY() { Main.ToolBar.MenuDIY.Items.Clear(); + + if (App.MutiSaves.Count > 0) + { + var list = App.MutiSaves.ToList(); + foreach (var win in App.MainWindows) + { + list.Remove(win.PrefixSave); + } + list.Remove(PrefixSave); + if (list.Count > 0) + { + var menuItem = new System.Windows.Controls.MenuItem() + { + Header = "桌宠多开".Translate(), + HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center, + }; + foreach (var win in list) + { + var mo = new System.Windows.Controls.MenuItem() + { + Header = win.Translate(), + HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center, + }; + mo.Click += (s, e) => + { + if (App.MainWindows.FirstOrDefault(x => x.PrefixSave.Trim('-') == win) == null) + { + new MainWindow(win).Show(); + } + menuItem.Items.Remove(s); + }; + menuItem.Items.Add(mo); + } + Main.ToolBar.MenuDIY.Items.Add(menuItem); + } + + } + foreach (Sub sub in Set["diy"]) Main.ToolBar.AddMenuButton(ToolBar.MenuType.DIY, sub.Name, () => { @@ -1048,7 +1086,7 @@ namespace VPet_Simulator.Windows { Topmost = true; } - + //不存在就关掉 var modpath = new DirectoryInfo(ModPath + @"\0000_core\pet\vup"); if (!modpath.Exists) diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 19db9ba..2d4f7da 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -766,35 +766,6 @@ namespace VPet_Simulator.Windows winSetting.Show(); }); - //if (PrefixSave == "" && App.MutiSaves.Count > 1) - //{ - // var menuItem = new System.Windows.Controls.MenuItem() - // { - // Header = "多开", - // HorizontalContentAlignment = HorizontalAlignment.Center - // }; - // menuItem.Click += delegate - // { - // clickCallback?.Invoke(); - // }; - // if (str.EndsWith(")") || App.MainWindows.FirstOrDefault(x => x.PrefixSave.Trim('-') == str) != null) - // { - // MessageBoxX.Show("当前多开已经加载,请先关闭改多开后重试".Translate()); - // return; - // } - // if (!App.MutiSaves.Contains(str)) - // { - // LoadMutiUI(); - // return; - // } - // if (MessageBoxX.Show("是否删除当前选择({0})的多开存档?".Translate(str), "删除前确认".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.Yes) - // { - // File.Delete(ExtensionValue.BaseDirectory + @$"\Setting-{str}.lps"); - // App.MutiSaves.Remove(str); - // LoadMutiUI(); - // } - //} - //this.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Res/TopLogo2019.PNG"))); //Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Feed, "喂食测试", () =>