private void ShowCuttingResult(List <CuttingScheme> result) { CuttingResultForm form = new CuttingResultForm(); form.MdiParent = MainForm.Instance; form.DataSource = result; form.Show(); }
internal void Stub() { CuttingResultForm form = new CuttingResultForm(); List <CuttingScheme> schemes = new List <CuttingScheme>(); CuttingScheme scheme = new CuttingScheme(); scheme.Height = 1200; scheme.Width = 2100; scheme.Material = new Material(1, "ЛДСП Белая", true); scheme.Parameters = new ParametersCollection(); scheme.Parameters.CutterThickness = 4; Section remain; scheme.Cut(scheme.RootSection, 500, CutType.Vertical, out remain); Section remain2; scheme.Cut(remain, 550, CutType.Horizontal, out remain2); schemes.Add((CuttingScheme)scheme.Clone()); form.DataSource = schemes; form.MdiParent = MainForm.Instance; form.Show(); }
internal void LoadCuttingCommand() { try { OpenFileDialog dialog = new OpenFileDialog(); dialog.DefaultExt = "cutting"; dialog.Filter = "Файлы раскроя (*.cutting)|*.cutting|Все файлы (*.*)|*.*"; if (dialog.ShowDialog() == DialogResult.Cancel) { return; } FileStream stream = File.OpenRead(dialog.FileName); BinaryFormatter formatter = new BinaryFormatter(); CuttingResultForm form = new CuttingResultForm(); form.DataSource = (List <CuttingScheme>)formatter.Deserialize(stream); form.MdiParent = MainForm.Instance; form.Show(); stream.Close(); } catch (SerializationException) { MessageBox.Show("Файл имеет не правильный формат или поврежден"); } }