增加保温层和整理管线的功能,修复自动保存功能等修复多个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()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="MainWindow"
|
||||
Width="1000"
|
||||
Width="1200"
|
||||
Height="800"
|
||||
d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
|
||||
ui:Design.Background="#252525"
|
||||
@@ -148,7 +148,10 @@
|
||||
<Style BasedOn="{StaticResource DefaultMultiTreeViewItemStyle}" TargetType="ex:MultiTreeViewItem" />
|
||||
</ex:MultiTreeView.ItemContainerStyle>-->
|
||||
</ex:MultiTreeView>
|
||||
<ex:CheckComboBox ItemsSource="{Binding Animals}" />
|
||||
<ex:CheckComboBox
|
||||
DisplayMemberPath="GradeLevel"
|
||||
ItemsSource="{Binding Grades}"
|
||||
SelectedObjList="{Binding SelectedItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Command="{Binding ButtonClickCommand}" Content="显示Snackbar" />
|
||||
<!--<Border Height="8" CornerRadius="4">s
|
||||
<Border.Background>
|
||||
@@ -158,7 +161,16 @@
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>-->
|
||||
<!--<ex:TreeComboBox
|
||||
Width="315"
|
||||
MinHeight="30"
|
||||
Padding="5"
|
||||
ItemsSource="{Binding Items}" />-->
|
||||
</ex:AutoGrid>
|
||||
<ui:SnackbarPresenter x:Name="SnackbarPresenter" DockPanel.Dock="Bottom" />
|
||||
<ui:SnackbarPresenter
|
||||
x:Name="SnackbarPresenter"
|
||||
VerticalAlignment="Bottom"
|
||||
DockPanel.Dock="Bottom" />
|
||||
|
||||
</Grid>
|
||||
</ex:FluentWindowEx>
|
||||
Reference in New Issue
Block a user