first edit
This commit is contained in:
10
XLIMS.CORE/AssemblyInfo.cs
Normal file
10
XLIMS.CORE/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)
|
||||
)]
|
||||
116
XLIMS.CORE/Helpers/ClosePsv.cs
Normal file
116
XLIMS.CORE/Helpers/ClosePsv.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace XLIMS.CORE.Helpers
|
||||
{
|
||||
public class ClosePsv
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
public ClosePsv(DocViewModel document, XLAB7Repository repository, int copies = 0)
|
||||
{
|
||||
if (copies == 0) _copies = 1;
|
||||
else _copies = copies;
|
||||
_document = document;
|
||||
_repository = repository;
|
||||
_fi = new FileInfo(@"Resources\DOCX\ClosePsv.docx");
|
||||
_wordApp = new Microsoft.Office.Interop.Word.Application();
|
||||
_wordDocument = _wordApp.Documents.Open(_fi.FullName);
|
||||
_table = _wordDocument.Tables[1];
|
||||
}
|
||||
|
||||
#endregion //Constructor
|
||||
|
||||
#region Fields
|
||||
|
||||
private Microsoft.Office.Interop.Word.Application _wordApp;
|
||||
private Microsoft.Office.Interop.Word.Document _wordDocument;
|
||||
private object _wFalse = false;
|
||||
private object _wTrue = true;
|
||||
private object _missing = null;
|
||||
private FileInfo _fi;
|
||||
private DocViewModel _document;
|
||||
private Table _table;
|
||||
private int _copies;
|
||||
private XLAB7Repository _repository;
|
||||
#endregion //Fields
|
||||
|
||||
#region Properties
|
||||
|
||||
#endregion //Properties
|
||||
|
||||
#region Mehtods
|
||||
|
||||
private void Replace(string text, string replacementText)
|
||||
{
|
||||
Find find = _wordApp.Selection.Find;
|
||||
find.Text = text;
|
||||
find.Replacement.Text = replacementText;
|
||||
find.Execute(FindText: Type.Missing,
|
||||
MatchCase: false,
|
||||
MatchWholeWord: false,
|
||||
MatchWildcards: false,
|
||||
MatchSoundsLike: Type.Missing,
|
||||
MatchAllWordForms: false,
|
||||
Forward: true,
|
||||
Wrap: Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue,
|
||||
Format: false,
|
||||
ReplaceWith: Type.Missing,
|
||||
Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);
|
||||
}
|
||||
|
||||
public void Print()
|
||||
{
|
||||
|
||||
Replace("number", _document.Number);
|
||||
Replace("div", _document.CurrentFRPD.NMFRPD);
|
||||
Replace("date", ((DateTime)_document.Date).ToLongDateString());
|
||||
Replace("count", _document.AllEKZMK.Count.ToString());
|
||||
Replace("bad", _document.AllEKZMK.Count(o => o.GDN == false).ToString());
|
||||
Replace("good", _document.AllEKZMK.Count(o => o.GDN == true).ToString());
|
||||
Replace("person", _document.CurrentPRSNVY.PRFIO);
|
||||
Replace("today", ((DateTime)_document.DateVY).ToLongDateString());
|
||||
var i = 2;
|
||||
var n = 1;
|
||||
foreach (var data in _document.AllGroupsEKZMK)
|
||||
{
|
||||
_table.Rows.Add();
|
||||
_table.Rows[i].Cells[1].Range.Text = n.ToString();
|
||||
_table.Rows[i].Cells[2].Range.Text = data.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.IDTIPSNavigation.IDSPNMTPNavigation.NMTP;
|
||||
_table.Rows[i].Cells[3].Range.Text = data.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.IDTIPSNavigation.TP;
|
||||
_table.Rows[i].Cells[4].Range.Text = data.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.DPZN;
|
||||
if (data.GroupEKZMK.Count() > 3)
|
||||
{
|
||||
_table.Rows[i].Cells[5].Range.Text = data.GroupEKZMK.Count().ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var d in data.GroupEKZMK)
|
||||
{
|
||||
_table.Rows[i].Cells[5].Range.Text += d.CurrentEKZ.NNZV + ", ";
|
||||
}
|
||||
}
|
||||
_table.Rows[i].Cells[6].Range.Text = data.Count.ToString();
|
||||
_table.Rows[i].Cells[7].Range.Text = data.GoodCount.ToString();
|
||||
_table.Rows[i].Cells[8].Range.Text = data.BadCount.ToString();
|
||||
try
|
||||
{
|
||||
_table.Rows[i].Cells[9].Range.Text = data.CurrentEKZMK.CurrentDMS.NND.ToString() + " от " + data.CurrentEKZMK.CurrentDMS.DTD.ToShortDateString();
|
||||
}
|
||||
catch { }
|
||||
|
||||
i++;
|
||||
n++;
|
||||
}
|
||||
_wordDocument.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _copies);
|
||||
_wordDocument.Close(_wFalse);
|
||||
_wordApp.Quit();
|
||||
}
|
||||
#endregion //Mehtods
|
||||
}
|
||||
}
|
||||
106
XLIMS.CORE/Helpers/Izv.cs
Normal file
106
XLIMS.CORE/Helpers/Izv.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace XLIMS.CORE.Helpers
|
||||
{
|
||||
public class Izv
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
public Izv(DMS document, XLAB7Repository repository, int copies = 1)
|
||||
{
|
||||
_document = document;
|
||||
_repository = repository;
|
||||
_copies = copies;
|
||||
_docs = _repository.GetDMS().Where(w => w.NND == _document.NND).ToList();
|
||||
_fi = new FileInfo(@"Resources\DOCX\Izv.docx");
|
||||
_wordApp = new Application();
|
||||
_wordDocument = _wordApp.Documents.Open(_fi.FullName);
|
||||
}
|
||||
#endregion //Constructor
|
||||
|
||||
#region Fields
|
||||
|
||||
private Application _wordApp;
|
||||
private Microsoft.Office.Interop.Word.Document _wordDocument;
|
||||
private object _wFalse = false;
|
||||
private object _wTrue = true;
|
||||
private object _missing = null;
|
||||
private FileInfo _fi;
|
||||
private DMS _document;
|
||||
private List<DMS> _docs;
|
||||
private Table _table;
|
||||
private int _copies;
|
||||
private XLAB7Repository _repository;
|
||||
#endregion //Fields
|
||||
|
||||
#region Properties
|
||||
|
||||
#endregion //Properties
|
||||
|
||||
#region Mehtods
|
||||
|
||||
private void Replace(string text, string replacementText)
|
||||
{
|
||||
Find find = _wordApp.Selection.Find;
|
||||
find.Text = text;
|
||||
find.Replacement.Text = replacementText;
|
||||
find.Execute(FindText: Type.Missing,
|
||||
MatchCase: false,
|
||||
MatchWholeWord: false,
|
||||
MatchWildcards: false,
|
||||
MatchSoundsLike: Type.Missing,
|
||||
MatchAllWordForms: false,
|
||||
Forward: true,
|
||||
Wrap: Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue,
|
||||
Format: false,
|
||||
ReplaceWith: Type.Missing,
|
||||
Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);
|
||||
}
|
||||
|
||||
public void Print()
|
||||
{
|
||||
var ekzmk = new List<EKZMK>();
|
||||
foreach (var doc in _docs)
|
||||
{
|
||||
try
|
||||
{
|
||||
ekzmk.Add(_repository.GetEKZMK().Result.FirstOrDefault(f => f.IDEKZMK == doc.IDOD));
|
||||
}
|
||||
catch { continue; }
|
||||
}
|
||||
Replace("number", _document.NND);
|
||||
Replace("name", ekzmk.FirstOrDefault().IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.IDSPNMTPNavigation.NMTP);
|
||||
if (ekzmk.Count() > 3)
|
||||
{
|
||||
Replace("serial", ekzmk.Count().ToString()+" шт.");
|
||||
}
|
||||
else
|
||||
{
|
||||
string serials=string.Empty;
|
||||
foreach (var d in ekzmk)
|
||||
{
|
||||
serials += d.IDEKZNavigation.NNZV+", ";
|
||||
}
|
||||
Replace("serial", serials);
|
||||
}
|
||||
Replace("type", ekzmk.FirstOrDefault().IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.TP);
|
||||
Replace("gr", ekzmk.FirstOrDefault().IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.NNTPGR);
|
||||
Replace("reason", ekzmk.FirstOrDefault().PRCHNPGDN);
|
||||
Replace("method", "");
|
||||
Replace("dev", ekzmk.FirstOrDefault().IDEKZNavigation.IDFRPDVNavigation.NMFRPD);
|
||||
Replace("person", ekzmk.FirstOrDefault().IDPRSNNavigation.PRFIO);
|
||||
Replace("date", ((DateTime)ekzmk.FirstOrDefault().DTMKFK).ToLongDateString());
|
||||
|
||||
_wordDocument.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _copies);
|
||||
_wordDocument.Close(_wFalse);
|
||||
_wordApp.Quit();
|
||||
}
|
||||
#endregion //Mehtods
|
||||
}
|
||||
}
|
||||
124
XLIMS.CORE/Helpers/OpenPsv.cs
Normal file
124
XLIMS.CORE/Helpers/OpenPsv.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace XLIMS.CORE.Helpers
|
||||
{
|
||||
public class OpenPsv
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly dynamic _wordApp;
|
||||
private readonly dynamic _wordDocument;
|
||||
private readonly dynamic _table;
|
||||
|
||||
private readonly DocViewModel _document;
|
||||
private readonly XLAB7Repository _repository;
|
||||
private readonly int _copies;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public OpenPsv(DocViewModel document, XLAB7Repository repository, int copies = 1)
|
||||
{
|
||||
_document = document ?? throw new ArgumentNullException(nameof(document));
|
||||
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||
_copies = copies < 1 ? 1 : copies;
|
||||
|
||||
var templatePath = Path.Combine("Resources", "DOCX", "OpenPsv.docx");
|
||||
|
||||
if (!File.Exists(templatePath))
|
||||
throw new FileNotFoundException("Шаблон Word не найден", templatePath);
|
||||
|
||||
var wordType = Type.GetTypeFromProgID("Word.Application");
|
||||
if (wordType == null)
|
||||
throw new InvalidOperationException("Microsoft Word не установлен");
|
||||
|
||||
_wordApp = Activator.CreateInstance(wordType);
|
||||
_wordApp.Visible = false;
|
||||
|
||||
_wordDocument = _wordApp.Documents.Open(templatePath);
|
||||
|
||||
if (_wordDocument.Tables.Count < 1)
|
||||
throw new InvalidOperationException("В документе отсутствует таблица");
|
||||
|
||||
_table = _wordDocument.Tables[1];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void Replace(string placeholder, string value)
|
||||
{
|
||||
dynamic range = _wordDocument.Content;
|
||||
dynamic find = range.Find;
|
||||
|
||||
find.ClearFormatting();
|
||||
find.Text = placeholder;
|
||||
find.Replacement.ClearFormatting();
|
||||
find.Replacement.Text = value ?? string.Empty;
|
||||
|
||||
find.Execute(
|
||||
Replace: 2, // wdReplaceAll
|
||||
Wrap: 1 // wdFindContinue
|
||||
);
|
||||
}
|
||||
|
||||
public void Print()
|
||||
{
|
||||
Replace("number", _document.Number);
|
||||
Replace("div", _document.CurrentFRPD.NMFRPD);
|
||||
Replace("date", ((DateTime)_document.Date).ToLongDateString());
|
||||
Replace("count", _document.AllEKZMK.Count.ToString());
|
||||
Replace("next", ((DateTime)_document.Date).AddDays(30).ToLongDateString());
|
||||
Replace("person", _document.CurrentPRSNPR.PRFIO);
|
||||
|
||||
int rowIndex = 2;
|
||||
int index = 1;
|
||||
|
||||
foreach (var group in _document.AllGroupsEKZMK)
|
||||
{
|
||||
_table.Rows.Add();
|
||||
|
||||
_table.Cell(rowIndex, 1).Range.Text = index.ToString();
|
||||
_table.Cell(rowIndex, 2).Range.Text =
|
||||
group.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation
|
||||
.IDTIPSNavigation.IDSPNMTPNavigation.NMTP;
|
||||
|
||||
_table.Cell(rowIndex, 3).Range.Text =
|
||||
group.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation
|
||||
.IDTIPSNavigation.TP;
|
||||
|
||||
_table.Cell(rowIndex, 4).Range.Text =
|
||||
group.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.DPZN;
|
||||
|
||||
if (group.GroupEKZMK.Count() > 3)
|
||||
{
|
||||
_table.Cell(rowIndex, 5).Range.Text =
|
||||
group.GroupEKZMK.Count().ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in group.GroupEKZMK)
|
||||
{
|
||||
_table.Cell(rowIndex, 5).Range.Text +=
|
||||
item.CurrentEKZ.NNZV + ", ";
|
||||
}
|
||||
}
|
||||
|
||||
_table.Cell(rowIndex, 6).Range.Text = group.Count.ToString();
|
||||
_table.Cell(rowIndex, 9).Range.Text = group.CurrentEKZMK.DSEKZMK;
|
||||
|
||||
rowIndex++;
|
||||
index++;
|
||||
}
|
||||
|
||||
_wordDocument.PrintOut(Copies: _copies);
|
||||
_wordDocument.Close(false);
|
||||
_wordApp.Quit();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
87
XLIMS.CORE/Helpers/Svid.cs
Normal file
87
XLIMS.CORE/Helpers/Svid.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace XLIMS.CORE.Helpers
|
||||
{
|
||||
public class Svid
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
|
||||
public Svid(DMS document, XLAB7Repository repository, int copies = 1)
|
||||
{
|
||||
_copies = copies;
|
||||
_document = document;
|
||||
_repository = repository;
|
||||
_fi = new FileInfo(@"Resources\DOCX\Svid.docx");
|
||||
_wordApp = new Application();
|
||||
_wordDocument = _wordApp.Documents.Open(_fi.FullName);
|
||||
}
|
||||
#endregion //Constructor
|
||||
|
||||
#region Fields
|
||||
|
||||
private Application _wordApp;
|
||||
private Microsoft.Office.Interop.Word.Document _wordDocument;
|
||||
private object _wFalse = false;
|
||||
private object _wTrue = true;
|
||||
private object _missing = null;
|
||||
private FileInfo _fi;
|
||||
private DMS _document;
|
||||
private Table _table;
|
||||
private int _copies;
|
||||
private XLAB7Repository _repository;
|
||||
#endregion //Fields
|
||||
|
||||
#region Properties
|
||||
|
||||
#endregion //Properties
|
||||
|
||||
#region Mehtods
|
||||
|
||||
private void Replace(string text, string replacementText)
|
||||
{
|
||||
Find find = _wordApp.Selection.Find;
|
||||
find.Text = text;
|
||||
find.Replacement.Text = replacementText;
|
||||
find.Execute(FindText: Type.Missing,
|
||||
MatchCase: false,
|
||||
MatchWholeWord: false,
|
||||
MatchWildcards: false,
|
||||
MatchSoundsLike: Type.Missing,
|
||||
MatchAllWordForms: false,
|
||||
Forward: true,
|
||||
Wrap: Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue,
|
||||
Format: false,
|
||||
ReplaceWith: Type.Missing,
|
||||
Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);
|
||||
}
|
||||
|
||||
public void Print()
|
||||
{
|
||||
var ekzmk = _repository.GetEKZMK().Result.FirstOrDefault(f => f.IDEKZMK == _document.IDOD);
|
||||
Replace("number", _document.NND);
|
||||
Replace("nextpovdate", ((DateTime)ekzmk.IDEKZNavigation.EKZMCP.FirstOrDefault().DTMKPLO).ToLongDateString());
|
||||
Replace("name", ekzmk.IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.IDSPNMTPNavigation.NMTP);
|
||||
Replace("serial", ekzmk.IDEKZNavigation.NNZV);
|
||||
Replace("type", ekzmk.IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.TP);
|
||||
Replace("gr", ekzmk.IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.NNTPGR);
|
||||
Replace("method", "");
|
||||
Replace("temp", ekzmk.EKZMKFCTVL.FirstOrDefault(f=>f.IDSPIV==1000).ZNFCTVLMIN.ToString());
|
||||
Replace("hum", ekzmk.EKZMKFCTVL.FirstOrDefault(f => f.IDSPIV == 1002).ZNFCTVLMIN.ToString());
|
||||
Replace("press", ekzmk.EKZMKFCTVL.FirstOrDefault(f => f.IDSPIV == 1001).ZNFCTVLMIN.ToString());
|
||||
Replace("count", "");
|
||||
Replace("person", ekzmk.IDPRSNNavigation.PRFIO);
|
||||
Replace("date", ((DateTime)ekzmk.DTMKFK).ToLongDateString());
|
||||
_wordDocument.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _copies);
|
||||
_wordDocument.Close(_wFalse);
|
||||
_wordApp.Quit();
|
||||
}
|
||||
#endregion //Mehtods
|
||||
}
|
||||
}
|
||||
3
XLIMS.CORE/Resources/CoreDictionary.xaml
Normal file
3
XLIMS.CORE/Resources/CoreDictionary.xaml
Normal file
@@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
</ResourceDictionary>
|
||||
BIN
XLIMS.CORE/Resources/DOCX/ClosePsv.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/ClosePsv.docx
Normal file
Binary file not shown.
BIN
XLIMS.CORE/Resources/DOCX/Izv.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/Izv.docx
Normal file
Binary file not shown.
BIN
XLIMS.CORE/Resources/DOCX/OpenPsv.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/OpenPsv.docx
Normal file
Binary file not shown.
BIN
XLIMS.CORE/Resources/DOCX/Svid.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/Svid.docx
Normal file
Binary file not shown.
73
XLIMS.CORE/ViewModels/MainViewModel.cs
Normal file
73
XLIMS.CORE/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using XLIMS.CONTRACT;
|
||||
using XLIMS.CORE.Windows;
|
||||
using XLIMS.MVVM.Base;
|
||||
|
||||
namespace XLIMS.CORE.ViewModels
|
||||
{
|
||||
public class MainViewModel:ViewModelBase
|
||||
{
|
||||
#region Constructor
|
||||
public MainViewModel(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
|
||||
// Регистрация доступных activities
|
||||
Activities.Add(serviceProvider.GetRequiredService<XLIMS.PSV.ViewModels.MainViewModel>());
|
||||
Activities.Add(serviceProvider.GetRequiredService<XLIMS.DEV.ViewModels.MainViewModel>());
|
||||
Activities.Add(serviceProvider.GetRequiredService<XLIMS.SP.ViewModels.MainViewModel>());
|
||||
Activities.Add(serviceProvider.GetRequiredService<XLIMS.TPRZ.ViewModels.MainViewModel>());
|
||||
|
||||
// По умолчанию открываем первую
|
||||
CurrentActivity = Activities.FirstOrDefault();
|
||||
|
||||
NavigateCommand = new RelayCommand<IActivityViewModel>(Navigate);
|
||||
}
|
||||
#endregion //Constructor
|
||||
|
||||
#region Events
|
||||
#endregion //Events
|
||||
|
||||
#region Fields
|
||||
public readonly IServiceProvider _serviceProvider;
|
||||
#endregion //Fields
|
||||
|
||||
#region Properties
|
||||
public ObservableCollection<IActivityViewModel> Activities { get; }
|
||||
= new ObservableCollection<IActivityViewModel>();
|
||||
|
||||
private IActivityViewModel _currentActivity;
|
||||
public IActivityViewModel CurrentActivity
|
||||
{
|
||||
get => _currentActivity;
|
||||
set
|
||||
{
|
||||
if (_currentActivity != value)
|
||||
{
|
||||
_currentActivity = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion //Properties
|
||||
|
||||
#region Methods
|
||||
private void Navigate(IActivityViewModel vm)
|
||||
{
|
||||
if (vm != null)
|
||||
CurrentActivity = vm;
|
||||
}
|
||||
#endregion //Methods
|
||||
|
||||
#region Commands
|
||||
public ICommand NavigateCommand { get; }
|
||||
#endregion //Commands
|
||||
}
|
||||
}
|
||||
42
XLIMS.CORE/Windows/EditWindow.xaml
Normal file
42
XLIMS.CORE/Windows/EditWindow.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<Window
|
||||
x:Class="XLIMS.CORE.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.CORE/Windows/EditWindow.xaml.cs
Normal file
37
XLIMS.CORE/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.CORE.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.CORE/Windows/MainWindow.xaml
Normal file
22
XLIMS.CORE/Windows/MainWindow.xaml
Normal file
@@ -0,0 +1,22 @@
|
||||
<Window x:Class="XLIMS.CORE.Windows.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="XLIMS"
|
||||
WindowState="Maximized">
|
||||
<DockPanel LastChildFill="True">
|
||||
<Border DockPanel.Dock="Left" Width="40"
|
||||
Background="Gray">
|
||||
<ListBox ItemsSource="{Binding Activities}"
|
||||
SelectedItem="{Binding CurrentActivity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Title}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
<ContentControl DataContext="{Binding CurrentActivity}" Content="{Binding View}"/>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
||||
|
||||
42
XLIMS.CORE/Windows/MainWindow.xaml.cs
Normal file
42
XLIMS.CORE/Windows/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
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.Shapes;
|
||||
using XLIMS.CORE.ViewModels;
|
||||
|
||||
namespace XLIMS.CORE.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow(MainViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = viewModel; // ViewModel уже содержит ILimsService и все подсервисы
|
||||
|
||||
// При необходимости загружаем данные
|
||||
if (viewModel is MainViewModel vm)
|
||||
{
|
||||
//vm.LoadDataAsync(); // или Loaded событие
|
||||
}
|
||||
}
|
||||
// private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
// {
|
||||
// if (e.ChangedButton == MouseButton.Left)
|
||||
// DragMove();
|
||||
// }
|
||||
|
||||
// private void Minimize_Click(object sender, RoutedEventArgs e) => WindowState = WindowState.Minimized;
|
||||
// private void Maximize_Click(object sender, RoutedEventArgs e) => WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
||||
// private void Close_Click(object sender, RoutedEventArgs e) => Close();
|
||||
}
|
||||
}
|
||||
28
XLIMS.CORE/XLIMS.CORE.csproj
Normal file
28
XLIMS.CORE/XLIMS.CORE.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Helpers\**" />
|
||||
<EmbeddedResource Remove="Helpers\**" />
|
||||
<None Remove="Helpers\**" />
|
||||
<Page Remove="Helpers\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||
<ProjectReference Include="..\XLIMS.MVVM\XLIMS.MVVM.csproj" />
|
||||
<ProjectReference Include="..\XLIMS.PSV\XLIMS.PSV.csproj" />
|
||||
<ProjectReference Include="..\XLIMS.SERVICES\XLIMS.SERVICES.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user