- fix Restart app
- Check thêm gửi giao dịch thành công
This commit is contained in:
+9
-1
@@ -214,7 +214,15 @@ namespace SafeBagDE70.API
|
||||
if (response.EnsureSuccessStatusCode().StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
bSuccess = true;
|
||||
if(jsonResponse!=null)
|
||||
{
|
||||
var countingRecv=JsonConvert.DeserializeObject<CountingData2Send>(jsonResponse);
|
||||
if (countingRecv!=null && countingRecv.TransactionCode == data2Send.TransactionCode)
|
||||
{
|
||||
bSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
|
||||
+21
-12
@@ -19,6 +19,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace SafeBagDE70
|
||||
{
|
||||
@@ -85,21 +86,29 @@ namespace SafeBagDE70
|
||||
}
|
||||
|
||||
}
|
||||
public static void RestartApp()
|
||||
public static void RestartApp(bool bAutoRestart=false)
|
||||
{
|
||||
if (AppData.IsInTransaction)
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
MessageBox.Show("LƯU Ý, THAO TÁC NÀY SẼ LÀM MẤT TẤT CẢ DỮ LIỆU ĐANG THAO TÁC. " +
|
||||
"HÃY HOÀN TẤT GIAO DỊCH ĐỂ TIẾP TỤC", "CẢNH BÁO", MessageBoxButton.OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
if (AppData.IsInTransaction)
|
||||
{
|
||||
if (!bAutoRestart)
|
||||
{
|
||||
MessageBox.Show("LƯU Ý, THAO TÁC NÀY SẼ LÀM MẤT TẤT CẢ DỮ LIỆU ĐANG THAO TÁC. " +
|
||||
"HÃY HOÀN TẤT GIAO DỊCH ĐỂ TIẾP TỤC", "CẢNH BÁO", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Process.Start(exePath);
|
||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
|
||||
System.Windows.Application.Current.Shutdown();
|
||||
}
|
||||
Process.Start(exePath);
|
||||
|
||||
System.Windows.Application.Current.Shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
public static void InitDeviceStatus()
|
||||
{
|
||||
@@ -439,7 +448,7 @@ namespace SafeBagDE70
|
||||
if (!IsInTransaction)
|
||||
{
|
||||
await APIModels.UpdateDeviceCommand(command.Id,1);
|
||||
RestartApp();
|
||||
RestartApp(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user