Example #1
0
        private void CmdRun_Click(object sender, RoutedEventArgs e)
        {
            string[,] CoefMatrix;
            string[] BMatrix;
            string   erorText = drawingSurface.PreSolver(out CoefMatrix, out BMatrix);

            if (erorText != "")
            {
                MessageBox.Show(erorText);
                CoefMatrix = null;
                return;
            }
            if ((CoefMatrix.GetLength(0) != 0) && (BMatrix.Length != 0))
            {
                mainWindow.SetArrays(CoefMatrix, BMatrix);
                string            exception = string.Empty;
                VisualToSerialize vts       = new VisualToSerialize();
                vts.SetShapeBase(drawingSurface.GetVisuals());

                string filePath = string.Empty;
                if (OpenSaveClass.SaveCommand(vts, out filePath, out exception))
                {
                    mainWindow.BlockSchemePath = filePath;
                }
                else
                {
                    MessageBox.Show("Неможливо зберегти структурну схему внаслідок:\n" + exception);
                }
            }

            CoefMatrix = null;
            BMatrix    = null;
            drawingSurface.ClearAll();
            this.Close();
        }
Example #2
0
        private void SaveCmdExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            string filePath = string.Empty;

            if ((filePath = OpenSaveClass.SaveDialog(ModelType.Scheme, string.Empty)) != string.Empty)
            {
                string            exception = string.Empty;
                VisualToSerialize vts       = new VisualToSerialize();
                vts.SetShapeBase(drawingSurface.GetVisuals());

                if (OpenSaveClass.SaveCommand(filePath, vts, out exception))
                {
                    mainWindow.BlockSchemePath = filePath;
                }
                else
                {
                    MessageBox.Show("Неможливо зберегти структурну схему внаслідок:\n" + exception);
                }
            }
        }