예제 #1
0
        private void select_DataSheet(object sender, RoutedEventArgs e)
        {
            //try
            //{
            //_thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text);

            ds = new MenuDataSheet();
            ds.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(onDSManipulationCompleted);

            if (_myRegDS.Name != "test") //Already got data from registry, so just populate from it
            {
                #region Populating the data sheet's datasheet
                //Specifies the Length of the Sequence on the Sequence tab of the data sheet
                int       Length      = _myRegDS.BasicInfo.Length;
                TextBlock LengthBlock = new TextBlock();
                //ds.SeqTab.Children.Add(LengthBlock);
                LengthBlock.VerticalAlignment = VerticalAlignment.Top;
                LengthBlock.Text = "Length: " + Length.ToString();

                //This is all pulling information from the Reg Data Sheet associated with the part and inserting it in the data sheet
                ds.PopulateDataSheet(_myRegDS.Name, 0, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.BasicInfo.DescriptionName, 1, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Type, 2, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Promoter.getReg(), 3, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.BasicInfo.Availability, 4, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.BasicInfo.Usefulness, 5, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Description.assembCompString(), 6, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Description.chassisString(), 7, 1, ds.DataSheet, "datasheet");



                //Specific to sequence tab
                ds.PopulateDataSheet(_myRegDS.BasicInfo.Sequence, 1, 1, ds.SeqTab, "seq");
                ds.PopulateDataSheet(Length.ToString(), 0, 1, ds.SeqTab, "length");

                //Specific to AuthorInfo Tab
                ds.PopulateDataSheet(_myRegDS.Reference.Author, 0, 1, ds.AuthorInfo, "author");
                ds.PopulateDataSheet(_myRegDS.Reference.Group, 1, 1, ds.AuthorInfo, "author");
                ds.PopulateDataSheet(_myRegDS.Reference.Date, 2, 1, ds.AuthorInfo, "author");

                if (_myRegDS.Type == "rbs")
                {
                    RowDefinition rowDef1 = new RowDefinition();
                    ds.DataSheet.RowDefinitions.Add(rowDef1);
                    ds.PopulateDataSheet(_myRegDS.Rbs.FamilyName, 8, 1, ds.DataSheet);
                    TextBlock RBSFam = new TextBlock();
                    RBSFam.Text = "Family";
                    ds.DataSheet.Children.Add(RBSFam);
                    Grid.SetRow(RBSFam, 8);
                }
                else if (_myRegDS.Type == "terminator")
                {
                    RowDefinition rowDef1 = new RowDefinition();
                    RowDefinition rowDef2 = new RowDefinition();
                    RowDefinition rowDef3 = new RowDefinition();
                    RowDefinition rowDef4 = new RowDefinition();

                    ds.DataSheet.RowDefinitions.Add(rowDef1);
                    ds.DataSheet.RowDefinitions.Add(rowDef2);
                    ds.DataSheet.RowDefinitions.Add(rowDef3);
                    ds.DataSheet.RowDefinitions.Add(rowDef4);

                    TextBlock Direction = new TextBlock();
                    Direction.Text     = "Direction";
                    Direction.FontSize = 18;
                    ds.DataSheet.Children.Add(Direction);
                    Grid.SetRow(Direction, 8);

                    ds.PopulateDataSheet(_myRegDS.Terminators.Direction, 8, 1, ds.DataSheet);
                    ds.PopulateDataSheet(_myRegDS.Terminators.ForwardEff, 9, 1, ds.DataSheet);
                    ds.PopulateDataSheet(_myRegDS.Terminators.ReversedEff, 10, 1, ds.DataSheet);
                    ds.PopulateDataSheet(_myRegDS.Terminators.ReversedVers, 11, 1, ds.DataSheet);
                }

                #endregion

                #region Populating Publications
                Func <String, PubList> _GetPublications =
                    delegate(String id) { return(new PubList(id)); };
                Action <PubList> callback = delegate(PubList result)
                {
                    //_thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text);

                    int m = 0;

                    if (result.Titles.Count == 0)
                    {
                        int Count = result.Titles.Count;
                        SurfaceListBoxItem NoResults = new SurfaceListBoxItem();
                        TextBlock          Content   = new TextBlock();
                        Content.Text      = "No Results Found";
                        NoResults.Content = Content;
                        ds.Publictions.Items.Add(NoResults);
                    }

                    if (result.Titles.Count > 0)
                    {
                        int TotalArticles = result.Titles.Count;
                        SurfaceListBoxItem ArticleCount = new SurfaceListBoxItem();
                        TextBlock          CountContent = new TextBlock();
                        CountContent.Text    = "Results Found: " + TotalArticles as string;
                        ArticleCount.Content = CountContent;
                        ds.Publictions.Items.Add(ArticleCount);
                    }

                    foreach (String Titles in result.Titles)
                    {
                        //To Test if titles are actually adding
                        SurfaceListBoxItem item      = new SurfaceListBoxItem();
                        TextBlock          PubTitles = new TextBlock();
                        item.Selected += new RoutedEventHandler(item_Selected);
                        item.Content   = Titles;
                        PubTitles.Tag  = result.Links.ElementAt(m);
                        //item.Tag = result.Authors.ElementAt(m);
                        ds.Publictions.Items.Add(item);
                        RowDefinition rowDef1 = new RowDefinition();
                        RowDefinition rowDef2 = new RowDefinition();
                        RowDefinition rowDef3 = new RowDefinition();
                        RowDefinition rowDef4 = new RowDefinition();

                        abs = new PubAbstract(PubTitles.Tag as string, result.getAuthors());

                        item.Tag = "Title:  " + item.Content as string + "\r\n" + "\r\n" + "\r\n"

                                   + "Authors:   " + result.Authors.ElementAt(m) as string + "\r\n" + "\r\n"

                                   + "Abstract:" + "\r\n" + "\r\n"

                                   + abs.getAbstract() as string;

                        m += 1;
                        Console.WriteLine(m);

                        if (m > 20)
                        {
                            break;
                        }
                    }

                    /*foreach (String Titles in result.Titles)
                     * {
                     *  TextBlock Middle = new TextBlock();
                     *  Middle.Text = Titles;
                     *  //ds.Publications.Children.Add(Middle);
                     *  Grid.SetRow(Middle, m);
                     *  m += 1;
                     #endregion
                     * //publications location maybe
                     * //Creates a list of PubMed source related to the query
                     *
                     * }*/
                };
                _Publist = _progressBarWrapper.execute <String, PubList>(_GetPublications, _myRegDS.BasicInfo.DescriptionName, callback);
                #endregion
                SurfaceWindow1.addData(sender, ds);
            }
            else
            {
                Func <String, RegDataSheet> _getRegDataSheet =
                    delegate(String pName) { return(new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + pName)); };
                Action <RegDataSheet> _getRegDataSheetCallback = delegate(RegDataSheet _regDS)
                {
                    _myRegDS = _regDS;
                    #region Populating the data sheet's datasheet
                    //Specifies the Length of the Sequence on the Sequence tab of the data sheet
                    int       Length      = _myRegDS.BasicInfo.Length;
                    TextBlock LengthBlock = new TextBlock();
                    //ds.SeqTab.Children.Add(LengthBlock);
                    LengthBlock.VerticalAlignment = VerticalAlignment.Top;
                    LengthBlock.Text = "Length: " + Length.ToString();

                    //This is all pulling information from the Reg Data Sheet associated with the part and inserting it in the data sheet
                    ds.PopulateDataSheet(_myRegDS.Name, 0, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.DescriptionName, 1, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Type, 2, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Promoter.getReg(), 3, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.Availability, 4, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.Usefulness, 5, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Description.assembCompString(), 6, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Description.chassisString(), 7, 1, ds.DataSheet, "datasheet");

                    //Specific to sequence tab
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.Sequence, 1, 1, ds.SeqTab, "seq");
                    ds.PopulateDataSheet(Length.ToString(), 0, 1, ds.SeqTab, "length");

                    //Specific to AuthorInfo Tab
                    ds.PopulateDataSheet(_myRegDS.Reference.Author, 0, 1, ds.AuthorInfo, "author");
                    ds.PopulateDataSheet(_myRegDS.Reference.Group, 1, 1, ds.AuthorInfo, "author");
                    ds.PopulateDataSheet(_myRegDS.Reference.Date, 2, 1, ds.AuthorInfo, "author");

                    if (_myRegDS.Type == "rbs")
                    {
                        RowDefinition rowDef1 = new RowDefinition();
                        ds.DataSheet.RowDefinitions.Add(rowDef1);
                        ds.PopulateDataSheet(_myRegDS.Rbs.FamilyName, 8, 1, ds.DataSheet);
                        TextBlock RBSFam = new TextBlock();
                        RBSFam.Text              = "Family";
                        RBSFam.FontSize          = 14;
                        RBSFam.FontWeight        = FontWeights.Bold;
                        RBSFam.VerticalAlignment = VerticalAlignment.Top;
                        // COME BACK TO THIS LATER

                        ds.DataSheet.Children.Add(RBSFam);
                        Grid.SetRow(RBSFam, 8);
                    }
                    else if (_myRegDS.Type == "terminator")
                    {
                        RowDefinition rowDef1 = new RowDefinition();
                        RowDefinition rowDef2 = new RowDefinition();
                        RowDefinition rowDef3 = new RowDefinition();
                        RowDefinition rowDef4 = new RowDefinition();

                        ds.DataSheet.RowDefinitions.Add(rowDef1);
                        ds.DataSheet.RowDefinitions.Add(rowDef2);
                        ds.DataSheet.RowDefinitions.Add(rowDef3);
                        ds.DataSheet.RowDefinitions.Add(rowDef4);

                        TextBlock Direction = new TextBlock();
                        Direction.Text     = "Direction";
                        Direction.FontSize = 18;
                        ds.DataSheet.Children.Add(Direction);
                        Grid.SetRow(Direction, 8);

                        ds.PopulateDataSheet(_myRegDS.Terminators.Direction, 8, 1, ds.DataSheet);
                        ds.PopulateDataSheet(_myRegDS.Terminators.ForwardEff, 9, 1, ds.DataSheet);
                        ds.PopulateDataSheet(_myRegDS.Terminators.ReversedEff, 10, 1, ds.DataSheet);
                        ds.PopulateDataSheet(_myRegDS.Terminators.ReversedVers, 11, 1, ds.DataSheet);
                    }

                    #endregion

                    #region Populating Publications
                    Func <String, PubList> _GetPublications =
                        delegate(String id) { return(new PubList(id)); };
                    Action <PubList> callback = delegate(PubList result)
                    {
                        //_thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text);

                        int m = 0;

                        if (result.Titles.Count == 0)
                        {
                            int Count = result.Titles.Count;
                            SurfaceListBoxItem NoResults = new SurfaceListBoxItem();
                            TextBlock          Content   = new TextBlock();
                            Content.Text      = "No Results Found";
                            NoResults.Content = Content;
                            ds.Publictions.Items.Add(NoResults);
                        }

                        if (result.Titles.Count > 0)
                        {
                            int TotalArticles = result.Titles.Count;
                            SurfaceListBoxItem ArticleCount = new SurfaceListBoxItem();
                            TextBlock          CountContent = new TextBlock();
                            CountContent.Text    = "Results Found: " + TotalArticles as string;
                            ArticleCount.Content = CountContent;
                            ds.Publictions.Items.Add(ArticleCount);
                        }

                        foreach (String Titles in result.Titles)
                        {
                            //To Test if titles are actually adding
                            SurfaceListBoxItem item      = new SurfaceListBoxItem();
                            TextBlock          PubTitles = new TextBlock();
                            item.Selected += new RoutedEventHandler(item_Selected);
                            item.Content   = Titles;
                            PubTitles.Tag  = result.Links.ElementAt(m);
                            //item.Tag = result.Authors.ElementAt(m);
                            ds.Publictions.Items.Add(item);
                            RowDefinition rowDef1 = new RowDefinition();
                            RowDefinition rowDef2 = new RowDefinition();
                            RowDefinition rowDef3 = new RowDefinition();
                            RowDefinition rowDef4 = new RowDefinition();

                            abs = new PubAbstract(PubTitles.Tag as string, result.getAuthors());

                            item.Tag = "Title:  " + item.Content as string + "\r\n" + "\r\n" + "\r\n"

                                       + "Authors:   " + result.Authors.ElementAt(m) as string + "\r\n" + "\r\n"

                                       + "Abstract:" + "\r\n" + "\r\n"

                                       + abs.getAbstract() as string;

                            m += 1;
                            Console.WriteLine(m);

                            if (m > 20)
                            {
                                break;
                            }
                        }

                        /*foreach (String Titles in result.Titles)
                         * {
                         *  TextBlock Middle = new TextBlock();
                         *  Middle.Text = Titles;
                         *  //ds.Publications.Children.Add(Middle);
                         *  Grid.SetRow(Middle, m);
                         *  m += 1;
                         #endregion
                         * //publications location maybe
                         * //Creates a list of PubMed source related to the query
                         *
                         * }*/
                    };
                    _Publist = _progressBarWrapper.execute <String, PubList>(_GetPublications, _myRegDS.BasicInfo.DescriptionName, callback);
                    #endregion
                    SurfaceWindow1.addData(sender, ds);
                };
                _dataSheet = _progressBarWrapper.execute <String, RegDataSheet>(_getRegDataSheet, partName.Text, _getRegDataSheetCallback);
            }
        }
예제 #2
0
        private void select_DataSheet(object sender, RoutedEventArgs e)
        {
            //try
            //{
            //_thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text);

            ds = new MenuDataSheet();
            ds.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(onDSManipulationCompleted);

            if (_myRegDS.Name != "test") //Already got data from registry, so just populate from it
            {
                #region Populating the data sheet's datasheet
                //Specifies the Length of the Sequence on the Sequence tab of the data sheet
                int Length = _myRegDS.BasicInfo.Length;
                TextBlock LengthBlock = new TextBlock();
                //ds.SeqTab.Children.Add(LengthBlock);
                LengthBlock.VerticalAlignment = VerticalAlignment.Top;
                LengthBlock.Text = "Length: " + Length.ToString();

                //This is all pulling information from the Reg Data Sheet associated with the part and inserting it in the data sheet
                ds.PopulateDataSheet(_myRegDS.Name, 0, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.BasicInfo.DescriptionName, 1, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Type, 2, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Promoter.getReg(), 3, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.BasicInfo.Availability, 4, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.BasicInfo.Usefulness, 5, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Description.assembCompString(), 6, 1, ds.DataSheet, "datasheet");
                ds.PopulateDataSheet(_myRegDS.Description.chassisString(), 7, 1, ds.DataSheet, "datasheet");

                

                //Specific to sequence tab
                ds.PopulateDataSheet(_myRegDS.BasicInfo.Sequence, 1, 1, ds.SeqTab, "seq");
                ds.PopulateDataSheet(Length.ToString(), 0, 1, ds.SeqTab, "length");

                //Specific to AuthorInfo Tab
                ds.PopulateDataSheet(_myRegDS.Reference.Author, 0, 1, ds.AuthorInfo, "author");
                ds.PopulateDataSheet(_myRegDS.Reference.Group, 1, 1, ds.AuthorInfo, "author");
                ds.PopulateDataSheet(_myRegDS.Reference.Date, 2, 1, ds.AuthorInfo, "author");

                if (_myRegDS.Type == "rbs")
                {
                    RowDefinition rowDef1 = new RowDefinition();
                    ds.DataSheet.RowDefinitions.Add(rowDef1);
                    ds.PopulateDataSheet(_myRegDS.Rbs.FamilyName, 8, 1, ds.DataSheet);
                    TextBlock RBSFam = new TextBlock();
                    RBSFam.Text = "Family";
                    ds.DataSheet.Children.Add(RBSFam);
                    Grid.SetRow(RBSFam, 8);
                }
                else if (_myRegDS.Type == "terminator")
                {
                    RowDefinition rowDef1 = new RowDefinition();
                    RowDefinition rowDef2 = new RowDefinition();
                    RowDefinition rowDef3 = new RowDefinition();
                    RowDefinition rowDef4 = new RowDefinition();

                    ds.DataSheet.RowDefinitions.Add(rowDef1);
                    ds.DataSheet.RowDefinitions.Add(rowDef2);
                    ds.DataSheet.RowDefinitions.Add(rowDef3);
                    ds.DataSheet.RowDefinitions.Add(rowDef4);

                    TextBlock Direction = new TextBlock();
                    Direction.Text = "Direction";
                    Direction.FontSize = 18;
                    ds.DataSheet.Children.Add(Direction);
                    Grid.SetRow(Direction, 8);

                    ds.PopulateDataSheet(_myRegDS.Terminators.Direction, 8, 1, ds.DataSheet);
                    ds.PopulateDataSheet(_myRegDS.Terminators.ForwardEff, 9, 1, ds.DataSheet);
                    ds.PopulateDataSheet(_myRegDS.Terminators.ReversedEff, 10, 1, ds.DataSheet);
                    ds.PopulateDataSheet(_myRegDS.Terminators.ReversedVers, 11, 1, ds.DataSheet);
                }

                #endregion

                #region Populating Publications
                Func<String, PubList> _GetPublications =
                        delegate(String id) { return new PubList(id); };
                Action<PubList> callback = delegate(PubList result)
                {
                    //_thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text);

                    int m = 0;

                    if (result.Titles.Count == 0)
                    {
                        int Count = result.Titles.Count;
                        SurfaceListBoxItem NoResults = new SurfaceListBoxItem();
                        TextBlock Content = new TextBlock();
                        Content.Text = "No Results Found";
                        NoResults.Content = Content;
                        ds.Publictions.Items.Add(NoResults);
                    }

                    if (result.Titles.Count > 0)
                    {
                        int TotalArticles = result.Titles.Count;
                        SurfaceListBoxItem ArticleCount = new SurfaceListBoxItem();
                        TextBlock CountContent = new TextBlock();
                        CountContent.Text = "Results Found: " + TotalArticles as string;
                        ArticleCount.Content = CountContent;
                        ds.Publictions.Items.Add(ArticleCount);
                    }

                    foreach (String Titles in result.Titles)
                    {

                        //To Test if titles are actually adding
                        SurfaceListBoxItem item = new SurfaceListBoxItem();
                        TextBlock PubTitles = new TextBlock();
                        item.Selected += new RoutedEventHandler(item_Selected);
                        item.Content = Titles;
                        PubTitles.Tag = result.Links.ElementAt(m);
                        //item.Tag = result.Authors.ElementAt(m); 
                        ds.Publictions.Items.Add(item);
                        RowDefinition rowDef1 = new RowDefinition();
                        RowDefinition rowDef2 = new RowDefinition();
                        RowDefinition rowDef3 = new RowDefinition();
                        RowDefinition rowDef4 = new RowDefinition();

                        abs = new PubAbstract(PubTitles.Tag as string, result.getAuthors());

                        item.Tag = "Title:  " + item.Content as string + "\r\n" + "\r\n" + "\r\n"

                            + "Authors:   " + result.Authors.ElementAt(m) as string + "\r\n" + "\r\n"

                            + "Abstract:" + "\r\n" + "\r\n"

                            + abs.getAbstract() as string;

                        m += 1;
                        Console.WriteLine(m);

                        if (m > 20)
                            break;
                    }

                    /*foreach (String Titles in result.Titles)
                    {
                        TextBlock Middle = new TextBlock();
                        Middle.Text = Titles;
                        //ds.Publications.Children.Add(Middle);
                        Grid.SetRow(Middle, m);
                        m += 1; 
            #endregion
            //publications location maybe
            //Creates a list of PubMed source related to the query

                    }*/
                };
                _Publist = _progressBarWrapper.execute<String, PubList>(_GetPublications, _myRegDS.BasicInfo.DescriptionName, callback);
        #endregion
                SurfaceWindow1.addData(sender, ds);
            }
            else
            {
                Func<String, RegDataSheet> _getRegDataSheet =
                delegate(String pName) { return new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + pName); };
                Action<RegDataSheet> _getRegDataSheetCallback = delegate(RegDataSheet _regDS)
                {
                    _myRegDS = _regDS;
                    #region Populating the data sheet's datasheet
                    //Specifies the Length of the Sequence on the Sequence tab of the data sheet
                    int Length = _myRegDS.BasicInfo.Length;
                    TextBlock LengthBlock = new TextBlock();
                    //ds.SeqTab.Children.Add(LengthBlock);
                    LengthBlock.VerticalAlignment = VerticalAlignment.Top;
                    LengthBlock.Text = "Length: " + Length.ToString();

                    //This is all pulling information from the Reg Data Sheet associated with the part and inserting it in the data sheet
                    ds.PopulateDataSheet(_myRegDS.Name, 0, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.DescriptionName, 1, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Type, 2, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Promoter.getReg(), 3, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.Availability, 4, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.Usefulness, 5, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Description.assembCompString(), 6, 1, ds.DataSheet, "datasheet");
                    ds.PopulateDataSheet(_myRegDS.Description.chassisString(), 7, 1, ds.DataSheet, "datasheet");

                    //Specific to sequence tab
                    ds.PopulateDataSheet(_myRegDS.BasicInfo.Sequence, 1, 1, ds.SeqTab, "seq");
                    ds.PopulateDataSheet(Length.ToString(), 0, 1, ds.SeqTab, "length");

                    //Specific to AuthorInfo Tab
                    ds.PopulateDataSheet(_myRegDS.Reference.Author, 0, 1, ds.AuthorInfo, "author");
                    ds.PopulateDataSheet(_myRegDS.Reference.Group, 1, 1, ds.AuthorInfo, "author");
                    ds.PopulateDataSheet(_myRegDS.Reference.Date, 2, 1, ds.AuthorInfo, "author");

                    if (_myRegDS.Type == "rbs")
                    {
                        RowDefinition rowDef1 = new RowDefinition();
                        ds.DataSheet.RowDefinitions.Add(rowDef1);
                        ds.PopulateDataSheet(_myRegDS.Rbs.FamilyName, 8, 1, ds.DataSheet);
                        TextBlock RBSFam = new TextBlock();
                        RBSFam.Text = "Family";
                        RBSFam.FontSize= 14;
                        RBSFam.FontWeight = FontWeights.Bold;
                        RBSFam.VerticalAlignment = VerticalAlignment.Top;
                        // COME BACK TO THIS LATER

                        ds.DataSheet.Children.Add(RBSFam);
                        Grid.SetRow(RBSFam, 8);
                    }
                    else if (_myRegDS.Type == "terminator")
                    {
                        RowDefinition rowDef1 = new RowDefinition();
                        RowDefinition rowDef2 = new RowDefinition();
                        RowDefinition rowDef3 = new RowDefinition();
                        RowDefinition rowDef4 = new RowDefinition();

                        ds.DataSheet.RowDefinitions.Add(rowDef1);
                        ds.DataSheet.RowDefinitions.Add(rowDef2);
                        ds.DataSheet.RowDefinitions.Add(rowDef3);
                        ds.DataSheet.RowDefinitions.Add(rowDef4);

                        TextBlock Direction = new TextBlock();
                        Direction.Text = "Direction";
                        Direction.FontSize = 18;
                        ds.DataSheet.Children.Add(Direction);
                        Grid.SetRow(Direction, 8);

                        ds.PopulateDataSheet(_myRegDS.Terminators.Direction, 8, 1, ds.DataSheet);
                        ds.PopulateDataSheet(_myRegDS.Terminators.ForwardEff, 9, 1, ds.DataSheet);
                        ds.PopulateDataSheet(_myRegDS.Terminators.ReversedEff, 10, 1, ds.DataSheet);
                        ds.PopulateDataSheet(_myRegDS.Terminators.ReversedVers, 11, 1, ds.DataSheet);
                    }

                    #endregion

                    #region Populating Publications
                    Func<String, PubList> _GetPublications =
                            delegate(String id) { return new PubList(id); };
                    Action<PubList> callback = delegate(PubList result)
                    {
                        //_thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text);

                        int m = 0;

                        if (result.Titles.Count == 0)
                        {
                            int Count = result.Titles.Count;
                            SurfaceListBoxItem NoResults = new SurfaceListBoxItem();
                            TextBlock Content = new TextBlock();
                            Content.Text = "No Results Found";
                            NoResults.Content = Content;
                            ds.Publictions.Items.Add(NoResults);
                        }

                        if (result.Titles.Count > 0)
                        {
                            int TotalArticles = result.Titles.Count;
                            SurfaceListBoxItem ArticleCount = new SurfaceListBoxItem();
                            TextBlock CountContent = new TextBlock();
                            CountContent.Text = "Results Found: " + TotalArticles as string;
                            ArticleCount.Content = CountContent;
                            ds.Publictions.Items.Add(ArticleCount);
                        }

                        foreach (String Titles in result.Titles)
                        {

                            //To Test if titles are actually adding
                            SurfaceListBoxItem item = new SurfaceListBoxItem();
                            TextBlock PubTitles = new TextBlock();
                            item.Selected += new RoutedEventHandler(item_Selected);
                            item.Content = Titles;
                            PubTitles.Tag = result.Links.ElementAt(m);
                            //item.Tag = result.Authors.ElementAt(m); 
                            ds.Publictions.Items.Add(item);
                            RowDefinition rowDef1 = new RowDefinition();
                            RowDefinition rowDef2 = new RowDefinition();
                            RowDefinition rowDef3 = new RowDefinition();
                            RowDefinition rowDef4 = new RowDefinition();

                            abs = new PubAbstract(PubTitles.Tag as string, result.getAuthors());

                            item.Tag = "Title:  " + item.Content as string + "\r\n" + "\r\n" + "\r\n"

                                + "Authors:   " + result.Authors.ElementAt(m) as string + "\r\n" + "\r\n"

                                + "Abstract:" + "\r\n" + "\r\n"

                                + abs.getAbstract() as string;

                            m += 1;
                            Console.WriteLine(m);

                            if (m > 20)
                                break;
                        }

                        /*foreach (String Titles in result.Titles)
                        {
                            TextBlock Middle = new TextBlock();
                            Middle.Text = Titles;
                            //ds.Publications.Children.Add(Middle);
                            Grid.SetRow(Middle, m);
                            m += 1; 
                #endregion
                //publications location maybe
                //Creates a list of PubMed source related to the query

                        }*/
                    };
                    _Publist = _progressBarWrapper.execute<String, PubList>(_GetPublications, _myRegDS.BasicInfo.DescriptionName, callback);
        #endregion
                    SurfaceWindow1.addData(sender, ds);
                };
                _dataSheet = _progressBarWrapper.execute<String, RegDataSheet>(_getRegDataSheet, partName.Text, _getRegDataSheetCallback);
            }
        }