//====================================================================================================
        private void button2_Click(object sender, EventArgs e)
        {
            var serializer = new BinaryFormatter();
            SimulationContainer _container = new SimulationContainer(_objects, _MEDIUM);

            using (var stream = File.OpenWrite("test.dat")) {
                serializer.Serialize(stream, _container);
            }
        }
Ejemplo n.º 2
0
        //====================================================================================================
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = this.openDLGOpenSimulationSettings.ShowDialog();

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    ClearObjects();

                    foreach (String file in openDLGOpenSimulationSettings.FileNames)
                    {
                        try
                        {
                            var serializer = new BinaryFormatter();
                            SimulationContainer _container = new SimulationContainer(null);
                            using (var stream = File.OpenRead(file))
                            {
                                _container = (SimulationContainer)serializer.Deserialize(stream);
                                _objects   = _container.Objects;
                                //_MEDIUM = _container.MEDIUM;
                                Medium.Enable();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }

                    for (int i = 0; i < _objects.Count; i++)
                    {
                        IRFDevice _dev = (IRFDevice)_objects[i];
                        _dev.Enable();
                        if (_dev.GetType() == typeof(STA))
                        {
                            ((STA)_dev).stoper = new System.Diagnostics.Stopwatch();
                        }
                    }
                    LeftPannelSmall();
                }
            }
            catch (Exception ex2)
            {
                //AddToErrorLog(ex.Message);
                MessageBox.Show(ex2.Message);
            }
            DrowOnBoard();
            Medium._objects = _objects;
        }
Ejemplo n.º 3
0
        //====================================================================================================
        private void button2_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "Visualisator SLS|*.sls|Visualisator TDLS|*.tdls";
            saveFileDialog1.Title  = "Save Visualisator Simulation File";
            saveFileDialog1.ShowDialog();
            // If the file name is not an empty string open it for saving.
            if (saveFileDialog1.FileName != "")
            {
                var serializer = new BinaryFormatter();
                SimulationContainer _container = new SimulationContainer(_objects);
                using (var stream = File.OpenWrite(saveFileDialog1.FileName))
                {
                    serializer.Serialize(stream, _container);
                }
            }
        }
Ejemplo n.º 4
0
        //====================================================================================================
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = this.openDLGOpenSimulationSettings.ShowDialog();

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    ClearObjects();

                    foreach (String file in openDLGOpenSimulationSettings.FileNames)
                    {
                        try
                        {
                            var serializer = new BinaryFormatter();
                            SimulationContainer _container = new SimulationContainer(null);
                            using (var stream = File.OpenRead(file))
                            {
                                _container = (SimulationContainer) serializer.Deserialize(stream);
                                _objects = _container.Objects;
                                //_MEDIUM = _container.MEDIUM;
                                Medium.Enable();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }

                    for (int i = 0; i < _objects.Count; i++)
                    {
                        IRFDevice _dev = (IRFDevice) _objects[i];
                        _dev.Enable();
                        if (_dev.GetType() == typeof(STA))
                        {
                            ((STA)_dev).stoper = new System.Diagnostics.Stopwatch();
                        }
                    }
                    LeftPannelSmall();
                }
            }
            catch (Exception ex2)
            {
                //AddToErrorLog(ex.Message);
                MessageBox.Show(ex2.Message);
            }
            DrowOnBoard();
            Medium._objects = _objects;
        }
Ejemplo n.º 5
0
 //====================================================================================================
 private void button2_Click(object sender, EventArgs e)
 {
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     saveFileDialog1.Filter = "Visualisator SLS|*.sls|Visualisator TDLS|*.tdls";
     saveFileDialog1.Title = "Save Visualisator Simulation File";
     saveFileDialog1.ShowDialog();
     // If the file name is not an empty string open it for saving.
     if (saveFileDialog1.FileName != "")
     {
         var serializer = new BinaryFormatter();
         SimulationContainer _container = new SimulationContainer(_objects);
         using (var stream = File.OpenWrite(saveFileDialog1.FileName))
         {
             serializer.Serialize(stream, _container);
         }
     }
 }