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#

1 year ago
using Aucma.Scada.UI.Common;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
1 year ago
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
namespace Aucma.Scada.UI.ViewModel.AssemblyPlan
{
1 year ago
public partial class SearchCriteriaViewModel : ObservableObject
1 year ago
{
private AppConfig appConfig = new AppConfig();//AppConfig.Instance;
1 year ago
public SearchCriteriaViewModel()
{
init();
}
private ObservableCollection<string> _configurations = new ObservableCollection<string>();
public ObservableCollection<string> Configurations
{
1 year ago
get => _configurations;
set => SetProperty(ref _configurations, value);
1 year ago
}
1 year ago
[RelayCommand]
1 year ago
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();
}
1 year ago
[RelayCommand]
1 year ago
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);
}
}
}
}