示例#1
0
        private void c_SaveConfigurationAsButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog()
            {
                Filter          = "XML Files|*.xml",
                CheckPathExists = true
            };

            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.m_LastSavePath = sfd.FileName;
                this.c_SaveConfigurationButton.Enabled = true;
                DataContractSerializer x = new DataContractSerializer(
                    typeof(FlowInterfaceControl.ListFlowElement),
                    SerializableTypes,
                    Int32.MaxValue,
                    false,
                    true,
                    null);
                FlowInterfaceControl.ListFlowElement config = new FlowInterfaceControl.ListFlowElement();
                foreach (FlowElement el in this.c_FlowInterfaceControl.Elements)
                {
                    config.Add(el);
                }
                using (FileStream writer = new FileStream(sfd.FileName, FileMode.Create))
                    x.WriteObject(writer, config);
                MessageBox.Show(this, "Save successful.", "Configuration saved.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#2
0
 private void c_SaveConfigurationButton_Click(object sender, EventArgs e)
 {
     if (this.m_LastSavePath == null)
     {
         this.c_SaveConfigurationAsButton.PerformClick();
     }
     else
     {
         DataContractSerializer x = new DataContractSerializer(
             typeof(FlowInterfaceControl.ListFlowElement),
             SerializableTypes,
             Int32.MaxValue,
             false,
             true,
             null);
         FlowInterfaceControl.ListFlowElement config = new FlowInterfaceControl.ListFlowElement();
         foreach (FlowElement el in this.c_FlowInterfaceControl.Elements)
         {
             config.Add(el);
         }
         using (FileStream writer = new FileStream(this.m_LastSavePath, FileMode.Create))
             x.WriteObject(writer, config);
         MessageBox.Show(this, "Save successful.", "Configuration saved.", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#3
0
 private void c_SaveConfigurationButton_Click(object sender, EventArgs e)
 {
     if (this.m_LastSavePath == null)
         this.c_SaveConfigurationAsButton.PerformClick();
     else
     {
         DataContractSerializer x = new DataContractSerializer(
             typeof(FlowInterfaceControl.ListFlowElement),
             SerializableTypes,
             Int32.MaxValue,
             false,
             true,
             null);
         FlowInterfaceControl.ListFlowElement config = new FlowInterfaceControl.ListFlowElement();
         foreach (FlowElement el in this.c_FlowInterfaceControl.Elements)
             config.Add(el);
         using (FileStream writer = new FileStream(this.m_LastSavePath, FileMode.Create))
             x.WriteObject(writer, config);
         MessageBox.Show(this, "Save successful.", "Configuration saved.", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#4
0
 private void c_SaveConfigurationAsButton_Click(object sender, EventArgs e)
 {
     SaveFileDialog sfd = new SaveFileDialog()
     {
         Filter = "XML Files|*.xml",
         CheckPathExists = true
     };
     if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         this.m_LastSavePath = sfd.FileName;
         this.c_SaveConfigurationButton.Enabled = true;
         DataContractSerializer x = new DataContractSerializer(
             typeof(FlowInterfaceControl.ListFlowElement),
             SerializableTypes,
             Int32.MaxValue,
             false,
             true,
             null);
         FlowInterfaceControl.ListFlowElement config = new FlowInterfaceControl.ListFlowElement();
         foreach (FlowElement el in this.c_FlowInterfaceControl.Elements)
             config.Add(el);
         using (FileStream writer = new FileStream(sfd.FileName, FileMode.Create))
             x.WriteObject(writer, config);
         MessageBox.Show(this, "Save successful.", "Configuration saved.", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }