/// <summary> /// /// </summary> partial void saveButtonClick(EventArgs e) { if (fileLoaded == String.Empty) { //first we get a filename using (var fileDialog = new SaveFileDialog()) { fileDialog.Filter = "MVCMAP Files|*.mvcmap"; fileDialog.InitialDirectory = Environment.CurrentDirectory; fileDialog.OverwritePrompt = true; fileDialog.Title = "Save file as..."; if (fileDialog.ShowDialog() == DialogResult.OK) { fileLoaded = fileDialog.FileName; } else { UIBridge.Alert("File save aborted"); } } } //we just overwrite... should this be an option? ViewActionMap.Save(data, fileLoaded, true); modified = false; }
/// <summary> /// /// </summary> private void LoadData(string path) { if (File.Exists(path)) { data = ViewActionMap.Load(path); fileLoaded = path; } else if (File.Exists("default.mvcmap")) { data = ViewActionMap.Load("default.mvcmap"); fileLoaded = "default.mvcmap"; } else { data = new ViewActionMap(true); //fallback } }