Пример #1
0
 public static string ToDescriptionString(this MainFormPanels val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val
                                         .GetType()
                                         .GetField(val.ToString())
                                         .GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }
Пример #2
0
        public void displayMainFormPanel(MainFormPanels mainFormPanel)
        {
            hideAllMainFormPanels();
            Control control = getMainFormPanelByName(mainFormPanel);

            control.Visible = true;
            showMainForm();
        }
Пример #3
0
        public Control getMainFormPanelByName(MainFormPanels mainFormPanel)
        {
            string  panelName = mainFormPanel.ToDescriptionString();
            Control control   = mainFormPanels.Find(c => c.Name.Equals(panelName));

            if (control is null)
            {
                throw new Exception("Panel '" + panelName + "' not found");
            }
            return(control);
        }