first edit

This commit is contained in:
Курнат Андрей
2026-01-31 16:11:36 +03:00
commit f0e11d6379
148 changed files with 6986 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.DEV.ViewModels
{
public class DeviceViewModel : ViewModelBase
{
#region Constructor
public DeviceViewModel(ILimsService limsService,Spoi spoi, Tip tip = null)
{
_limsService = limsService;
if (tip != null) _tip = tip;
else _tip = new Tip() {IdspoiNavigation=spoi };
LoadSpnmtpAsync();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly Tip _tip;
private Spnmtp _currentSpnmtp;
#endregion //Fields
#region Properties
public ObservableCollection<Spnmtp> AllSpnmtps { get; set; } = new();
public Spnmtp CurrentSpnmtp
{
get=> _currentSpnmtp;
set
{
_currentSpnmtp = value;
if (_currentSpnmtp != null) _tip.IdspnmtpNavigation = _currentSpnmtp;
OnPropertyChanged();
}
}
public string? Tp
{
get => _tip.Tp;
set { _tip.Tp = value; OnPropertyChanged(); }
}
public int Id => _tip.Id;
#endregion //Properties
#region Methods
public async Task LoadSpnmtpAsync()
{
try
{
// Параллельная загрузка данных из разных доменов через подсервисы
var spnmtpsTask = await _limsService.Spnmtps.GetAllAsync();
AllSpnmtps = new ObservableCollection<Spnmtp>(spnmtpsTask);
OnPropertyChanged(nameof(AllSpnmtps));
}
finally
{
}
}
private async Task SaveAsync()
{
if (_tip.Id == 0) await _limsService.Tips.AddAsync(_tip);
else await _limsService.Tips.UpdateAsync(_tip);
}
public async Task Remove()
{
await _limsService.Tips.RemoveAsync(_tip);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
using XLIMS.DEV.Views;
namespace XLIMS.DEV.ViewModels
{
public class MainViewModel : ViewModelBase,IActivityViewModel
{
#region Constructor
public MainViewModel(ILimsService limsService, IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
//LoadSpoiAsync();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly IDialogService _dialogService;
private readonly ILimsService _limsService;
#endregion //Fields
#region Properties
public string Title => "Приборы";
public object View => new MainView();
#endregion //Properties
#region Methods
#endregion //Methods
#region Commands
#endregion //Commands
}
}