private void PopulateListBox() { if (!DesignMode) { listBoxControl1.DataSource = DiagramRepository.GetDiagramNames(); } }
void OnCustomSaveDocument(object sender, DiagramCustomSaveDocumentEventArgs e) { var diagramName = (string)e.DocumentSource; Text = diagramName; var stream = new MemoryStream(); diagramControl1.SaveDocument(stream); var diagramData = stream.ToArray(); DiagramRepository.SaveDiagramData(diagramName, diagramData); e.Handled = true; }
void OnCustomLoadDocument(object sender, DiagramCustomLoadDocumentEventArgs e) { if (e.DocumentSource == null) { diagramControl1.NewDocument(); Text = "(New Document)"; return; } var diagramName = (string)e.DocumentSource; Text = diagramName; var diagramData = DiagramRepository.GetDiagramData(diagramName); if (diagramData != null) { diagramControl1.LoadDocument(new MemoryStream(diagramData)); } e.Handled = true; }