/// <summary>
 /// saves createed structure into file
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonSaveStructure_Click(object sender, EventArgs e)
 {
     textBoxInfo.Text = "";
     if (CreatedStructure.Instance.Count == 0)
     {
         ShowError("Structure must be created before exporting into file.");
         return;
     }
     try
     {
         LoaderAndSaver.SaveToFile();
         ActionWasSuccessfull("Structure was saved into file.");
     }
     catch (IOException)
     {
         ShowError("Mistake while saving created structure into file.");
     }
 }
        /// <summary>
        /// Load file with created structure
        /// </summary>
        /// <returns></returns>
        public void LoadAndShowCrystal()
        {
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                string file = openFileDialog1.FileName;

                try
                {
                    LoaderAndSaver.LoadFile(file);
                }
                catch (IOException)
                {
                    ShowError("Invalid input file.");
                    return;
                }
            }
        }
        /// <summary>
        /// Load crystal parameters from file and display values in textboxes
        /// </summary>
        public void LoadCrystal()
        {
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                string   file     = openFileDialog1.FileName;
                string[] elements = LoaderAndSaver.LoadFileParams(file);
                if (elements == null)
                {
                    ShowError("Invalid format of input file with crystal parameters.");
                    return;
                }
                textBoxA.Text     = elements[0];
                textBoxB.Text     = elements[1];
                textBoxC.Text     = elements[2];
                textBoxAlpha.Text = elements[3];
                textBoxBeta.Text  = elements[4];
                textBoxGamma.Text = elements[5];
            }
        }
 /// <summary>
 /// Save crystal parametres into file
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonSaveCrystalParams_Click(object sender, EventArgs e)
 {
     textBoxInfo.Text = "";
     LoaderAndSaver.SaveCrystalToFile(textBoxA.Text, textBoxB.Text, textBoxC.Text, textBoxAlpha.Text, textBoxBeta.Text, textBoxGamma.Text);
 }