Exemple #1
0
 private void LoadItems()
 {
     foreach (var configFile in Directory
              .GetFiles(_rootPath, "*.xml")
              .Where(filePath => !GroupConfigFileName.Equals(Path.GetFileName(filePath), StringComparison.OrdinalIgnoreCase)))
     {
         Items.Add(TabGroupItem.Create(configFile));
     }
 }
Exemple #2
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 #3
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;
		}