internal virtual FlowChartContainer GetContent(FlowChartModel model) { FlowChartContainer container = new FlowChartContainer(); model.Items.ForEach(x => container.Items.Add(x.GetComponent())); return(container); }
internal override void Save(FlowChartModel model) { FlowChartContainer newContent = Util.ConvertFromJSON <FlowChartContainer>(Util.GetJSONString(GetContent(model))); FlowChartContainer container = UndoBuffers.LastOrDefault(); if (container == null) { newContent.DisplayName = DateTime.Now.ToString("HH:mm:ss"); UndoBuffers.Add(newContent); } else { string oDisplayName = container.DisplayName; container.DisplayName = ""; newContent.DisplayName = ""; if (Util.GetJSONString(newContent) != Util.GetJSONString(container)) { newContent.DisplayName = DateTime.Now.ToString("HH:mm:ss"); UndoBuffers.Add(newContent); if (UndoBuffers.Count > 10) { UndoBuffers.RemoveAt(0); } } container.DisplayName = oDisplayName; } }
void undoGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1 && e.RowIndex >= 0 && e.RowIndex < undoGrid.Rows.Count) { FlowChartContainer fc = undoGrid.Rows[e.RowIndex].DataBoundItem as FlowChartContainer; if (fc != null) { controller.Load(fc); } } }
internal void Load(FlowChartContainer container) { this.isReseting = true; this.SelectedComponent = null; this.Model.Items.Clear(); container.Items.ForEach(x => { BaseComponent c = (BaseComponent)Activator.CreateInstance(Type.GetType(x.Type)); c.SetComponent(x); this.Add(c); }); container.Items.ForEach(x => { BaseComponent c = this.Model.Items.Find(y => y.ID == x.ID); c.Accept(new ObjectCreateVisitor(Model, x)); }); this.view.Invalidate(); this.isReseting = false; }