Ejemplo n.º 1
0
		/// <summary>
		/// Adds scope node to the scope tree
		/// </summary>
		internal ScopeNode AddScopeNode(ScopeNode parent, string text, Icon largeIcon, Icon smallIcon, ResultViewControl resultView, NodeType nodeType, object tag)
		{
			string smallIconName = smallIcon.GetHashCode().ToString();
			if (!this.smallImages.Images.ContainsKey(smallIconName))
			{
				this.smallImages.Images.Add(smallIconName, smallIcon);
			}
			ScopeNode node = new ScopeNode();
			node.Text = text;
			node.ResultView = resultView;
			node.SmallIcon = smallIcon;
			node.LargeIcon = largeIcon;
			node.ImageKey = smallIconName;
			node.SelectedImageKey = smallIconName;
			node.NodeType = nodeType;
			node.Populated = false;
			node.Tag = tag;
			if (parent == null)
			{
				scopeTree.Nodes.Add(node);
			}
			else
			{
				parent.Nodes.Add(node);
			}
			//add fake node to show +
			node.Nodes.Add(" ");
			return node;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Loads installed components from configuration file
		/// </summary>
		private void LoadInstalledComponents(ScopeNode node)
		{
			Log.WriteStart("Loading installed components");
			node.Nodes.Clear();

			foreach (ComponentConfigElement componentConfig in AppConfigManager.AppConfiguration.Components)
			{
				string instance = string.Empty;
				if (componentConfig.Settings["Instance"] != null &&
					!string.IsNullOrEmpty(componentConfig.Settings["Instance"].Value))
				{
					instance = "(" + componentConfig.Settings["Instance"].Value + ")";
				}
				string title = string.Format("{0} {1} {2} {3}",
					componentConfig.Settings["ApplicationName"].Value,
					componentConfig.Settings["ComponentName"].Value,
					componentConfig.Settings["Release"].Value,
					instance);

				AddComponentNode(node, title, componentConfig);
			}
			node.Populated = true;
			Log.WriteEnd(string.Format("{0} installed component(s) loaded", AppConfigManager.AppConfiguration.Components.Count));
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Displays result view control
		/// </summary>
		/// <param name="parentNode"></param>
		private void PopulateResultView(ScopeNode parentNode)
		{
			this.SuspendLayout();
			pnlResultView.Controls.Clear();
			if (parentNode.LargeIcon != null)
			{
				pictureBox.Image = parentNode.LargeIcon.ToBitmap();
			}
			else
			{
				pictureBox.Image = Properties.Resources.Folder32.ToBitmap();
			}
			lblResultViewTitle.Text = parentNode.Text;
			lblResultViewPath.Text = parentNode.FullPath;
			ResultViewControl control = parentNode.ResultView;
			if (control != null)
			{
				pnlResultView.Controls.Add(control);
				control.Dock = DockStyle.Fill;
				try
				{
					AppContext context = new AppContext();
					context.AppForm = this;
					context.ScopeNode = parentNode;
					control.ShowControl(context);
				}
				catch (Exception ex)
				{
					Log.WriteError("Console error", ex);
					ShowError(ex);
				}
			}
			this.ResumeLayout(false);
			this.PerformLayout();
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Expands scope node in the scope tree
		/// </summary>
		private void ExpandScopeNode(ScopeNode node)
		{
			if (node != null)
			{
				if (!node.Populated)
				{
					node.Nodes.Clear();
					StartProgress("Loading...");
					string text = node.Text;
					node.Text += " expanding...";
					scopeTree.Update();
					scopeTree.BeginUpdate();
					switch (node.NodeType)
					{
						/*case NodeType.Servers:
							LoadServers(node);
							break;
						case NodeType.Server:
							LoadServerComponents(node);
							break;*/
						case NodeType.Components:
							LoadInstalledComponents(node);
							break;
					}
					node.Text = text;
					node.Populated = true;
					node.Expand();
					scopeTree.EndUpdate();
					FinishProgress();
				}
			}
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Actions on select node in the scope tree
		/// </summary>
		private void OnScopeTreeAfterSelect(object sender, TreeViewEventArgs e)
		{
			ScopeNode node = e.Node as ScopeNode;
			//node.ContextMenuStrip = scopeItemContextMenu;
			ExpandScopeNode(node);
			PopulateResultView(node);
			activeScopeNode = node;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Adds component node to the scope tree
		/// </summary>
		internal ScopeNode AddComponentNode(ScopeNode parent, string text, object tag)
		{
			return AddScopeNode(parent, text, Properties.Resources.Service32, Properties.Resources.Service16, new ComponentControl(), NodeType.Component, tag);
		}