Починил
This commit is contained in:
parent
e66e721e98
commit
d9dea309c5
@ -12,14 +12,14 @@ namespace Lab4.Extensions
|
|||||||
{
|
{
|
||||||
services.AddScoped<FormMain>();
|
services.AddScoped<FormMain>();
|
||||||
|
|
||||||
services.AddScoped<PluginsConvention>();
|
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddScopes(
|
public static IServiceCollection AddScopes(
|
||||||
this IServiceCollection services)
|
this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.AddScoped<PluginsConvention>();
|
||||||
|
|
||||||
services.AddScoped<Func<Type, IPluginsConvention>>(sp
|
services.AddScoped<Func<Type, IPluginsConvention>>(sp
|
||||||
=> (type) => (sp.GetRequiredService(type) as IPluginsConvention)!);
|
=> (type) => (sp.GetRequiredService(type) as IPluginsConvention)!);
|
||||||
|
|
||||||
|
@ -42,7 +42,13 @@ namespace Lab4.Forms
|
|||||||
_selectedPlugin = key;
|
_selectedPlugin = key;
|
||||||
|
|
||||||
panelControl.Controls.Clear();
|
panelControl.Controls.Clear();
|
||||||
panelControl.Controls.Add(_plugins[key].GetControl);
|
|
||||||
|
_plugins[_selectedPlugin].ReloadData();
|
||||||
|
var control = _plugins[key].GetControl;
|
||||||
|
control.Parent = panelControl;
|
||||||
|
control.Dock = DockStyle.Fill;
|
||||||
|
|
||||||
|
panelControl.Controls.Add(control);
|
||||||
};
|
};
|
||||||
ControlsStripMenuItem.DropDownItems!.Add(item);
|
ControlsStripMenuItem.DropDownItems!.Add(item);
|
||||||
}
|
}
|
||||||
@ -121,6 +127,7 @@ namespace Lab4.Forms
|
|||||||
_plugins[_selectedPlugin].ReloadData();
|
_plugins[_selectedPlugin].ReloadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteElement()
|
private void DeleteElement()
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Удалить выбранный элемент", "Удаление",
|
if (MessageBox.Show("Удалить выбранный элемент", "Удаление",
|
||||||
@ -170,6 +177,7 @@ namespace Lab4.Forms
|
|||||||
_ = MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
_ = MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateTableDoc()
|
private void CreateTableDoc()
|
||||||
{
|
{
|
||||||
using var saveFileDialog = new SaveFileDialog
|
using var saveFileDialog = new SaveFileDialog
|
||||||
@ -198,6 +206,7 @@ namespace Lab4.Forms
|
|||||||
_ = MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
_ = MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateChartDoc()
|
private void CreateChartDoc()
|
||||||
{
|
{
|
||||||
using var saveFileDialog = new SaveFileDialog
|
using var saveFileDialog = new SaveFileDialog
|
||||||
@ -225,6 +234,7 @@ namespace Lab4.Forms
|
|||||||
_ = MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
_ = MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus();
|
private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus();
|
||||||
|
|
||||||
private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement();
|
private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement();
|
||||||
|
@ -177,11 +177,11 @@ namespace Lab4.Implementations
|
|||||||
public Form GetThesaurus()
|
public Form GetThesaurus()
|
||||||
=> new CatalogForm(_educationFormRepository);
|
=> new CatalogForm(_educationFormRepository);
|
||||||
|
|
||||||
public void ReloadData()
|
public async void ReloadData()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var students = _mapper.Map<List<StudentViewModel>>(_studentRepository.GetAsync().Result);
|
var students = _mapper.Map<List<StudentViewModel>>(await _studentRepository.GetAsync());
|
||||||
|
|
||||||
_control.FillValues(
|
_control.FillValues(
|
||||||
students.Select(s => string.Join(" ",
|
students.Select(s => string.Join(" ",
|
||||||
|
Loading…
Reference in New Issue
Block a user