示例#1
0
文件: Template.cs 项目: tdietrich/Tag
 // Serialize and Save all Template list
 private void SerializeAndSave(string fileName, Template templejt)
 {
     System.IO.Stream stream = System.IO.File.Open(fileName, System.IO.FileMode.Truncate);
     BinaryFormatter bFormatter = new BinaryFormatter();
     bFormatter.Serialize(stream, templejt);
     stream.Close();
 }
示例#2
0
文件: Template.cs 项目: tdietrich/Tag
 private Template DeserializeAndLoad(string filename)
 {
     Template templejt = new Template();
     System.IO.Stream stream = System.IO.File.Open(filename, System.IO.FileMode.Open);
     BinaryFormatter bFormatter = new BinaryFormatter();
     if (stream.Length != 0) templejt = (Template)bFormatter.Deserialize(stream);
     stream.Close();
     return templejt;
 }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!textBox2.Text.Equals("") && !textBox3.Text.Equals(""))
            {
                Template doZapisu = new Template(textBox3.Text);
                doZapisu.Name = textBox2.Text;
                doZapisu.UsageFrequency = 0;

                Templates.Add(doZapisu);
                UpdateTemplateList();
            }
        }