public ChooseDistributionLaw(Topology.Topology topology)
        {
            this.topology = topology ?? throw new NullReferenceException();

            InitializeComponent();

            SetupDefaultSettings();

            labelDeterminedFlowParams.Visible = true;
            nudDeterminedFlow.Visible         = true;
        }
Пример #2
0
        private void btnLoadTopology_Click(object sender, EventArgs e)
        {
            string fullFilePath;
            string dotExt = TopologySaverAndLoader.DotExt;
            string filter = TopologySaverAndLoader.Filter;

            OpenFileDialog ofd = new OpenFileDialog
            {
                DefaultExt = dotExt,
                Filter     = filter
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                fullFilePath = ofd.FileName;

                if (File.Exists(fullFilePath))
                {
                    try
                    {
                        Topology.Topology topology = TopologySaverAndLoader.Load(fullFilePath);

                        Constructor.Constructor constructor = new Constructor.Constructor(fullFilePath, topology);
                        constructor.ShowDialog();
                    }
                    catch (SerializationException)
                    {
                        MessageBox.Show("ОШИБКА: файл повреждён");
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(exc.StackTrace);
                    }
                }
                else
                {
                    MessageBox.Show("ОШИБКА: файл не существует");
                }
            }
        }