public bool GetSelected() { return(ElementThumb.GetIsSelected(this)); }
public void SetSelected(bool selected) { ElementThumb.SetIsSelected(this, selected); }
public object GetData() { return(ElementThumb.GetData(this)); }
public void SetData(object data) { ElementThumb.SetData(this, data); }
private void SetThumbEvents(ElementThumb thumb) { thumb.DragDelta += (sender, e) => { var canvas = Editor.Context.CurrentCanvas; var element = sender as IThumb; double dX = e.HorizontalChange; double dY = e.VerticalChange; Editor.Drag(canvas, element, dX, dY); }; thumb.DragStarted += (sender, e) => { var canvas = Editor.Context.CurrentCanvas; var element = sender as IThumb; Editor.DragStart(canvas, element); }; thumb.DragCompleted += (sender, e) => { var canvas = Editor.Context.CurrentCanvas; var element = sender as IThumb; Editor.DragEnd(canvas, element); }; }
private object CreatePin(object[] data, double x, double y, bool snap) { if (data == null || data.Length != 1) return null; int id = (int)data[0]; var thumb = new ElementThumb() { Template = Application.Current.Resources[ResourceConstants.KeyTemplatePin] as ControlTemplate, Style = Application.Current.Resources[ResourceConstants.KeySyleRootThumb] as Style, Uid = Constants.TagElementPin + Constants.TagNameSeparator + id.ToString() }; SetThumbEvents(thumb); SetPosition(thumb, x, y, snap); return thumb; }
private object CreateOutput(object[] data, double x, double y, bool snap) { if (data == null || data.Length != 2) return null; int id = (int)data[0]; int tagId = (int)data[1]; var thumb = new ElementThumb() { Template = Application.Current.Resources[ResourceConstants.KeyTemplateOutput] as ControlTemplate, Style = Application.Current.Resources[ResourceConstants.KeySyleRootThumb] as Style, Uid = Constants.TagElementOutput + Constants.TagNameSeparator + id.ToString() }; SetThumbEvents(thumb); SetPosition(thumb, x, y, snap); var tags = this.GetTags(); if (tags != null) { var tag = tags.Cast<Tag>().Where(t => t.Id == tagId).FirstOrDefault(); if (tag != null) ElementThumb.SetData(thumb, tag); } return thumb; }
public void SetTags(List <object> tags) { ElementThumb.SetItems(this, tags); }
public List <object> GetTags() { return(ElementThumb.GetItems(this)); }