You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using Aucma.Scada.UI.Common;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
|
|
namespace Aucma.Scada.UI.ViewModel.AssemblyPlan
|
|
{
|
|
public partial class SearchCriteriaViewModel : ObservableObject
|
|
{
|
|
private AppConfig appConfig = new AppConfig();//AppConfig.Instance;
|
|
public SearchCriteriaViewModel()
|
|
{
|
|
init();
|
|
}
|
|
|
|
private ObservableCollection<string> _configurations = new ObservableCollection<string>();
|
|
public ObservableCollection<string> Configurations
|
|
{
|
|
get => _configurations;
|
|
set => SetProperty(ref _configurations, value);
|
|
}
|
|
|
|
[RelayCommand]
|
|
private void SaveSearchCriteria()
|
|
{
|
|
var info = _configurations.ToList();
|
|
string items = string.Empty;
|
|
foreach (var configuration in info)
|
|
{
|
|
items += configuration.ToString() + "%";
|
|
}
|
|
appConfig.searchItems = string.Empty;
|
|
appConfig.searchItems = items;
|
|
|
|
init();
|
|
}
|
|
[RelayCommand]
|
|
private void CloseWindow(object parameter)
|
|
{
|
|
var window = parameter as Window;
|
|
if (window != null)
|
|
{
|
|
window.Close();
|
|
}
|
|
|
|
}
|
|
|
|
private void init()
|
|
{
|
|
Configurations = new ObservableCollection<string>();
|
|
|
|
var searchItems = appConfig.searchItems;
|
|
|
|
var split = searchItems.Split('%');
|
|
|
|
foreach (var item in split)
|
|
{
|
|
Configurations.Add(item);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|