Exemplo n.º 1
0
        // Change body view to Research section when "RESEARCH" is clicked
        private void research_btn_Click(object sender, EventArgs e)
        {
            processButtons(sender);

            body.SelectedTab = research_tab;

            // Ensure we have the data, fetch if we don't
            if (research == null)
            {
                Console.WriteLine("Loading research...");
                string jsonResearch = rj.getRestJSON("/research/");
                research = JToken.Parse(jsonResearch).ToObject <Research>();

                // Dynamically load research by interest area
                int row    = 0;
                int column = 0;
                for (int i = 0; i < research.byInterestArea.Count; i++)
                {
                    ByInterestArea area = research.byInterestArea[i];

                    Label areaName = new Label();
                    areaName.Text        = area.areaName;
                    areaName.MouseEnter += (sender2, e2) => changeCellColor(sender2, e2);
                    areaName.MouseLeave += (sender3, e3) => changeCellColor(sender3, e3);
                    areaName.Margin      = new Padding(0, 0, areaName.Margin.Right, areaName.Margin.Right);
                    areaName.BorderStyle = BorderStyle.FixedSingle;
                    areaName.TextAlign   = ContentAlignment.MiddleCenter;
                    areaName.Anchor      = (AnchorStyles.Left | AnchorStyles.Right);

                    interestareas.Controls.Add(areaName, column, row);

                    // Set onclick event handler to show degree details in popup
                    areaName.Click += (sender4, e4) => showResearchPopup(sender4, e4, area);

                    // Jump to next row if current row is full
                    if ((i + 1) % 3 == 0)
                    {
                        row++;
                        column = 0;
                    }
                    else
                    {
                        column++;
                    }
                }

                // Resize rows
                foreach (RowStyle style in interestareas.RowStyles)
                {
                    style.SizeType = SizeType.AutoSize;
                }
            }
        }
Exemplo n.º 2
0
        // Popup for Research by interest area
        private void showResearchPopup(object sender4, EventArgs e4, ByInterestArea area)
        {
            Popup popup = new Popup(area);

            popup.Show();
        }
Exemplo n.º 3
0
 // Constructs popup for Research by interest area
 public Popup(ByInterestArea area)
 {
     InitializeComponent();
     researchByInterestArea = area;
 }