//public static int ID { get; set; } - Phased out 8/11/2011. D.H. public virtual IFigure Clone() { // Updated: clone now inherits properties using read/writeXml. - D.H. var newFigure = Activator.CreateInstance(this.GetType()) as IFigure; newFigure.Dependencies.AddRange(this.Dependencies); newFigure.RegisterWithDependencies(); var s = new System.Text.StringBuilder(); using (var w = System.Xml.XmlWriter.Create(s, new System.Xml.XmlWriterSettings())) { w.WriteStartElement(this.GetType().Name); WriteXml(w); w.WriteEndElement(); } var xml = s.ToString(); newFigure.Drawing = Drawing; try { newFigure.ReadXml(XElement.Parse(xml)); } catch (Exception ex) { Drawing.RaiseError(this, ex); } return(newFigure); }
public virtual void ShowProperties(object selection) { try { this.Show(selection, Drawing.ActionManager); //pg.SelectedObject = selection; // CC } catch (Exception ex) { Drawing.RaiseError(this, ex); } }
public void LoadDrawingFromDGF(string[] lines, string fileName) { try { ShowOperationDuration(() => { Clear(); Drawing.AddFromDGF(lines); Drawing.ActionManager.Clear(); Drawing.Name = fileName; }); } catch (Exception ex) { Drawing.RaiseError(this, ex); } }
public virtual void LoadDrawing(XElement element, string fileName) { PointBase.SuppressAutoLabelPoints = true; try { Clear(); Drawing.AddFromXml(element); Drawing.Name = fileName; Drawing.ClearStatus(); Drawing.ActionManager.Clear(); } catch (Exception ex) { Drawing.RaiseError(this, ex); } PointBase.SuppressAutoLabelPoints = false; }
protected override void UnExecuteCore() { // Suppress auto labeling to prevent duplicate labels. try-catch added to ensure suppression is always stopped. PointBase.SuppressAutoLabelPoints = true; try { foreach (var item in Deleted.Reverse()) { Drawing.Figures.Add(item); } foreach (var item in CustomDependencyRemovers.Reverse()) { item.UnExecute(); } } catch (Exception ex) { Drawing.RaiseError(this, ex); } PointBase.SuppressAutoLabelPoints = false; }
void HandleException(Exception ex) { Drawing.RaiseError(this, ex); }