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);
                }
            }
        }
Example #3
0
        private void OpenCmdExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            string            exception         = string.Empty;
            VisualToSerialize visualToSerialize =
                (VisualToSerialize)OpenSaveClass.OpenDialog(ModelType.Scheme, out exception);

            if (visualToSerialize == null)
            {
                if (!string.IsNullOrEmpty(exception))
                {
                    MessageBox.Show("Неможливо відкрити файл структурної схеми внаслідок:\n" + exception);
                }
            }
            else
            {
                if (drawingSurface.GetVisualCount() != 0)
                {
                    drawingSurface.ClearAll();
                }
                drawingSurface.AddVisuals(visualToSerialize.GetShapeBases());
            }
        }
Example #4
0
 private void BSWindow_Loaded(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(mainWindow.BlockSchemePath))
     {
         string            exception         = string.Empty;
         VisualToSerialize visualToSerialize =
             (VisualToSerialize)OpenSaveClass.OpenCommand(mainWindow.BlockSchemePath,
                                                          ModelType.Scheme, out exception);
         if (visualToSerialize == null)
         {
             MessageBox.Show("Неможливо відкрити файл структурної схеми внаслідок:\n" + exception);
             visualToSerialize          = null;
             mainWindow.BlockSchemePath = string.Empty;
         }
         else
         {
             if (drawingSurface.GetVisualCount() != 0)
             {
                 drawingSurface.ClearAll();
             }
             drawingSurface.AddVisuals(visualToSerialize.GetShapeBases());
         }
     }
 }