Exemple #1
0
        private void OpenLink(TabGroupItem barItemConfig)
        {
            var isAllowed = barItemConfig.UserGranted;

            if (isAllowed && !String.IsNullOrEmpty(barItemConfig.Password))
            {
                using (var form = new FormPassword(barItemConfig.Password, barItemConfig.Title))
                {
                    var result = form.ShowDialog(this);
                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }
                    isAllowed = result == DialogResult.OK;
                }
            }
            if (!isAllowed)
            {
                MessageBox.Show(this,
                                "You are not authorized to access this feature",
                                "Not authorized",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }
            barItemConfig.Open();
        }
Exemple #2
0
        private ButtonItem CreateButtonItem(TabGroupItem barItemConfig)
        {
            var buttonItem = new ButtonItem
            {
                Image         = barItemConfig.Image,
                Style         = eDotNetBarStyle.Metro,
                ThemeAware    = false,
                Enabled       = !AppManager.Instance.Settings.Config.DisableNonAvailableButtons || barItemConfig.UserGranted,
                ImagePosition = eImagePosition.Top
            };

            if (!String.IsNullOrEmpty(barItemConfig.Tooltip))
            {
                buttonItem.Tooltip = barItemConfig.Tooltip;
            }

            buttonItem.Click += (o, args) => OpenLink(barItemConfig);
            return(buttonItem);
        }