- Main Page
- Packages
- Classes
- Files

- File List
- File Members

# D:/guillaume/guillara/3D/DXGfx/Editor/ReferencesDialog.cs

Go to the documentation of this file.

    00001 using System;
    00002 using System.Collections.Generic;
    00003 using System.ComponentModel;
    00004 using System.Data;
    00005 using System.Drawing;
    00006 using System.Text;
    00007 using System.Windows.Forms;
    00008
    00009 namespace Editor
    00010 {
    00011     public partial class ReferencesDialog : Form
    00012     {
    00013         public ReferencesDialog()
    00014         {
    00015             InitializeComponent();
    00016         }
    00017
    00018         public void SetReferences(string[] references)
    00019         {
    00020             TreeView referencesTreeView  = Controls["refTreeView"] as TreeView;
    00021
    00022             if (referencesTreeView == null)
    00023             {
    00024                 throw new Exception("We have a big issue, we expect to have a tree view here!");
    00025             }
    00026
    00027             referencesTreeView.Nodes.Clear();
    00028
    00029             foreach (string refStr in references)
    00030             {
    00031                 referencesTreeView.Nodes.Add(refStr);
    00032             }
    00033         }
    00034
    00035         public void AddReference(string refStr)
    00036         {
    00037             TreeView referencesTreeView  = Controls["refTreeView"] as TreeView;
    00038
    00039             if (referencesTreeView == null)
    00040             {
    00041                 throw new Exception("We have a big issue, we expect to have a tree view here!");
    00042             }
    00043             referencesTreeView.Nodes.Add(refStr);
    00044         }
    00045
    00046         public string[] GetReferences()
    00047         {
    00048             TreeView referencesTreeView  = Controls["refTreeView"] as TreeView;
    00049
    00050             if (referencesTreeView == null)
    00051             {
    00052                 throw new Exception("We have a big issue, we expect to have a tree view here!");
    00053             }
    00054
    00055             string[] references = new string[referencesTreeView.Nodes.Count];
    00056
    00057             for (int i = 0; i < references.Length; i++)
    00058             {
    00059                 references[i] = referencesTreeView.Nodes[i].Text;
    00060             }
    00061
    00062             return references;
    00063         }
    00064
    00065         private void addRefBtn_Click(object sender, EventArgs e)
    00066         {
    00067             OpenFileDialog fDialog = new OpenFileDialog();
    00068
    00069             if (fDialog.ShowDialog() == DialogResult.OK)
    00070             {
    00071                 AddReference(fDialog.FileName);
    00072             }
    00073         }
    00074
    00075         private void validateRefBtn_Click(object sender, EventArgs e)
    00076         {
    00077             DialogResult = DialogResult.OK;
    00078         }
    00079
    00080         private void cancelRefBtn_Click(object sender, EventArgs e)
    00081         {
    00082             DialogResult = DialogResult.Cancel;
    00083         }
    00084
    00085         private void removeBtn_Click(object sender, EventArgs e)
    00086         {
    00087             TreeView referencesTreeView = Controls["refTreeView"] as TreeView;
    00088
    00089             referencesTreeView.Nodes.Remove(referencesTreeView.SelectedNode);
    00090         }
    00091     }
    00092 }