public override void DoWindowContents(Rect inRect)
        {
            string selectedExp          = "";
            string selectedExpType      = "";
            string recipeDescription    = "Invalid Recipe Combination.";
            bool   isExperimentSelected = false;

            //title
            Rect rect1 = new Rect(inRect.center.x - 80f, inRect.yMin + 35f, 200f, 74f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect1, "Experiment Setup");

            // Exit button
            Rect exitRect = new Rect(inRect.xMax - 50f, inRect.yMin + 5f, 50f, 30f);

            if (Widgets.ButtonText(exitRect, "Exit"))
            {
                this.Close();
            }

            // explain text
            Rect rect2 = new Rect(inRect);

            rect2.yMin  = rect1.yMax;
            rect2.yMax -= 38f;
            Text.Font   = GameFont.Small;
            Widgets.Label(rect2, "You can perform different types and sizes of experiments here, determining what kind of research you can unlock. The size of the research helps increase your chances of obtaining better research.");

            // 'select experiment' list
            Rect AddExpRect = new Rect(rect2);

            AddExpRect.width   = 550f;//275f;
            AddExpRect.height /= 2;
            AddExpRect.y      += 70f;
            AddExpRect.x      += 370f;

            //ExpList.DrawTextList(AddExpRect, _experimentNames, "Experiment Types");
            selectedExp = ExpList.SelectedEntry != null ? ExpList.SelectedEntry.EntryLabel : "None Selected";
            ExpList.DrawImageList(AddExpRect, "Experiment Types");

            // 'select type' list
            Rect AddExpTypeRect = new Rect(AddExpRect);

            AddExpTypeRect.x -= 310f;
            //AddExpTypeRect.ContractedBy(20f);
            AddExpTypeRect.width = 550f;//275f;
            //AddExpTypeRect.y += 20f;

            //ExpTypeList.DrawTextList(AddExpTypeRect, _experimentTypes, "Experiment Sizes");
            selectedExpType = ExpTypeList.SelectedEntry != null ? ExpTypeList.SelectedEntry.EntryLabel : "";
            ExpTypeList.DrawImageList(AddExpTypeRect, "Experiment Sizes");

            // need to get defName of recipe from this point
            _selectedExperimentDefName = selectedExpType + selectedExp;

            if (!(from t in DefDatabase <RecipeDef> .AllDefsListForReading where t.defName == _selectedExperimentDefName select t).TryRandomElement(out RecipeDef finalDef))
            {
                //Log.Error("Def not found");
                isExperimentSelected = false;
            }
            else
            {
                isExperimentSelected = true;
                _selectedRecipe      = finalDef;
                recipeDescription    = _selectedRecipe.description;
            }

            // text explaining selection, e.g. 'Small Biological Research Project - will help unlock biological research'
            Rect rect3 = new Rect(inRect.position, rect2.size);

            rect3.x   = inRect.center.x - 150f;
            rect3.y   = inRect.yMax - 100f;
            Text.Font = GameFont.Medium;
            Widgets.Label(rect3, _selectedExperimentDefName);

            Text.Font = GameFont.Small;
            Rect rect4 = rect3;

            rect4.x = inRect.x;
            rect4.y = inRect.yMax - 210f;
            Widgets.Label(rect4, recipeDescription);

            Rect rect5 = rect4;

            rect5.x = inRect.x;
            rect5.y = inRect.yMax - 160f;
            if (_selectedRecipe.HasModExtension <ResearchDefModExtension>())
            {
                Widgets.Label(rect5, "Potential Research Projects left to discover: " + LoreComputerHarmonyPatches.GetNumOfUnfoundProjsByRecipe(_selectedRecipe));
            }

            // confirm button
            Rect rect6 = new Rect(inRect.center.x - 100f, inRect.yMax - 35f, 150f, 29f);

            if (Widgets.ButtonText(rect6, "Confirm Experiment"))
            {
                if (isExperimentSelected == true)
                {
                    // TODO: change the assumption above to something less naive
                    Bill       newExpBill = (Bill_ProductionWithUft)_selectedRecipe.MakeNewBill();
                    Experiment newExp     = MakeNewExperiment();
                    _selectedTable.ExpStack.AddExperiment(newExp);
                    _selectedTable.ExpStack.AddExperimentWithBill(newExpBill);
                    isExperimentSelected = false;
                    this.Close();
                }
                else
                {
                    Dialog_MessageBox window = Dialog_MessageBox.CreateConfirmation("No Experiment Selected", delegate
                    {
                    }, destructive: true);
                    Find.WindowStack.Add(window);
                }
            }
            // exit button?
        }
        public override void DoWindowContents(Rect inRect)
        {
            Thing  selectedExperiment     = null;
            string selectedExperimentName = "";
            Pawn   selectedPawn           = null;
            bool   isExperimentSelected   = false;

            RecipeDef selectedRecipeDef = null;

            selectedRecipeDef = DefDatabase <RecipeDef> .AllDefsListForReading[0];

            //title
            Rect rect1 = new Rect(inRect.center.x - 70f, inRect.yMin + 35f, 200f, 74f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect1, "Study Setup");

            // Exit button
            Rect exitRect = new Rect(inRect.xMax - 50f, inRect.yMin + 5f, 50f, 30f);

            if (Widgets.ButtonText(exitRect, "Exit"))
            {
                this.Close();
            }

            // explain text
            Rect rect2 = new Rect(inRect);

            rect2.yMin  = rect1.yMax;
            rect2.yMax -= 38f;
            Text.Font   = GameFont.Small;
            Widgets.Label(rect2, "Here you can choose an experiment for a colonist to study. Studying experiments will enable your colony to better retain its scientific knowledge. Any colonist can study a research project, however those with lower intellectual skills will take a much longer time to complete their studies.");

            // 'select experiment' list
            Rect AddExpRect = new Rect(rect2);

            AddExpRect.width   = 550f;//275f;
            AddExpRect.height /= 2;
            AddExpRect.y      += 70f;
            AddExpRect.x      += 370f;


            if (_finishedExperimentList.Count == 0)
            {
                var list = new List <string>();
                list.Add("No experiments");
                _expsInColony.DrawTextList(AddExpRect, list, "No experiments in Colony");
                isExperimentSelected = false;
            }
            else
            {
                selectedExperiment     = _expsInColony.SelectedEntry != null ? _expsInColony.SelectedEntry.EntryAttachedThing : null;
                selectedExperimentName = _expsInColony.SelectedEntry?.EntryLabel;
                _expsInColony.DrawTextListWithAttachedThing(AddExpRect, _finishedExperimentList, "All Experiments In Colony");
            }

            // 'select researcher' list
            Rect AddPawnRect = new Rect(AddExpRect);

            AddPawnRect.x -= 310f;
            //AddPawnRect.ContractedBy(30f);
            AddPawnRect.width = 550f;//275f;

            if (_pawnsInColony.Count == 0)
            {
                var list = new List <string>();
                list.Add("No researchers");
                _expsInColony.DrawTextList(AddExpRect, list, "No researchers in Colony");
                isExperimentSelected = false;
            }
            else
            {
                selectedPawn = (Pawn)_colonyResearchers.SelectedEntry?.EntryAttachedThing;
                _colonyResearchers.DrawTextListWithAttachedThing(AddPawnRect, _pawnsInColony, "Researchers In Colony");
            }


            // need to get defName of recipe from this point
            string _selectedOption = selectedPawn?.Name.ToString() + " will study: " + selectedExperimentName;


            string warningText = "";

            if (selectedPawn != null)
            {
                warningText = selectedPawn.Name.ToString() + " is a colony researcher with a skill of: " + selectedPawn.skills.GetSkill(SkillDefOf.Intellectual).levelInt;
            }

            // text explaining selected pawn and topic
            Rect rect3 = new Rect(inRect.position, rect2.size);

            rect3.x   = inRect.center.x - 300f;
            rect3.y   = inRect.yMax - 100f;
            Text.Font = GameFont.Medium;
            Widgets.Label(rect3, _selectedOption);

            // optional warning text for pawns with no research / already studied topic
            Text.Font = GameFont.Small;
            Rect rect4 = rect3;

            rect4.x = inRect.x;
            rect4.y = inRect.yMax - 210f;
            Widgets.Label(rect4, warningText);

            // get recipe def
            if (!(from t in DefDatabase <RecipeDef> .AllDefsListForReading where t.defName == "StudyFinishedExperiment" select t).TryRandomElement(out RecipeDef finalDef))
            {
                //Log.Error("Def not found");
            }
            else
            {
                selectedRecipeDef = finalDef;
            }

            if (selectedPawn != null && selectedExperimentName != "")
            {
                isExperimentSelected = true;
            }

            Rect rect5 = rect4;

            rect5.x = inRect.x;
            rect5.y = inRect.yMax - 180f;

            // confirm button
            Rect rect6 = new Rect(inRect.center.x - 80f, inRect.yMax - 35f, 150f, 29f);

            if (Widgets.ButtonText(rect6, "Confirm Study"))
            {
                if (isExperimentSelected == true)
                {
                    Experiment newStudy = new Experiment(selectedRecipeDef);
                    Bill       newBill  = (Bill_Production)selectedRecipeDef.MakeNewBill();

                    newStudy.uniquePawnDoer = selectedPawn;
                    newStudy.uniqueThingIng = selectedExperiment;
                    _selectedTable.ExpStack.AddExperiment(newStudy);
                    _selectedTable.ExpStack.AddExperimentWithBill(newBill);
                    newBill.pawnRestriction = selectedPawn;
                    selectedExperiment.def.GetModExtension <ResearchDefModExtension>().ResearchDefAttachedToExperiment = selectedExperimentName;
                    isExperimentSelected = false;
                    this.Close();
                }
                else
                {
                    Dialog_MessageBox window = Dialog_MessageBox.CreateConfirmation("No Study Option Selected", delegate
                    {
                    }, destructive: true);
                    Find.WindowStack.Add(window);
                }
            }
        }