Пример #1
0
        internal bool AddNewFeature(string featureName, bool featureEnabled, [CallerMemberName] string memberName = "")
        {
            IConfigurationManager configuration = new ConfigurationFile();
            ButtonFeature         feature       = new ButtonFeature(configuration);

            if (feature.IsButtonEnabled("isButtonBlue"))
            {
                return(feature.SetButtonFeature(featureName, featureEnabled));
            }
            else if (!feature.IsButtonEnabled("isButtonBlue") && memberName == "ABC")
            {
                feature.SetButtonFeature("isButtonBlue", true);
                return(feature.SetButtonFeature(featureName, featureEnabled));
            }
            else if (feature.IsButtonEnabled("isButtonGreen"))
            {
                return(feature.SetButtonFeature(featureName, featureEnabled));
            }
            else if (feature.IsButtonEnabled("isButtonRed") && memberName != "ABC")
            {
                return(feature.SetButtonFeature(featureName, featureEnabled));
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            me          = Program.me;
            lbName.Text = me.name;
            imageAvatar.LoadAsync(me.avatar);


            List <string> data_title = new List <string>()
            {
                "Dashboard", "Books", "Users", "Censorship"
            };
            List <Image> data_icon = new List <Image>()
            {
                Properties.Resources.icon_dashboard, Properties.Resources.icon_books, Properties.Resources.icon_users, Properties.Resources.icon_censor
            };
            List <string> data_tag = new List <string>()
            {
                "DB", "B", "U", "CS"
            };

            for (int i = 0; i < data_title.Count; i++)
            {
                ButtonFeature btn = new ButtonFeature();
                btn.btnFeature.Text = data_title[i];
                btn.LoadImage(data_icon[i]);
                btn.btnFeature.Tag    = data_tag[i];
                btn.btnFeature.Click += new System.EventHandler(this.btnMenu_Click);
                pnFeature.Controls.Add(btn);
            }
        }