Esempio n. 1
0
 public void LoadSavePoint(SavePoint savePoint)
 {
     if (savePoint != null)
     {
         SavePointSingleton.GetInstance(savePoint);
         DataSingleton.GetInstance(savePoint.IdPhase, savePoint.IdSoftwareTool);
     }
 }
Esempio n. 2
0
        private void ChoosePhase_Click(object sender, EventArgs e)
        {
            IndicatorsFilter indicatorsFilter = new IndicatorsFilter();

            Indicator[]        indicators         = indicatorsFilter.FilterIndicators();
            DataSingleton      dataSingleton      = DataSingleton.GetInstance();
            SavePointSingleton savePointSingleton = SavePointSingleton.GetInstance();
            int diff = indicators.Count(x => x.IdMethod > -1);

            if (dataSingleton.IdPhase == savePointSingleton.SavePoint.IdPhase &&
                dataSingleton.SoftwareTool == savePointSingleton.SavePoint.IdSoftwareTool &&
                indicators.Length == savePointSingleton.SavePoint.IndicatorsValues.Length + diff)
            {
                int count = 0;
                for (int i = 0; i < indicators.Length; ++i)
                {
                    if (indicators[i].IdMethod > -1)
                    {
                        ++count;
                        continue;
                    }
                    bool ok = float.TryParse(savePointSingleton.SavePoint.IndicatorsValues[i - count]?.Replace('.', ','), out float t);
                    indicators[i].Value = ok ? t : -1;
                }
            }
            else
            {
                foreach (Indicator indicator in indicators)
                {
                    indicator.Value = -1;
                }
            }

            Evaluation form = new Evaluation(indicators);

            form.Show();
            closedByUser = false;
            Close();
        }
Esempio n. 3
0
 private void loadData_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter = "xml files (*.xml)|*.xml";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 FileUser      fileUser  = new FileUser(ofd.FileName, new SavePointRepository());
                 SavePoint     savePoint = (SavePoint)fileUser.getElementById(0);
                 EditSavePoint loader    = new EditSavePoint();
                 loader.LoadSavePoint(savePoint);
                 CheckRadioButton(savePoint.IdSoftwareTool);
                 DataSingleton.GetInstance(savePoint.IdPhase, savePoint.IdSoftwareTool);
                 SavePointSingleton.GetInstance(savePoint);
             }
             catch (Exception)
             {
                 MessageBox.Show("Ошибка загрузки файла", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }