protected void OnPropertyValueChanged(object s, PropertyValueChangedEventArgs e) { BaseController canvasController = serviceManager.Get <IFlowSharpCanvasService>().ActiveController; string label = e.ChangedItem.Label; // Updating a shape. if (pgElement.SelectedObject is ElementProperties) { canvasController.SelectedElements.ForEach(sel => { PropertyInfo piElProps = elementProperties.GetType().GetProperty(label); object oldVal = e.OldValue; object newVal = piElProps.GetValue(elementProperties); canvasController.UndoStack.UndoRedo("Update " + label, () => { canvasController.Redraw(sel, el => { piElProps.SetValue(elementProperties, newVal); elementProperties.Update(el, label); el.UpdateProperties(); el.UpdatePath(); pgElement.Refresh(); }); }, () => { canvasController.Redraw(sel, el => { piElProps.SetValue(elementProperties, oldVal); elementProperties.Update(el, label); el.UpdateProperties(); el.UpdatePath(); pgElement.Refresh(); }); }, false); }); canvasController.UndoStack.FinishGroup(); // Return focus to the canvas so that keyboard actions, like copy/paste, undo/redo, are intercepted // TODO: Seems really kludgy. Task.Delay(250).ContinueWith(t => pgElement.FindForm().BeginInvoke(() => canvasController.Canvas.Focus()) ); } else { // Updating canvas properties (pgElement.SelectedObject as IPropertyObject).Update(label); } }
protected void OnPropertyValueChanged(object s, PropertyValueChangedEventArgs e) { canvasController.Redraw(canvasController.SelectedElement, el => { elementProperties.Update(el); el.UpdateProperties(); el.UpdatePath(); }); }
private static void OnPropertyValueChanged(object s, PropertyValueChangedEventArgs e) { canvasController.SelectedElements.ForEach(sel => { canvasController.Redraw(sel, el => { elementProperties.Update(el, e.ChangedItem.Label); el.UpdateProperties(); el.UpdatePath(); }); }); }
protected void OnPropertyValueChanged(object s, PropertyValueChangedEventArgs e) { canvasController.SelectedElements.ForEach(sel => { canvasController.Redraw(sel, el => { elementProperties.Update(el, e.ChangedItem.Label); el.UpdateProperties(); el.UpdatePath(); }); }); // Return focus to the canvas so that keyboard actions, like copy/paste, undo/redo, are intercepted // TODO: Seems really kludgy. Task.Delay(250).ContinueWith(t => pgElement.FindForm().BeginInvoke(() => canvasController.Canvas.Focus()) ); }