private void SaveProjectThread(object o) { Saving = true; var strPathSavedFile = (string)o; using (FormLoadSave fLoading = new FormLoadSave(mainForm)) { try { fLoading.action = FormLoadSave.Action.Saving; fLoading.Tag = strPathSavedFile; if (fLoading.ShowDialog() == DialogResult.OK) { mainForm.Invoke(new MethodInvoker(delegate { MessageBox.Show(mainForm, "Project saved successfully!", mainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); })); } } catch { mainForm.Invoke(new MethodInvoker(delegate { MessageBox.Show(mainForm, "Error saving project", mainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); })); } finally { Saving = false; } } }
public void LoadProjectThread(object o) { var strPathSavedFile = (string)o; using (var fLoading = new FormLoadSave(mainForm)) { try { fLoading.action = FormLoadSave.Action.Loading; fLoading.Tag = strPathSavedFile; if (fLoading.ShowDialog() == DialogResult.OK) { mainForm.Invoke(new MethodInvoker(delegate { mainForm.Select(); MessageBox.Show("Project loaded successfully!", mainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Program.data.tasker.AsociaEventosTareas(); })); } } catch (System.IO.FileNotFoundException) { mainForm.Invoke(new MethodInvoker(delegate { MessageBox.Show(String.Format("The file {0} don't exist", strPathSavedFile), mainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); })); } catch (Exception) { mainForm.Invoke(new MethodInvoker(delegate { MessageBox.Show("Project file is corrupted or old", mainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); })); } } mainForm.Invoke(new MethodInvoker(delegate { if (Program.data.Project == null) { GUI.UpdateGUI.Reset(); } })); }