This commit is contained in:
parent
d5ad291fc8
commit
1da58e2eae
|
|
@ -88,6 +88,34 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
void showChangedFileMessage()
|
||||
{
|
||||
string mes = null;
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
mes = Form1StringResources.Get("FILE_NOT_EXIST_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void MainForm_Activated(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
|
|
@ -96,30 +124,8 @@ namespace VisualPascalABC
|
|||
{
|
||||
wasChangedExternally = false;
|
||||
|
||||
string mes = null;
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
mes = Form1StringResources.Get("FILE_NOT_EXIST_MESSAGE");
|
||||
if (MessageBox.Show(fileName + "\n\n" + mes, Form1StringResources.Get("CHANGED_FILE"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
WorkbenchServiceFactory.FileService.SetFileAsChanged(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
WorkbenchServiceFactory.Workbench.MainForm.BeginInvoke((Action)showChangedFileMessage);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
Loading…
Reference in a new issue