//Adds an editable fusion site template to the library
 private void siteAdder_Click(object sender, RoutedEventArgs e)
 {
     Sites template = new Sites();
     template.CircleText.IsReadOnly = false;
     template.Height = 50;
     template.Width = 50;
     PD2_siteLibrary.Items.Add(template);
     template.Center = SurfaceWindow1.SetPosition(template);
 }
        //Create a user-determined site from a template and adds it to siteLibrary and SourceItems list
        private void CircleText_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Return)
                {
                    String siteSeq = CircleText.Text;
                    Boolean isNotDupe = true;

                    foreach (Sites site in pd2.FusionSiteLibrary)
                    {
                        if (siteSeq == site.Sequence) isNotDupe = false;
                    }

                    if (siteSeq.All(c => "actg".Contains(c)) && siteSeq.Length < 5 && isNotDupe && siteSeq != "aatg") //aatg can only be used between RBS and CDS so they shouldn't need it in the library as a drag and droppable Site
                    {
                        Point originalCenter = Center;
                        Sites s = new Sites(siteSeq);
                        s.Center = originalCenter;
                        pd2.PD2_siteLibrary.Items.Add(s);
                        pd2.FusionSiteLibrary.Add(s);
                        pd2.PD2_siteLibrary.Items.Remove(this);
                    }
                }
            }
            catch (Exception exc) { Console.WriteLine(exc); }
        }
 public Sites clone()
 {
     Sites s = new Sites(_label, _sequence, Circle.Background);
     return s;
 }
 //Copies label, sequence, and appearance from Sites parameter (used to transfer data to placeholder)
 public void copySitesInfoFrom(Sites s)
 {
     _label = s.Label;
     _sequence = s.Sequence;
     Circle.Background = s.Circle.Background;
     CircleText.Text = _sequence;
     Opacity = s.Opacity;
 }
        private void Sites_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            try
            {
                myClone = clone();
                myClone.Center = originalCenter;

                int i = pd2.FusionSiteLibrary.IndexOf(this);
                Point newPoint = SurfaceWindow1.transformCoords(this, pd2.PD2_SV);
                //pd2.SourceItems.Insert(i, copy);
                //pd2.SourceItems.Remove(this);

                pd2.PD2_siteLibrary.Items.Remove(this);
                pd2.PD2_siteLibrary.Items.Add(myClone);
                pd2.PD2_SV.Items.Add(this);
                this.Center = newPoint;

                this.ContainerManipulationDelta -= Sites_ContainerManipulationDelta;
            }
            catch (Exception exc) { Console.WriteLine(exc); }
        }