Исправления

This commit is contained in:
prodigygirl 2022-11-22 10:43:07 +04:00
parent f986342aaf
commit 45788afb0f
2 changed files with 8 additions and 10 deletions

View File

@ -79,7 +79,7 @@ namespace ArmoredCar
}
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
ReloadMaps();
_logger.LogInformation($"Добавлена карта {textBoxNewMapName.Text}");
_logger.LogInformation($"Добавлена карта {listBoxMaps.SelectedItem?.ToString() ?? string.Empty}");
}
/// <summary>
/// Выбор карты
@ -108,7 +108,7 @@ namespace ArmoredCar
{
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
ReloadMaps();
_logger.LogInformation($"Удалена карта {textBoxNewMapName.Text}");
_logger.LogInformation($"Удалена карта {listBoxMaps.SelectedItem?.ToString() ?? string.Empty}");
}
}
/// <summary>
@ -141,17 +141,18 @@ namespace ArmoredCar
}
else
{
_logger.LogWarning("Не удалось добавить объект");
MessageBox.Show("Не удалось добавить объект");
}
}
catch (StorageOverflowException ex)
{
_logger.LogWarning($"{ex.Message}");
_logger.LogWarning($"Ошибка добавления: {ex.Message}");
MessageBox.Show($"Ошибка добавления: {ex.Message}");
}
catch (Exception ex)
{
_logger.LogWarning($"{ex.Message}");
_logger.LogWarning($"Неизвестная ошибка:{ex.Message}");
MessageBox.Show($"Неизвестная ошибка: {ex.Message}");
}
}
@ -186,6 +187,7 @@ namespace ArmoredCar
}
else
{
_logger.LogWarning("Не удалось удалить объект");
MessageBox.Show("Не удалось удалить объект");
}
}
@ -270,13 +272,13 @@ namespace ArmoredCar
try
{
_mapsCollection.SaveData(saveFileDialog.FileName);
_logger.LogInformation($"Сохранение карты в файл {saveFileDialog.FileName}");
_logger.LogInformation($"Сохранение карт в файл {saveFileDialog.FileName}");
MessageBox.Show("Сохранение прошло успешно", "Результат",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
_logger.LogWarning($"{ex.Message}");
_logger.LogWarning($"Не сохранилось: {ex.Message}");
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}

View File

@ -37,10 +37,6 @@ namespace ArmoredCar
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
.Build();
/*var logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.File("log.txt", rollingInterval: RollingInterval.Day)
.CreateLogger();*/
var logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)