MainForm.Invoke for the changes
This commit is contained in:
parent
3916a2dfdb
commit
d84b6d5358
|
|
@ -90,17 +90,18 @@ namespace VisualPascalABC
|
|||
|
||||
void MainForm_Activated(object sender, EventArgs e) => System.Threading.Tasks.Task.Run(() =>
|
||||
{
|
||||
if (!wasChangedExternally) return;
|
||||
wasChangedExternally = false;
|
||||
try
|
||||
{
|
||||
if (wasChangedExternally)
|
||||
string mes = null;
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
wasChangedExternally = false;
|
||||
|
||||
string mes = null;
|
||||
if (!File.Exists(fileName))
|
||||
mes = Form1StringResources.Get("FILE_NOT_EXIST_MESSAGE");
|
||||
var dr = MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
VisualPABCSingleton.MainForm.Invoke((Action)(() =>
|
||||
{
|
||||
mes = Form1StringResources.Get("FILE_NOT_EXIST_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
|
|
@ -108,24 +109,27 @@ namespace VisualPascalABC
|
|||
{
|
||||
WorkbenchServiceFactory.FileService.CloseFile(fileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mes = Form1StringResources.Get("FILE_CHANGED_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.ReloadFile(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
mes = Form1StringResources.Get("FILE_CHANGED_MESSAGE");
|
||||
var dr = MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
VisualPABCSingleton.MainForm.Invoke((Action)(() =>
|
||||
{
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.ReloadFile(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception) {}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue