версия 2.0.10: после загрузки прайса — сразу в «Прайс-лист»; Enter в поле кол-ва добавляет в заказ
Some checks failed
Desktop tests / test (push) Has been cancelled

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Exest 2026-08-25 12:59:07 +03:00
parent 3d89fac6e0
commit 96aa963c27
6 changed files with 35 additions and 3 deletions

View File

@ -3,7 +3,7 @@
#define MyAppName "Электронная Фармация"
#define MyAppBrand "ЭльФиСА"
#define MyAppVersion "2.0.9"
#define MyAppVersion "2.0.10"
#define MyAppPublisher "PharmData"
#define MyAppURL "https://cdn.24pharmdata.ru"
#define MyAppSupportURL "https://24pharmdata.ru"

View File

@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<Version>2.0.9</Version>
<Version>2.0.10</Version>
<AssemblyVersion>2.0.9.0</AssemblyVersion>
<FileVersion>2.0.9.0</FileVersion>
<Product>ЭльФиСА — Электронная Фармация</Product>

View File

@ -92,6 +92,9 @@ public partial class LoadPriceViewModel : ViewModelBase
var suppliers = all.Select(x => x.SupplierName).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().Count();
Result = $"Прайс загружен: {all.Count} позиций от {suppliers} поставщик(ов).";
OnPropertyChanged(nameof(LastLoaded));
// Успешно загрузили → сразу в раздел «Прайс-лист».
ShellNavigator.Navigate?.Invoke("Прайс-лист");
}
catch (Exception ex)
{

View File

@ -2,12 +2,19 @@ using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Elfisa.Core;
namespace Elfisa.Avalonia.ViewModels;
/// <summary>Навигация между разделами из любой VM (напр. после загрузки прайса).</summary>
public static class ShellNavigator
{
public static Action<string>? Navigate;
}
public class NavItem
{
public string Title { get; }
@ -85,6 +92,13 @@ public partial class ShellViewModel : ViewModelBase
SelectedNav = NavItems.First(n => n.Title == "Отчёты");
if (Session.Current.IsAuthenticated) _ = LoadPharmacyAsync();
// Навигация из других VM (напр. LoadPrice после успешной загрузки → «Прайс-лист»).
ShellNavigator.Navigate = title => Dispatcher.UIThread.Post(() =>
{
var nav = NavItems.FirstOrDefault(n => n.Title == title);
if (nav != null) SelectedNav = nav;
});
}
private async Task LoadPharmacyAsync()

View File

@ -44,7 +44,7 @@
<Border DockPanel.Dock="Bottom" Margin="14" Padding="0">
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
<TextBlock Text="Кол-во" Classes="label" VerticalAlignment="Center"/>
<NumericUpDown Value="{Binding SelectedOffer.OrderQty}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" Width="120"
<NumericUpDown x:Name="QtyBox" Value="{Binding SelectedOffer.OrderQty}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" Width="120"
IsEnabled="{Binding SelectedOffer, Converter={x:Static conv:ObjectConverters.IsNotNull}}"/>
<Button Classes="primary" Content="Добавить в заказ ▸" Command="{Binding AddToOrderCommand}"/>
<TextBlock Text="или выдели строку и набери число на клавиатуре, Enter — добавить" Classes="muted" VerticalAlignment="Center" TextWrapping="Wrap" MaxWidth="240"/>

View File

@ -1,6 +1,7 @@
using System;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Elfisa.Avalonia.ViewModels;
@ -16,6 +17,20 @@ public partial class PriceListView : UserControl
AvaloniaXamlLoader.Load(this);
var grid = this.FindControl<DataGrid>("OffersGrid");
if (grid != null) grid.KeyDown += OffersGrid_KeyDown;
// Enter в поле «Кол-во» (мышью выставил число) — тоже добавляет в заказ.
// Tunnel, чтобы перехватить до внутреннего TextBox NumericUpDown.
var qty = this.FindControl<NumericUpDown>("QtyBox");
if (qty != null) qty.AddHandler(KeyDownEvent, QtyBox_KeyDown, RoutingStrategies.Tunnel);
}
private void QtyBox_KeyDown(object? sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
(DataContext as PriceListViewModel)?.AddSelectedOffer();
e.Handled = true;
}
}
// Выделил предложение → набираешь число цифрами (как колонка «Заказ» в старой программе).