public void Init(ISchematicLayer schematicLayer)
{
// CR229717: Lost the ElementClass if the dockable window is deactivate
if (schematicLayer == m_schematicLayer)
if (m_schEltClass != null)
return;
try
{
if (schematicLayer == null)
return;
m_schematicLayer = schematicLayer;
XmlNode col = null;
String myString = "";
m_schDataset = schematicLayer.SchematicDiagram.SchematicDiagramClass.SchematicDataset;
m_schEltClassCont = (ISchematicElementClassContainer)m_schDataset;
m_SchematicInMemoryDiagram = schematicLayer.SchematicInMemoryDiagram;
m_dom = new XmlDocument();
ISchematicDiagram schematicDiagram;
schematicDiagram = m_SchematicInMemoryDiagram.SchematicDiagram;
// get the path of the xml file that contains the definitions of the digitize dockable window
String path;
ISchematicDiagramClass schematicDiagramClass = schematicDiagram.SchematicDiagramClass;
ISchematicAttributeContainer schematicAttributeContainer = (ISchematicAttributeContainer)schematicDiagramClass;
ISchematicAttribute schematicAttribute = schematicAttributeContainer.GetSchematicAttribute("DigitizePropertiesLocation", true);
if (schematicAttribute == null)
{
System.Windows.Forms.MessageBox.Show("Need an attribute named DigitizePropertiesLocation in the corresponding DiagramTemplate attributes");
return;
}
path = (string)schematicAttribute.GetValue((ISchematicObject)schematicDiagram);
if (IsRelative(path)) //Concat the workspace's path with this path
{
//current workspace path
ISchematicDataset myDataset = schematicDiagramClass.SchematicDataset;
if (myDataset != null)
{
ISchematicWorkspace mySchematicWorkspace = myDataset.SchematicWorkspace;
if (mySchematicWorkspace != null)
{
ESRI.ArcGIS.Geodatabase.IWorkspace myWorkspace = mySchematicWorkspace.Workspace;
if (myWorkspace != null)
{
string workspacePath = myWorkspace.PathName;
//add "..\" to path to step back one level...
string stepBack = "..\\";
path = stepBack + path;
path = System.IO.Path.Combine(workspacePath, path);
}
}
}
}
//else keep the original hard path
XmlReader reader = XmlReader.Create(path);
m_dom.Load(reader);
//Load Nodes
XmlNodeList nodes = m_dom.SelectNodes("descendant::NodeFeature");
//Clear combo box after each call
cboNodeType.Items.Clear();
foreach (XmlElement node in nodes)
{
cboNodeType.Items.Add(node.GetAttribute("FeatureClassName").ToString());
}
//Load Links
XmlNodeList links = m_dom.SelectNodes("descendant::LinkFeature");
//Clear combo box after each call
cboLinkType.Items.Clear();
foreach (XmlElement link in links)
{
cboLinkType.Items.Add(link.GetAttribute("FeatureClassName").ToString());
}
col = m_dom.SelectSingleNode("descendant::MandatoryColor");
if (col != null)
{
myString = "System.Drawing.";
myString = col.InnerText.ToString();
m_MandatoryColor = System.Drawing.Color.FromName(myString);
}
col = m_dom.SelectSingleNode("descendant::FormName");
if (col != null)
{
myString = col.InnerText.ToString();
Text = myString;
}
XmlNodeList rels = m_dom.SelectNodes("descendant::Relation");
if (rels.Count > 0)
m_relations = rels;
col = m_dom.SelectSingleNode("descendant::AutoClearAfterCreate");
if ((col != null) && col.InnerText.ToString() == "True")
m_autoClear = true;
}
catch (System.Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
m_Panel1 = Splitter.Panel1;
m_Panel2 = Splitter.Panel2;
m_curPanel = Splitter.Panel1;
lblMode.Text = "Create Node";
m_loading = false;
m_clickPanel = false;
m_schEltClass = null;
}