private void TextTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (textTable.SelectedCells.Count > 0) { string langCode = textTable[grid_lang.Index, e.RowIndex].Value.ToString(); StringEditor stringEditor = new StringEditor("Insert the text to display - " + langCode); stringEditor.textBox.Text = textTable[grid_content.Index, e.RowIndex].Value.ToString(); if (stringEditor.ShowDialog() == DialogResult.OK) { if (stringEditor.textBox.Text.Length == 0) { Funcs.Error("The label text must be at least 1 character long !"); } else { Target.ContentTable[langCode] = stringEditor.textBox.Text; } } textTable[grid_content.Index, e.RowIndex].Value = Target.ContentTable[langCode]; LivePreview.Update(); } }
public static void OpenProject() { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.InitialDirectory = Config.LastVisitedPath; fileDialog.Title = "Open a project"; fileDialog.Multiselect = false; fileDialog.Filter = "DocMaker Project (*.dmprj)|*.dmprj"; fileDialog.DefaultExt = "dmprj"; if (fileDialog.ShowDialog() == DialogResult.OK) { //Save last opened directory Config.LastVisitedPath = Path.GetDirectoryName(fileDialog.FileName); if (!File.Exists(fileDialog.FileName)) { Funcs.Error("Project file not found !"); return; } if (changeList.Count > 0) { DialogResult dr = Funcs.Question_YNC("Do you want to save changes before opening the file ?"); if (dr == DialogResult.Cancel) { return; } if (dr == DialogResult.Yes) { SaveProject(); } } // Save the file projectLoadedFromFile = true; projectFile = fileDialog.FileName; projectTitle = Path.GetFileName(projectFile); try { InitializeComponents(); fileHandler = new BinaryFileHandler(projectFile, BinaryFileHandler.FileMode.READ); Paper.LoadPaper(); Fonts.LoadFonts(); Languages.LoadLanguages(); Resources.LoadResources(); Objects.LoadObjects(); fileHandler.Close(); } catch (Exception ex) { Funcs.Error("Error while loading the project file.\n" + ex.Message); fileHandler.Close(); // Force closing file NewProject(); } } }