private void saveButton_Click(object sender, EventArgs e)
{
Canguro.Model.UnitSystem.UnitSystemsManager.Instance.Enabled = false;
string path = "";
string currentPath = model.CurrentPath;
System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
dlg.Filter = "Treu Structure Sections (*.xsec)|*.xsec";
dlg.DefaultExt = "xsec";
dlg.AddExtension = true;
dlg.FileName = currentPath;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
path = dlg.FileName;
try
{
if (path.Length > 0)
{
System.Xml.XmlTextWriter xml = new System.Xml.XmlTextWriter(path, System.Text.ASCIIEncoding.ASCII);
xml.WriteStartDocument();
xml.WriteStartElement("Sections");
xml.WriteStartElement("Frame_Section_Properties_01_-_General");
foreach (Section sec in model.Sections)
if (sec is FrameSection)
Canguro.Model.Serializer.Serializer.writeFrameSection(xml, (FrameSection)sec);
xml.WriteEndElement();
xml.WriteStartElement("Frame_Section_Properties_03_-_Concrete_Beam");
foreach (Section sec in model.Sections)
if (sec is FrameSection && ((FrameSection)sec).ConcreteProperties is ConcreteBeamSectionProps)
Canguro.Model.Serializer.Serializer.writeConcreteBeamAssigments(xml, (FrameSection)sec);
xml.WriteEndElement();
xml.WriteStartElement("Frame_Section_Properties_02_-_Concrete_Column");
foreach (Section sec in model.Sections)
if (sec is FrameSection && ((FrameSection)sec).ConcreteProperties is ConcreteColumnSectionProps)
Canguro.Model.Serializer.Serializer.writeConcreteColumnSectionProps(xml, (FrameSection)sec);
xml.WriteEndElement();
xml.WriteEndElement();
xml.Close();
}
}
finally
{
Canguro.Model.UnitSystem.UnitSystemsManager.Instance.Enabled = true;
}
}