diff --git a/RustTools/RustTools.csproj b/RustTools/RustTools.csproj
index 85cb98b..5dea719 100644
--- a/RustTools/RustTools.csproj
+++ b/RustTools/RustTools.csproj
@@ -7,6 +7,8 @@
x64
x86;x64;arm64
true
+
+
true
win10-x86;win10-x64;win10-arm64
enable
diff --git a/RustTools/Views/CodeTablePage.xaml b/RustTools/Views/CodeTablePage.xaml
index 2506809..541ef43 100644
--- a/RustTools/Views/CodeTablePage.xaml
+++ b/RustTools/Views/CodeTablePage.xaml
@@ -22,9 +22,26 @@
+ TextChanged="search_TextChanged"
+ TextMemberPath="key">
+
+
+
+
+
+
+
+
+
+
diff --git a/RustTools/Views/CodeTablePage.xaml.cs b/RustTools/Views/CodeTablePage.xaml.cs
index c50d97e..60172b3 100644
--- a/RustTools/Views/CodeTablePage.xaml.cs
+++ b/RustTools/Views/CodeTablePage.xaml.cs
@@ -9,6 +9,7 @@ using System.Runtime.InteropServices.WindowsRuntime;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Xml.Linq;
+using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
@@ -21,7 +22,11 @@ using Newtonsoft.Json.Linq;
using RustTools.DataList;
using RustTools.muqing;
using RustTools.ViewModels;
+using Windows.ApplicationModel.Core;
+using Windows.System;
+using Windows.UI.Core;
using static System.Collections.Specialized.BitVector32;
+using static IniHelper;
using static RustTools.DataList.DataBaseManifest;
// To learn more about WinUI, the WinUI project structure,
@@ -33,7 +38,7 @@ namespace RustTools.Views;
///
public sealed partial class CodeTablePage : Page
{
- public ObservableCollection? codeList = new();
+ public ObservableCollection codeList = new();
public CodeTableViewModel ViewModel { get; set; }
public List section = new();
public CodeTablePage()
@@ -93,9 +98,9 @@ public sealed partial class CodeTablePage : Page
//var textBlock = new TextBlock();
//textBlock.IsTextSelectionEnabled
+
+ // ע KeyDown ¼
}
-
-
private void keyListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
@@ -128,8 +133,9 @@ public sealed partial class CodeTablePage : Page
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
- codeList?.Clear();
- codeList = null;
+ codeList.Clear();
+ //section.Clear();
+ //valueList.Clear();
}
@@ -154,24 +160,31 @@ public sealed partial class CodeTablePage : Page
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
{
- var str = args.SelectedItem.ToString();
- search.Text = str;
- if (str == null) { return; }
- var a=str.Split(' ');
- List itemsSource = new();
-
- foreach (var item in valueList)
- {
- if (item.code.Contains(a[0]) || item.translate.Contains(a[1]))
- {
- itemsSource.Add(item);
- gj.sc(item.code);
- }
- }
- gj.sc(itemsSource.Count);
- valueListView.ItemsSource=itemsSource;
+ //gj.sc("AutoSuggestBox_SuggestionChosen "+sender);
+ //if (args.SelectedItem is not Search_List str) { return; }
+ //search.Text = str.key;
+ //List itemsSource = new();
+ //foreach (var item in valueList)
+ //{
+ // if (item.code.Contains(str.key) || item.translate.Contains(str.value))
+ // {
+ // itemsSource.Add(item);
+ // }
+ //}
+ //valueListView.ItemsSource=itemsSource;
//valueListView.ItemsSource=search.ItemsSource;
}
+ class Search_List
+ {
+ public string key
+ {
+ get; set;
+ }
+ public string value
+ {
+ get; set;
+ }
+ }
private List valueList = new ();
private void search_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
@@ -184,27 +197,57 @@ public sealed partial class CodeTablePage : Page
// only listen to changes caused by user entering text.
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
{
- var suitableItems = new List();
- var splitText = sender.Text.ToLower().Split(" ");
+ var suitableItems = new List();
+ var splitText = sender.Text.ToString();
if (valueListView.ItemsSource is not List itemsSource) { return; }
+ var i = 0;
foreach (var cat in itemsSource)
{
- var found = splitText.All((key) =>
+ if (cat.code.Contains(splitText) || cat.translate.Contains(splitText))
{
- if (string.IsNullOrEmpty(key)) { return false; }
- return cat.code.Contains(key)||cat.translate.Contains(key);
- });
- if (found)
- {
- suitableItems.Add(cat.code+" "+cat.translate);
+ suitableItems.Add(new Search_List
+ {
+ key=cat.code,value=cat.translate
+ });
+ }
+ //ʾ
+ if (++i > 30)
+ {
+ break;
}
- }
- if (suitableItems.Count == 0)
- {
- suitableItems.Add("No results found");
}
sender.ItemsSource = suitableItems;
}
}
+
+ private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
+ {
+ List itemsSource = new();
+ foreach (var item in valueList)
+ {
+ if (item.code.Contains(sender.Text) || item.translate.Contains(sender.Text))
+ {
+ itemsSource.Add(item);
+ }
+ }
+ valueListView.ItemsSource = itemsSource;
+ }
+
+ private void searchBox_KeyDown(object sender, KeyRoutedEventArgs e)
+ {
+
+ // Ƿ Ctrl
+ var isCtrlPressed = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control) == CoreVirtualKeyStates.Down;
+
+ // Ƿ J
+ if (e.Key == VirtualKey.J && isCtrlPressed)
+ {
+ // ִе Ctrl+J ʱIJ
+ var a = search.ItemsSource as List;
+ search.ItemsSource = null;
+ search.ItemsSource = a;
+ //Debug.WriteLine("Ctrl+J pressed "+ a?.Count);
+ }
+ }
}
diff --git a/RustTools/Views/HomePage.xaml.cs b/RustTools/Views/HomePage.xaml.cs
index 1f2a683..f52b853 100644
--- a/RustTools/Views/HomePage.xaml.cs
+++ b/RustTools/Views/HomePage.xaml.cs
@@ -31,7 +31,7 @@ public sealed partial class HomePage : Page
ListA.ItemClick += ListAClick;
ListB.ItemClick += ListAClick;
//Ϊ˽ʡԵʱЩ
- if (false)
+ if (true)
{
ViewModel.random();
ViewModel.Latest();
diff --git a/RustTools/Views/ModulePage.xaml.cs b/RustTools/Views/ModulePage.xaml.cs
index 298240c..bf679d8 100644
--- a/RustTools/Views/ModulePage.xaml.cs
+++ b/RustTools/Views/ModulePage.xaml.cs
@@ -142,12 +142,14 @@ public sealed partial class ModulePage : Page
///
private async void Button_Click_RwmodItem(object sender, RoutedEventArgs e)
{
- ContentDialog dialog = new ContentDialog();
- dialog.XamlRoot = XamlRoot;
- dialog.Title = "提示";
- dialog.PrimaryButtonText = "确定";
- dialog.SecondaryButtonText = "取消";
- dialog.Content = CreateCheckboxContent();
+ ContentDialog dialog = new ContentDialog
+ {
+ XamlRoot = XamlRoot,
+ Title = "提示",
+ PrimaryButtonText = "确定",
+ SecondaryButtonText = "取消",
+ Content = CreateCheckboxContent()
+ };
var contentDialogResult = await dialog.ShowAsync();
if (contentDialogResult == ContentDialogResult.Primary)
{
@@ -159,21 +161,23 @@ public sealed partial class ModulePage : Page
if (container != null && container.DataContext is DataObject dataItem)
{
var checkbox = (dialog.Content as StackPanel)?.Children[1] as CheckBox;
- if (checkbox.IsChecked == true)
- {
- File.Delete(dataItem.Dri);
- ViewModel.ListMod.Remove(dataItem);
- }
+
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(dataItem.Dri);
var GetDirectoryName = Path.GetDirectoryName(dataItem.Dri);
if (Directory.Exists(GetDirectoryName) && fileNameWithoutExtension != null)
{
var targetDirectory = Path.Combine(GetDirectoryName, fileNameWithoutExtension);
var v = wj.UnzipFile(dataItem.Dri, targetDirectory);
- gj.sc(v);
+ gj.sc("解压成功:"+v);
+ if (checkbox?.IsChecked == true)
+ {
+ File.Delete(dataItem.Dri);
+ ViewModel.ListMod.Remove(dataItem);
+ }
if (v)
{
- ViewModel.ListMod.Add(new DataObject(new DirectoryInfo(targetDirectory)));
+ ViewModel.ListMod.Remove(new DataObject(new DirectoryInfo(targetDirectory)));
+ ViewModel.ListMod.Insert(0,new DataObject(new DirectoryInfo(targetDirectory)));
}
}
}