Compare commits
1 Commits
LC
...
880fbfdb47
| Author | SHA1 | Date | |
|---|---|---|---|
| 880fbfdb47 |
@@ -47,6 +47,9 @@
|
||||
<Button Color="Color.Primary" Clicked="@GetCurrentObject">
|
||||
<Icon Name="IconName.Redo" />
|
||||
</Button>
|
||||
<Button Color="Color.Primary" Clicked="@AddOnFile">
|
||||
<Icon Name="IconName.FileUpload" />
|
||||
</Button>
|
||||
</Field>
|
||||
</CardText>
|
||||
</CardBody>
|
||||
@@ -439,39 +442,42 @@
|
||||
visibleProgress = Visibility.Visible;
|
||||
try
|
||||
{
|
||||
foreach (var item in _list_obj)
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var p = await AllPubData.http.PostAsJsonAsync("api/Object/AddObject", item);
|
||||
if (!p.IsSuccessStatusCode)
|
||||
foreach (var item in _list_obj)
|
||||
{
|
||||
error_group = "ОБЪЕКТ";
|
||||
error_msg = $"{item.NameObject} не добавлено.\r\nСтатус код: {p.StatusCode}";
|
||||
toastError = true;
|
||||
//await Task.Delay(500);
|
||||
var p = await AllPubData.http.PostAsJsonAsync("api/Object/AddObject", item);
|
||||
if (!p.IsSuccessStatusCode)
|
||||
{
|
||||
error_group = "ОБЪЕКТ";
|
||||
error_msg = $"{item.NameObject} не добавлено.\r\nСтатус код: {p.StatusCode}";
|
||||
toastError = true;
|
||||
//await Task.Delay(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var item in _list_type)
|
||||
{
|
||||
var p = await AllPubData.http.PostAsJsonAsync("api/Type/AddType", item);
|
||||
if (!p.IsSuccessStatusCode)
|
||||
foreach (var item in _list_type)
|
||||
{
|
||||
error_group = "ТИП";
|
||||
error_msg = $"{item.Name} не добавлено.\r\nСтатус код: {p.StatusCode}";
|
||||
toastError = true;
|
||||
//await Task.Delay(500);
|
||||
var p = await AllPubData.http.PostAsJsonAsync("api/Type/AddType", item);
|
||||
if (!p.IsSuccessStatusCode)
|
||||
{
|
||||
error_group = "ТИП";
|
||||
error_msg = $"{item.Name} не добавлено.\r\nСтатус код: {p.StatusCode}";
|
||||
toastError = true;
|
||||
//await Task.Delay(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var item in _list_dev)
|
||||
{
|
||||
var p = await AllPubData.http.PostAsJsonAsync("api/Device/AddDevice", item);
|
||||
if (!p.IsSuccessStatusCode)
|
||||
foreach (var item in _list_dev)
|
||||
{
|
||||
error_group = "УСТРОЙСТВА";
|
||||
error_msg = $"{item.Name} не добавлено.\r\nСтатус код: {p.StatusCode}";
|
||||
toastError = true;
|
||||
//await Task.Delay(500);
|
||||
var p = await AllPubData.http.PostAsJsonAsync("api/Device/AddDevice", item);
|
||||
if (!p.IsSuccessStatusCode)
|
||||
{
|
||||
error_group = "УСТРОЙСТВА";
|
||||
error_msg = $"{item.Name} не добавлено.\r\nСтатус код: {p.StatusCode}";
|
||||
toastError = true;
|
||||
//await Task.Delay(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -483,6 +489,7 @@
|
||||
{
|
||||
visibleProgress = Visibility.Invisible;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,4 +499,10 @@
|
||||
_list_type = AllPubData.ListDeviceTypeItems;
|
||||
_list_dev = AllPubData.ListDeviceItems;
|
||||
}
|
||||
|
||||
private void AddOnFile()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
///TODO: Добавить возможность загрузить из файла
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user