mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:27:33 +00:00
fix connect
This commit is contained in:
+31
-16
@@ -3285,8 +3285,10 @@ begin
|
||||
FDeviceDialog.OnDiscover := BtnDiscoverFromDialog;
|
||||
if FLightTheme then FDeviceDialog.SetTheme(LightTheme)
|
||||
else FDeviceDialog.SetTheme(DarkTheme);
|
||||
FDeviceDialog.ClearResult; // сбрасываем старый выбор перед открытием
|
||||
FDeviceDialog.ShowModal;
|
||||
// Результат диалога не обрабатываем здесь — START сам спросит если нужно
|
||||
// Если пользователь нажал CONNECT — результат хранится в DialogResult,
|
||||
// START его заберёт и использует с приоритетом над autostart
|
||||
end;
|
||||
|
||||
procedure TMainForm.BtnDiscoverFromDialog(Sender: TObject);
|
||||
@@ -3350,26 +3352,39 @@ begin
|
||||
// --- START ---
|
||||
AutoIP := '';
|
||||
FPendingBoardType := 0;
|
||||
if Assigned(FDeviceDialog) then
|
||||
AutoIP := FDeviceDialog.GetAutoStartIP;
|
||||
|
||||
if AutoIP <> '' then
|
||||
// Явный выбор через CONNECT в диалоге имеет приоритет над autostart
|
||||
if Assigned(FDeviceDialog) and FDeviceDialog.DialogResult.Accepted then
|
||||
begin
|
||||
FPendingIP := AutoIP;
|
||||
FPendingBoardType := FDeviceDialog.GetAutoStartBoardType;
|
||||
FPendingIP := FDeviceDialog.DialogResult.IPAddress;
|
||||
FPendingBoardType := FDeviceDialog.GetSavedBoardType(
|
||||
FDeviceDialog.DialogResult.SavedIdx);
|
||||
FDeviceDialog.ClearResult; // consumed — следующий START снова спросит
|
||||
end
|
||||
else
|
||||
begin
|
||||
if not Assigned(FDeviceDialog) then
|
||||
FDeviceDialog := TDeviceDialog.Create(Self);
|
||||
FDeviceDialog.OnDiscover := BtnDiscoverFromDialog;
|
||||
if FLightTheme then FDeviceDialog.SetTheme(LightTheme)
|
||||
else FDeviceDialog.SetTheme(DarkTheme);
|
||||
if FDeviceDialog.ShowModal <> mrOk then Exit;
|
||||
if not FDeviceDialog.DialogResult.Accepted then Exit;
|
||||
FPendingIP := FDeviceDialog.DialogResult.IPAddress;
|
||||
FPendingBoardType := FDeviceDialog.GetSavedBoardType(
|
||||
FDeviceDialog.DialogResult.SavedIdx);
|
||||
if Assigned(FDeviceDialog) then
|
||||
AutoIP := FDeviceDialog.GetAutoStartIP;
|
||||
|
||||
if AutoIP <> '' then
|
||||
begin
|
||||
FPendingIP := AutoIP;
|
||||
FPendingBoardType := FDeviceDialog.GetAutoStartBoardType;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if not Assigned(FDeviceDialog) then
|
||||
FDeviceDialog := TDeviceDialog.Create(Self);
|
||||
FDeviceDialog.OnDiscover := BtnDiscoverFromDialog;
|
||||
if FLightTheme then FDeviceDialog.SetTheme(LightTheme)
|
||||
else FDeviceDialog.SetTheme(DarkTheme);
|
||||
if FDeviceDialog.ShowModal <> mrOk then Exit;
|
||||
if not FDeviceDialog.DialogResult.Accepted then Exit;
|
||||
FPendingIP := FDeviceDialog.DialogResult.IPAddress;
|
||||
FPendingBoardType := FDeviceDialog.GetSavedBoardType(
|
||||
FDeviceDialog.DialogResult.SavedIdx);
|
||||
FDeviceDialog.ClearResult;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Создаём запись устройства из IP + BoardType из диалога если есть
|
||||
|
||||
Reference in New Issue
Block a user