first edit
This commit is contained in:
10
XLIMS.DEV/AssemblyInfo.cs
Normal file
10
XLIMS.DEV/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
8
XLIMS.DEV/Resources/DevDictionary.xaml
Normal file
8
XLIMS.DEV/Resources/DevDictionary.xaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:XLIMS.DEV.ViewModels"
|
||||
xmlns:v="clr-namespace:XLIMS.DEV.Views">
|
||||
<DataTemplate DataType="{x:Type vm:DeviceViewModel}">
|
||||
<v:DeviceView/>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
84
XLIMS.DEV/ViewModels/DeviceViewModel.cs
Normal file
84
XLIMS.DEV/ViewModels/DeviceViewModel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
48
XLIMS.DEV/ViewModels/MainViewModel.cs
Normal file
48
XLIMS.DEV/ViewModels/MainViewModel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
12
XLIMS.DEV/Views/DeviceView.xaml
Normal file
12
XLIMS.DEV/Views/DeviceView.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="XLIMS.DEV.Views.DeviceView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:XLIMS.DEV.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
26
XLIMS.DEV/Views/DeviceView.xaml.cs
Normal file
26
XLIMS.DEV/Views/DeviceView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace XLIMS.DEV.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для DeviceView.xaml
|
||||
/// </summary>
|
||||
public partial class DeviceView : UserControl
|
||||
{
|
||||
public DeviceView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
8
XLIMS.DEV/Views/MainView.xaml
Normal file
8
XLIMS.DEV/Views/MainView.xaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<UserControl x:Class="XLIMS.DEV.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding Title}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
26
XLIMS.DEV/Views/MainView.xaml.cs
Normal file
26
XLIMS.DEV/Views/MainView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace XLIMS.DEV.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для MainView.xaml
|
||||
/// </summary>
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
42
XLIMS.DEV/Windows/EditWindow.xaml
Normal file
42
XLIMS.DEV/Windows/EditWindow.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<Window
|
||||
x:Class="XLIMS.DEV.Windows.EditWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="{Binding Title}"
|
||||
DataContext="{Binding}"
|
||||
ShowInTaskbar="True"
|
||||
SizeToContent="WidthAndHeight"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="ToolWindow">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Resources/CoreDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel LastChildFill="True">
|
||||
<DockPanel
|
||||
Margin="10"
|
||||
DockPanel.Dock="Bottom"
|
||||
LastChildFill="False">
|
||||
<Button
|
||||
Width="85"
|
||||
Click="Button_Click_1"
|
||||
Command="{Binding CancelCommand}"
|
||||
Content="Отмена"
|
||||
DockPanel.Dock="Right"
|
||||
IsCancel="True" />
|
||||
<Button
|
||||
Width="85"
|
||||
Margin="0,0,10,0"
|
||||
Click="Button_Click_2"
|
||||
Command="{Binding SaveCommand}"
|
||||
Content="ОК"
|
||||
DockPanel.Dock="Right"
|
||||
IsDefault="True" />
|
||||
</DockPanel>
|
||||
<ContentControl Content="{Binding}" />
|
||||
</DockPanel>
|
||||
</Window>
|
||||
37
XLIMS.DEV/Windows/EditWindow.xaml.cs
Normal file
37
XLIMS.DEV/Windows/EditWindow.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace XLIMS.DEV.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для EditWindow.xaml
|
||||
/// </summary>
|
||||
public partial class EditWindow : Window
|
||||
{
|
||||
public EditWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
}
|
||||
|
||||
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
XLIMS.DEV/XLIMS.DEV.csproj
Normal file
22
XLIMS.DEV/XLIMS.DEV.csproj
Normal file
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\XLIMS.CONTRACT\XLIMS.CONTRACT.csproj" />
|
||||
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||
<ProjectReference Include="..\XLIMS.MVVM\XLIMS.MVVM.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\MainView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user