예제 #1
0
 /// <summary>
 /// Saves the grid to file
 /// </summary>
 /// <param name="path">Path to file</param>
 /// <param name="grid">Instance of grid</param>
 public static void Save(string path, Grid grid)
 {
     using (FileStream fileStream = new FileStream(path, FileMode.OpenOrCreate,FileAccess.Write, FileShare.None))
     {
         BinaryFormatter binaryFormatter = new BinaryFormatter();
         binaryFormatter.Serialize(fileStream, grid.Parameters);
         binaryFormatter.Serialize(fileStream, grid.Cells);
     }
 }
예제 #2
0
파일: mainFrm.cs 프로젝트: BigJk/NetVolve
        private void Form1_Load(object sender, EventArgs e)
        {
            grid = File.Exists("save.bin") ? GridSerializer.Load("save.bin") : new Grid(Paras);

            Task.Factory.StartNew(new Action(() =>
            {
                while (true)
                {
                    try
                    {
                        Thread.Sleep(2000);
                        Invoke(new UpdateDel(UpdateList));
                    }
                    catch { }
                }
            }));

            grid.StartAsync(Threads);
        }
예제 #3
0
파일: mainFrm.cs 프로젝트: BigJk/NetVolve
 private void restartToolStripMenuItem_Click(object sender, EventArgs e)
 {
     grid.StopAsync();
     Paras = ParameterLoader.FromFile("settings.cfg");
     grid = new Grid(Paras);
     grid.StartAsync(Threads);
 }
예제 #4
0
파일: mainFrm.cs 프로젝트: BigJk/NetVolve
 private void loadFromToolStripMenuItem_Click(object sender, EventArgs e)
 {
     grid.StopAsync();
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             grid = GridSerializer.Load(ofd.FileName);
         }
     }
     grid.StartAsync(Threads);
 }