Prompt for Location ID after login, move cart delete there, refine price-list Backspace navigation, and log every API failure with stack and response body. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using System;
|
||
using System.Drawing;
|
||
using System.Windows.Forms;
|
||
using Elfisa.UI.Helpers;
|
||
using Elfisa.UI.Theming;
|
||
using Электронная_Фармация.Classes;
|
||
using Электронная_Фармация.Properties;
|
||
|
||
namespace Электронная_Фармация.HelpForms
|
||
{
|
||
public partial class HF_LocationId : Form
|
||
{
|
||
public HF_LocationId()
|
||
{
|
||
InitializeComponent();
|
||
Shown += (_, __) => WindowChromeHelper.ApplyTitleBarTheme(this, ThemeManager.Colors);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Показывает диалог Location ID. Возвращает true, если значение сохранено.
|
||
/// </summary>
|
||
public static bool PromptAndSave(IWin32Window owner)
|
||
{
|
||
using (var form = new HF_LocationId())
|
||
{
|
||
UiThemeHelper.ApplyToControlTree(form);
|
||
return form.ShowDialog(owner) == DialogResult.OK;
|
||
}
|
||
}
|
||
|
||
private void HF_LocationId_Load(object sender, EventArgs e)
|
||
{
|
||
UiThemeHelper.ApplyToControlTree(this);
|
||
WindowChromeHelper.ApplyDialogChrome(this, panelHeader, lblTitle);
|
||
txtLocationId.Text = Settings.Default.LocationId ?? string.Empty;
|
||
txtLocationId.SelectAll();
|
||
txtLocationId.Focus();
|
||
}
|
||
|
||
private void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
var locationId = (txtLocationId.Text ?? string.Empty).Trim();
|
||
if (string.IsNullOrWhiteSpace(locationId))
|
||
{
|
||
UiDialogs.ShowError("Укажите Location ID торговой точки.", "Location ID", this);
|
||
txtLocationId.Focus();
|
||
return;
|
||
}
|
||
|
||
AppConfig.SetLocationId(locationId);
|
||
AppDebugLog.Info("Auth", $"LocationId сохранён: {locationId}");
|
||
DialogResult = DialogResult.OK;
|
||
Close();
|
||
}
|
||
|
||
private void btnCancel_Click(object sender, EventArgs e)
|
||
{
|
||
DialogResult = DialogResult.Cancel;
|
||
Close();
|
||
}
|
||
}
|
||
}
|