Ejemplo n.º 1
0
        private static void ExtractConnections(string fileToOpen)
        {
            System.IO.FileInfo FilePath = new System.IO.FileInfo(fileToOpen);
            ConnectionsStore   myStore  = new ConnectionsStore();

            myStore = SerializeFile.Deserialize(FilePath.FullName);
            Connections.SaveDictionary(myStore.LocalConnections);
        }
Ejemplo n.º 2
0
 private void завантажитиToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DialogResult dialogrezult1 = MessageBox.Show("Проект повинен бути пустим!", "Інформація",
        MessageBoxButtons.OK);
     DialogResult dialogrezult = MessageBox.Show("Вказати потрібно перше слово файлів", "Інформація",
        MessageBoxButtons.OK);
     string fileName;
     openFileDialog1.ShowDialog();
     fileName = openFileDialog1.FileName;
     SerializeFile serializeFile = new SerializeFile();
     x_location = (int[])serializeFile.Deserialize(fileName + " x_location");
     y_location = (int[])serializeFile.Deserialize(fileName + " y_location");
     n_ovalshape = (int)serializeFile.Deserialize(fileName + " n_ovalshape");
     n_conekt = (int)serializeFile.Deserialize(fileName + " n_conekt");
     segment_name = (int[,])serializeFile.Deserialize(fileName + " segment_name");
     matrix_sumizn = (double[,])serializeFile.Deserialize(fileName + " matrix_sumizn");
     string[] ovalshapeName = (string[])serializeFile.Deserialize(fileName + " ovalshapeName");
     Point[] ovalshapeLocation = (Point[])serializeFile.Deserialize(fileName + " ovalshapeLocation");
     string[] tbName = (string[])serializeFile.Deserialize(fileName + " tbName");
     string[] tbText = (string[])serializeFile.Deserialize(fileName + " tbText");
     Point[] tbLocation = (Point[])serializeFile.Deserialize(fileName + " tbLocation");
     string[] tb_lengthName = (string[])serializeFile.Deserialize(fileName + " tb_lengthName");
     string[] tb_lengthText = (string[])serializeFile.Deserialize(fileName + " tb_lengthText");
     Point[] tb_lengthLocation = (Point[])serializeFile.Deserialize(fileName + " tb_lengthLocation");
      string[] lineshapeName = (string[])serializeFile.Deserialize(fileName + " lineshapeName");
     Point[] lineshapeStartPoint = (Point[])serializeFile.Deserialize(fileName + " lineshapeStartPoint");
     Point[] lineshapeEndPoint = (Point[])serializeFile.Deserialize(fileName + " lineshapeEndPoint");
     //створення точок
     for (int i = 0; i <=n_ovalshape; i++)
     {
         ovalshape[i].Name = ovalshapeName[i];
         ovalshape[i].Location = ovalshapeLocation[i];
         rectangleShape1.Parent.Shapes.Add(ovalshape[i]);
     }
     //-----------------------------------------------------------------------------
     //Створення полів дя вuводу назв населених пунктів
     for (int i = 0; i <= n_ovalshape; i++)
     {
         tb[i].Name = tbName[i];
         tb[i].Text = tbText[i];
         tb[i].Location = tbLocation[i];
         Controls.Add(tb[i]);
     }
     //------------------------------------------------------------------------------
     //Створення ліній
     for (int i = 0; i <=n_conekt; i++)
     {
         lineshape[i].Name = lineshapeName[i];
         lineshape[i].StartPoint = lineshapeStartPoint[i];
         lineshape[i].EndPoint = lineshapeEndPoint[i];
         rectangleShape1.Parent.Shapes.Add(lineshape[i]);
     }
     //------------------------------------------------------------------------------
     //Створення текстових полів для введення величин
     for (int i = 0; i <=n_conekt; i++)
     {
         tb_length[i].Name = tb_lengthName[i];
         tb_length[i].Text = tb_lengthText[i];
         tb_length[i].Location = tb_lengthLocation[i];
         Controls.Add(tb_length[i]);
     }
     if ((bool)serializeFile.Deserialize(fileName))
         BackgroundImage = (Image)serializeFile.Deserialize(fileName + " BackgroundImage");
 }