Exemple #1
0
		public OptionsWindow(MainWindow mainWindow)
		{
			InitializeComponent();

			mMainWindow = mainWindow;
			mCurrentPanel = null;
			mOptionsPanels = new List<OptionsPanel>();

			foreach(IOptions options in mMainWindow.Manager.OptionsManager.Options)
			{
				OptionsCollectionAttribute attr = OptionsCollectionAttribute.ForType(options.GetType());
				OptionsPanel panel = Activator.CreateInstance(attr.Editor, new object[] { mMainWindow.Manager, options }) as OptionsPanel;

				AddPanel(panel, attr.Path);
			}
		}
Exemple #2
0
		private void AddPanel(OptionsPanel panel, string panelPath)
		{
			mOptionsPanels.Add(panel);

			string[] fullpath = panelPath.Split(new char[] { '/' });
			string [] path = new string[fullpath.Length - 1];
			Array.Copy(fullpath, path, path.Length);
			string name = fullpath[fullpath.Length - 1];

			TreeNode node = new TreeNode(name);
			node.Name = panelPath;
			node.Tag = panel;

			TreeNode root = null;
			foreach(string folder in path)
			{
				if(root == null)
				{
					if(pagesTree.Nodes.ContainsKey(folder))
						root = pagesTree.Nodes[folder];
					else
						root = pagesTree.Nodes.Add(folder, folder);
				}
				else
				{
					if(root.Nodes.ContainsKey(folder))
						root = root.Nodes[folder];
					else
						root = root.Nodes.Add(folder, folder);
				}
			}

			if (root == null)
			{
				pagesTree.Nodes.Add(node);
			}
			else
			{
				root.Nodes.Add(node);
			}
		}
Exemple #3
0
		private void ShowPanel(OptionsPanel panel)
		{
			if(mCurrentPanel != null)
				optionsPanel.Controls.Remove(mCurrentPanel);

			mCurrentPanel = panel;

			if(mCurrentPanel != null)
			{
				optionsPanel.Controls.Add(mCurrentPanel);
				mCurrentPanel.Dock = DockStyle.Fill;
				mCurrentPanel.Show();
			}

			optionsPanel.PerformLayout();
		}