增加保温层和整理管线的功能,修复自动保存功能等修复多个bug
This commit is contained in:
@@ -8,17 +8,16 @@ using System.Text;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
|
||||
using Sai.RvKits;
|
||||
|
||||
using Wpf.Ui.Controls;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Controls;
|
||||
using Wpf.Ui.Extend.Controls;
|
||||
|
||||
namespace WpfApp
|
||||
{
|
||||
partial class MainViewModel : ObservableValidator
|
||||
{
|
||||
partial class MainViewModel : ObservableValidator
|
||||
{
|
||||
private ISnackbarService snackbarService;
|
||||
private ControlAppearance snackbarAppearance = ControlAppearance.Danger;
|
||||
private int snackbarTimeout = 5;
|
||||
@@ -50,140 +49,139 @@ namespace WpfApp
|
||||
}
|
||||
|
||||
private ObservableCollection<string> animals =
|
||||
new()
|
||||
{
|
||||
"Cat",
|
||||
"Dog",
|
||||
"Bear",
|
||||
"Lion",
|
||||
"Mouse",
|
||||
"Horse",
|
||||
"Rat",
|
||||
"Elephant",
|
||||
"Kangaroo",
|
||||
"Lizard",
|
||||
"Snake",
|
||||
"Frog",
|
||||
"Fish",
|
||||
"Butterfly",
|
||||
"Human",
|
||||
"Cow",
|
||||
"Bumble Bee"
|
||||
};
|
||||
[
|
||||
"Cat",
|
||||
"Dog",
|
||||
"Bear",
|
||||
"Lion",
|
||||
"Mouse",
|
||||
"Horse",
|
||||
"Rat",
|
||||
"Elephant",
|
||||
"Kangaroo",
|
||||
"Lizard",
|
||||
"Snake",
|
||||
"Frog",
|
||||
"Fish",
|
||||
"Butterfly",
|
||||
"Human",
|
||||
"Cow",
|
||||
"Bumble Bee"
|
||||
];
|
||||
|
||||
public ObservableCollection<Grade> Grades { get; set; } = new();
|
||||
public ObservableCollection<Grade> Grades { get; set; } = [];
|
||||
|
||||
public ObservableCollection<Grade> SelectedItems { get; set; } = new();
|
||||
public ObservableCollection<Grade> SelectedItems { get; set; } = [];
|
||||
|
||||
public void GenerateTreeViewItem()
|
||||
{
|
||||
Grade item = new() { GradeLevel = "Grade1" };
|
||||
item.Students.Add(new() { Name = "St1" });
|
||||
item.Students.Add(new() { Name = "St2" });
|
||||
item.Students.Add(new() { Name = "St3" });
|
||||
Grade item1 = new() { GradeLevel = "Grade2" };
|
||||
item1.Students.Add(new() { Name = "StA" });
|
||||
item1.Students.Add(new() { Name = "StB" });
|
||||
Grades.Add(item);
|
||||
Grades.Add(item1);
|
||||
}
|
||||
public void GenerateTreeViewItem()
|
||||
{
|
||||
Grade item = new() { GradeLevel = "Grade1" };
|
||||
item.Students.Add(new() { Name = "St1" });
|
||||
item.Students.Add(new() { Name = "St2" });
|
||||
item.Students.Add(new() { Name = "St3" });
|
||||
Grade item1 = new() { GradeLevel = "Grade2" };
|
||||
item1.Students.Add(new() { Name = "StA" });
|
||||
item1.Students.Add(new() { Name = "StB" });
|
||||
Grades.Add(item);
|
||||
Grades.Add(item1);
|
||||
}
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
[MinLength(1)]
|
||||
[Range(10,1000,ErrorMessage ="请输入大于10,小于1000的值")]
|
||||
[Required(ErrorMessage ="必填")]
|
||||
[Range(10, 1000, ErrorMessage = "请输入大于10,小于1000的值")]
|
||||
[Required(ErrorMessage = "必填")]
|
||||
private string number;
|
||||
|
||||
public ObservableCollection<string> Animals
|
||||
{
|
||||
get { return animals; }
|
||||
}
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
GenerateTreeViewItem();
|
||||
public ObservableCollection<string> Animals
|
||||
{
|
||||
get { return animals; }
|
||||
}
|
||||
|
||||
public List<MultiTreeViewItem> Items = new();
|
||||
public MainViewModel()
|
||||
{
|
||||
GenerateTreeViewItem();
|
||||
}
|
||||
|
||||
private string _selectedAnimal = "Cat";
|
||||
public string SelectedAnimal
|
||||
{
|
||||
get { return _selectedAnimal; }
|
||||
set
|
||||
{
|
||||
_selectedAnimal = value;
|
||||
OnPropertyChanged("SelectedAnimal");
|
||||
}
|
||||
}
|
||||
public List<MultiTreeViewItem> Items = [];
|
||||
|
||||
private ObservableCollection<string> _selectedAnimals;
|
||||
public ObservableCollection<string> SelectedAnimals
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_selectedAnimals == null)
|
||||
{
|
||||
_selectedAnimals = new ObservableCollection<string> { "Dog", "Lion", "Lizard" };
|
||||
SelectedAnimalsText = WriteSelectedAnimalsString(_selectedAnimals);
|
||||
_selectedAnimals.CollectionChanged += (s, e) =>
|
||||
{
|
||||
SelectedAnimalsText = WriteSelectedAnimalsString(_selectedAnimals);
|
||||
OnPropertyChanged("SelectedAnimals");
|
||||
};
|
||||
}
|
||||
return _selectedAnimals;
|
||||
}
|
||||
set { _selectedAnimals = value; }
|
||||
}
|
||||
private string _selectedAnimal = "Cat";
|
||||
public string SelectedAnimal
|
||||
{
|
||||
get { return _selectedAnimal; }
|
||||
set
|
||||
{
|
||||
_selectedAnimal = value;
|
||||
OnPropertyChanged("SelectedAnimal");
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedAnimalsText
|
||||
{
|
||||
get { return _selectedAnimalsText; }
|
||||
set
|
||||
{
|
||||
_selectedAnimalsText = value;
|
||||
OnPropertyChanged("SelectedAnimalsText");
|
||||
}
|
||||
}
|
||||
string _selectedAnimalsText;
|
||||
private ObservableCollection<string> _selectedAnimals;
|
||||
public ObservableCollection<string> SelectedAnimals
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_selectedAnimals == null)
|
||||
{
|
||||
_selectedAnimals = ["Dog", "Lion", "Lizard"];
|
||||
SelectedAnimalsText = WriteSelectedAnimalsString(_selectedAnimals);
|
||||
_selectedAnimals.CollectionChanged += (s, e) =>
|
||||
{
|
||||
SelectedAnimalsText = WriteSelectedAnimalsString(_selectedAnimals);
|
||||
OnPropertyChanged("SelectedAnimals");
|
||||
};
|
||||
}
|
||||
return _selectedAnimals;
|
||||
}
|
||||
set { _selectedAnimals = value; }
|
||||
}
|
||||
|
||||
private static string WriteSelectedAnimalsString(IList<string> list)
|
||||
{
|
||||
if (list.Count == 0)
|
||||
return String.Empty;
|
||||
public string SelectedAnimalsText
|
||||
{
|
||||
get { return _selectedAnimalsText; }
|
||||
set
|
||||
{
|
||||
_selectedAnimalsText = value;
|
||||
OnPropertyChanged("SelectedAnimalsText");
|
||||
}
|
||||
}
|
||||
string _selectedAnimalsText;
|
||||
|
||||
var builder = new StringBuilder(list[0]);
|
||||
private static string WriteSelectedAnimalsString(IList<string> list)
|
||||
{
|
||||
if (list.Count == 0)
|
||||
return string.Empty;
|
||||
|
||||
for (var i = 1; i < list.Count; i++)
|
||||
{
|
||||
builder.Append(", ");
|
||||
builder.Append(list[i]);
|
||||
}
|
||||
var builder = new StringBuilder(list[0]);
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
for (var i = 1; i < list.Count; i++)
|
||||
{
|
||||
builder.Append(", ");
|
||||
builder.Append(list[i]);
|
||||
}
|
||||
|
||||
[RelayCommand()]
|
||||
private void ShowDialog()
|
||||
{
|
||||
MessageExtensions.ShowMessage();
|
||||
}
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
class Grade
|
||||
{
|
||||
public string GradeLevel { get; set; }
|
||||
[RelayCommand()]
|
||||
private void ShowDialog()
|
||||
{
|
||||
MessageExtensions.ShowMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Student> Students { get; set; } = new List<Student>();
|
||||
}
|
||||
class Grade
|
||||
{
|
||||
public string GradeLevel { get; set; }
|
||||
|
||||
class Student
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Class { get; set; }
|
||||
}
|
||||
public List<Student> Students { get; set; } = [];
|
||||
}
|
||||
|
||||
class Student
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Class { get; set; }
|
||||
}
|
||||
//class CustomerValidator : AbstractValidator<Student>
|
||||
//{
|
||||
// public CustomerValidator()
|
||||
|
||||
Reference in New Issue
Block a user