//Constructor for searches unbounded by part types
        public Part(String partType)
        {
            InitializeComponent();
            Orientation = 0;
            CanScale    = false;
            CanRotate   = false;

            _sitesList = new List <Sites> {
                new Sites(), new Sites()
            };

            //if (sw1 != null)
            //{
            _type = partType;
            if (_type == "prom")
            {
                imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_prom2);
                //Background = Brushes.Orange;
            }
            else if (_type == "rbs")
            {
                imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_rbs2);
                //Background = Brushes.DodgerBlue;
            }
            else if (_type == "cds")
            {
                imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_cds2);
                _sitesList.ElementAt(0).copySitesInfoFrom(new Sites("aatg"));
                //Background = Brushes.Green;
            }
            else     //type == "term"
            {
                imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_term2);
                //Background = Brushes.Red;
            }
            //}
            //else
            //{
            //    imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_prom);
            //    this.Background = Brushes.Orange;
            //}

            _myRegDS = new RegDataSheet();

            _progressBarWrapper         = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));
            _myRegDS.BasicInfo.Sequence = "atgcatgctagcatccattacgatccgtcag";
        }
        public PrimerDesigner1(UIElement[][] partSiteSetsFromPD2)
        {
            InitializeComponent();
            Part.pd1            = this;
            SurfaceWindow1.pd1  = this;
            _partSiteSets       = partSiteSetsFromPD2;
            _progressBarWrapper = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));

            //Populate showPanel with elements grouped into StackPanels
            //Grouping helps determine which Parts and Sites data to display when one member is selected
            StackPanel firstPanel = new StackPanel();

            firstPanel.Children.Add(_partSiteSets[0][0]);
            showPanel.Children.Add(firstPanel);
            firstPanel.Visibility = Visibility.Collapsed;

            for (int i = 1; i < _partSiteSets.Count() - 1; i++)
            {
                StackPanel set = new StackPanel();
                foreach (UIElement element in _partSiteSets[i])
                {
                    set.Children.Add(element);
                }
                showPanel.Children.Add(set);
            }

            StackPanel lastPanel = new StackPanel();

            lastPanel.Children.Add(_partSiteSets[_partSiteSets.Count() - 1][0]);
            showPanel.Children.Add(lastPanel);
            lastPanel.Visibility = Visibility.Collapsed;

            foreach (StackPanel sp in showPanel.Children)
            {
                foreach (UIElement elem in sp.Children)
                {
                    elem.IsManipulationEnabled = false;
                }
                sp.Orientation = System.Windows.Controls.Orientation.Horizontal;
                sp.Background  = new SolidColorBrush(Colors.Transparent);
                sp.Margin      = new Thickness(3);
            }


            //Currently, show first part
            showSetData(0, _l0PrimerList);
        }
        public Level0()
        {
            InitializeComponent();
            Width  = 1920;
            Height = 1080;
            Center = new Point(Width / 2.0, Height / 2.0);

            IsTopmostOnActivation = false;
            Part.l0 = this;

            //Create String[] containing filter names for each part; add to partsFilters for later reference
            String[] promFilters  = { "inducible", "constitutive", "repressible", "multiple" };
            String[] rbsFilters   = { "anderson", "community", "isaacs", "rackham", "miscellaneous" };
            String[] cdsFilters   = { "reporter", "transcriptional", "selection marker", "protease", "post-translational modification", "DNA modification", "membrane proteins", "receptors/ligands", "lysis protein", "biosynthesis" }; //Add separate categories later
            String[] termFilters  = { "forward", "bidirectional", "reverse" };
            String[] emptyFilters = { };
            partsFilters    = new String[5][];
            partsFilters[0] = promFilters;
            partsFilters[1] = rbsFilters;
            partsFilters[2] = cdsFilters;
            partsFilters[3] = termFilters;
            partsFilters[4] = emptyFilters;

            //Initialize progress bar
            _progressBarWrapper = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));

            //Create arrays of Parts
            //String loc = Directory.GetCurrentDirectory();
            //loc = loc.Substring(0, loc.IndexOf("bin"));

            //promotersList = createPartsList(loc + "promoters.txt");
            //rbsList = createPartsList(loc + "rbs.txt");
            //cdsList = createPartsList(loc + "cds.txt");
            //terminatorsList = createPartsList(loc + "terminators.txt");

            //Start with promoters
            //_partTypeSelected = "prom";
            //filterText = "inducible";
            prom.IsChecked = true;
            //populate_Filters(0);
            //SurfaceRadioButton firstfilter = VisualTreeHelper.GetChild(filtersPanel, 0) as SurfaceRadioButton;
            //firstfilter.IsChecked = true;
        }
        //Populates showPanels with L1 StackPanels that hold 1-4 L0 StackPanels that hold 1 Part and 2 Sites
        //Grouping into set0s organizes data for L0 PCR products and destination vectors
        //Grouping into set1s organizes data for L1 PCR products (LacZ?) and destination vectors
        public PrimerDesigner1(List <List <Part> > partListFromPD2)
        {
            InitializeComponent();
            Part.pd1            = this;
            SurfaceWindow1.pd1  = this;
            _partList           = partListFromPD2;
            _progressBarWrapper = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));


            /* NOTE: Removing duplicate fusion site visuals is MAD HACK right now, and I know that it's totally wrong and lazy fix. Will have to put in
             * counters and conditionals to figure out when the last part of the last subpart list is to add in that last fusion site. Also need to somehow
             * preserve the fusion site sequence string so it'll display the correct sequence with double fusion site SEQUENCE still there.
             * SHOOT ME IN THE HEAD @T.Feng (will come back to this after dinner)*/


            int partCounter    = 0;
            int sublistCounter = 0;

            foreach (List <Part> sublist in _partList)
            {
                StackPanel set1 = new StackPanel();
                set1.Orientation = System.Windows.Controls.Orientation.Horizontal;
                foreach (Part p in sublist)
                {
                    StackPanel set0 = new StackPanel();
                    set0.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    set0.Background  = new SolidColorBrush(Colors.Transparent);
                    Sites s1 = p.SitesList.ElementAt(0).clone();
                    s1.IsManipulationEnabled = false;
                    set0.Children.Add(s1);
                    set0.Children.Add(p);
                    set1.Children.Add(set0);

                    //if iteration is on last part of entire _partList, add second fusion site to end
                    if ((partCounter == sublist.Count - 1) && (sublistCounter == _partList.Count - 1))
                    {
                        Sites s2 = p.SitesList.ElementAt(1).clone();
                        s2.IsManipulationEnabled = false;
                        set0.Children.Add(s2);
                    }

                    //Generate primers for the Part PCR product and L0 DV and add to list
                    if (_partPrimerList == null)
                    {
                        _partPrimerList = new List <List <String> >();
                    }
                    _partPrimerList.Add(generatePrimers(-1, set0));
                    if (_l0PrimerList == null)
                    {
                        _l0PrimerList = new List <List <String> >();
                    }
                    _l0PrimerList.Add(generatePrimers(0, set0));

                    partCounter++;
                }
                showPanel.Children.Add(set1);

                //If more than one Part in sublist, generate primers for the L1 DV and add to list
                if (sublist.Count > 1)
                {
                    if (_l1PrimerList == null)
                    {
                        _l1PrimerList = new List <List <String> >();
                    }
                    _l1PrimerList.Add(generatePrimers(1, set1));
                    l1DV.IsEnabled  = true;
                    l1DV.Visibility = Visibility.Visible;
                }

                partCounter = 0;
                sublistCounter++;

                //If more than one sublist/L1 module in _partList, generate primers for the L2 DV and add to list
            }
            if (_partList.Count > 1)
            {
                if (_l2PrimerList == null)
                {
                    _l2PrimerList = new List <List <String> >();
                }
                _l2PrimerList.Add(generatePrimers(2, showPanel));
                l2DV.IsEnabled  = true;
                l2DV.Visibility = Visibility.Visible;
            }

            //On initialization, auto-select first Part
            StackPanel show = (StackPanel)VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(showPanel, 0), 0);

            show.Background = new SolidColorBrush(Colors.WhiteSmoke);
            pcr.IsChecked   = true;
        }