|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using DataPerformer;
namespace DataPerformerUI
{
/// <summary>
/// Summary description for FormSaveVectorFunction.
/// </summary>
public class FormSaveVectorFunction : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.MainMenu mainMenu1Form;
private System.Windows.Forms.MenuItem menuItemFile;
private System.Windows.Forms.MenuItem menuItemSave;
private System.Windows.Forms.SaveFileDialog saveFileDialogArray;
private DoubleArrayFunction function;
private FormSaveVectorFunction()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
ResourceService.Resources.LoadControlResources(this);
//
// TODO: Add any constructor code after InitializeComponent call
//
}
public FormSaveVectorFunction(object[] o) : this()
{
IMeasure m = o[2] as IMeasure;
Text = m.Name;
function = o[0] as DoubleArrayFunction;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1Form = new System.Windows.Forms.MainMenu();
this.menuItemFile = new System.Windows.Forms.MenuItem();
this.menuItemSave = new System.Windows.Forms.MenuItem();
this.saveFileDialogArray = new System.Windows.Forms.SaveFileDialog();
//
// mainMenu1Form
//
this.mainMenu1Form.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemFile});
//
// menuItemFile
//
this.menuItemFile.Index = 0;
this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemSave});
this.menuItemFile.Text = "File";
//
// menuItemSave
//
this.menuItemSave.Index = 0;
this.menuItemSave.Text = "Save as";
this.menuItemSave.Click += new System.EventHandler(this.menuItemSave_Click);
//
// FormSaveVectorFunction
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(648, 389);
this.Menu = this.mainMenu1Form;
this.Name = "FormSaveVectorFunction";
this.Text = "FormSaveVectorFunction";
}
#endregion
private void menuItemSave_Click(object sender, System.EventArgs e)
{
if (saveFileDialogArray.ShowDialog(this) != DialogResult.OK)
{
return;
}
if (File.Exists(saveFileDialogArray.FileName))
{
File.Delete(saveFileDialogArray.FileName);
}
Stream stream = File.OpenWrite(saveFileDialogArray.FileName);
BinaryFormatter f = new BinaryFormatter();
f.Serialize(stream, function);
stream.Close();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:
1) Noncommutative geometry
http://front.math.ucdavis.edu/author/P.Ivankov
2) Literary work (Russian only)
http://zhurnal.lib.ru/editors/3/3d_m/
3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1