Ejemplo n.º 1
0
        // Popup for ug minors
        private void showUgMinorPopup(object sender2, EventArgs e2, UgMinor ugMinor)
        {
            // Populate popup with data
            Popup popup = new Popup(ugMinor);

            popup.Show();
        }
Ejemplo n.º 2
0
        // Load minors data when entering "Minors" tab for the first time
        private void tabControl3_Enter(object sender, EventArgs e)
        {
            // Ensure we have the data, fetch if we don't
            if (minors == null)
            {
                Console.WriteLine("Loading minors...");
                string jsonMinors = rj.getRestJSON("/minors/");
                minors = JToken.Parse(jsonMinors).ToObject <Minors>();

                // Dynamically load minors
                int row    = 0;
                int column = 0;
                for (int i = 0; i < minors.UgMinors.Count; i++)
                {
                    UgMinor thisMinor = minors.UgMinors[i];
                    // Minor title
                    Label minorTitle = new Label();
                    minorTitle.Text        = thisMinor.title;
                    minorTitle.MouseEnter += (sender2, e2) => changeCellColor(sender2, e2);
                    minorTitle.MouseLeave += (sender3, e3) => changeCellColor(sender3, e3);
                    minorTitle.Margin      = new Padding(0, 0, minorTitle.Margin.Right, minorTitle.Margin.Right);
                    minorTitle.BorderStyle = BorderStyle.FixedSingle;
                    minorTitle.TextAlign   = ContentAlignment.MiddleCenter;
                    minorTitle.Anchor      = (AnchorStyles.Left | AnchorStyles.Right);

                    // Add components to degree panel, then to main panel
                    ug_minors.Controls.Add(minorTitle, column, row);

                    // Set onclick event handler to show degree details in popup
                    minorTitle.Click += (sender4, e4) => showUgMinorPopup(sender4, e4, thisMinor);

                    // 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 ug_minors.RowStyles)
                {
                    style.SizeType = SizeType.AutoSize;
                }
            }
        }
Ejemplo n.º 3
0
 // Constructs popup for Undergraduate minor
 public Popup(UgMinor ugMinor)
 {
     InitializeComponent();
     thisUgMinor = ugMinor;
 }