Пример #1
0
        private void OnSolverCalculationsReportSent(object sender, EventArgs args)
        {
            string flattenReport = "";
            SolverReportEventArgs solverReport = args as SolverReportEventArgs;


            if (solverReport.AreCalculationsSucceed.HasValue && solverReport.AreCalculationsSucceed == true)
            {
                PresentedResultantSection.SetPresentedCollection(solverReport.SolutionsVector, solverReport.Results.ToArray());
                SectionModel = new ResultantSection(this.TabTitle, this.UserSection.RawExport(), this.SelectedConductor, this.Tension0.Value, this.Temperature1.Value, this.Temperature2.Value, solverReport.SolutionsVector, solverReport.Results);
                Annalist.Instance.DisplayStatus(this, "I300", solverReport.AdditionalInformation[0]);
            }
            else if (solverReport.AreCalculationsSucceed.HasValue && solverReport.AreCalculationsSucceed == false)
            {
                foreach (string message in solverReport.AdditionalInformation)
                {
                    flattenReport += message + " ";
                }
                PresentedResultantSection.SetPresentedCollection(solverReport.SolutionsVector);

                Annalist.Instance.DisplayStatus(this, "E300", new string[1] {
                    flattenReport
                });                                                                           //I know... this is kinda shitty...
            }
            else
            {
                PresentedResultantSection.SetPresentedCollection();
                Annalist.Instance.DisplayStatus(this, "E301", solverReport.AdditionalInformation[0]);
            }
        }
Пример #2
0
 public CalculatorTab(ResultantSection resultantSection) : this(resultantSection.ProjectName)
 {
     SectionModel = resultantSection;
     UserSection.UpdateFromSpatialModel(resultantSection.SpatialModel);
     if (SetConductorFromSectionModel(resultantSection.SectionConductor))
     {
         Tension0     = resultantSection.SectionInitialTension;
         Temperature1 = resultantSection.SectionInitialTemperature;
         Temperature2 = resultantSection.SectionTargetTemperature;
         PresentedResultantSection.SetPresentedCollection(resultantSection.Solutions, resultantSection.Results.ToArray());
         _Annalist.DisplayStatus(this.ToString(), "I200", new string[] { resultantSection.ProjectName });
     }
     _Annalist.DisplayStatus(this.ToString(), "E200", new string[] { resultantSection.ProjectName });
 }
Пример #3
0
        // CONSTRUCTORS
        public CalculatorTab(string tabTitle)
        {
            ConductorBase = ConductorDataManager.Instance;
            _conductorAdvencedDisplayMode = false;
            _categoryOverview             = new ObservableCollection <string>(ConductorBase.GetAvailableCategories());
            _selectedCategory             = _categoryOverview[0];

            _conductorSearchMode    = false;
            _searchedPhrase         = "";
            _conductorSearchResults = new ObservableCollection <Conductor>();

            UserSection = new UserSection();
            UserSection.SpatialModelUpdate += OnSpatialModelUpdate;
            PresentedResultantSection       = new PresentedResultantSection();
            Solver = new SolverViewModel(MainSettings.Instance.MainEPS, MainSettings.Instance.GravitionalAcceleration);
            Solver.SubscribeOn_SolverCalculationsReportSent_Event(OnSolverCalculationsReportSent);
            Solver.PropertyChanged += OnSolverPropertyChanged;
            TabTitle = tabTitle;

            LoadSectionModelFromCsvCommand = new CommandRelay(UserSection.LoadSectionModelFromCsv, () => true);
            SaveSectionModelAsCsvCommand   = new CommandRelay(UserSection.SaveSectionModelAsCsv, () => true);

            JustAddSpan    = new CommandRelay(UserSection.JustAddSpan, () => true);
            JustRemoveSpan = new CommandRelay(UserSection.JustRemoveSpan, CanExecute_JustRemoveSpanCommand);
            AddSpanBefore  = new CommandRelay(UserSection.AddSpanBeforeSelectedSpan, CanExecute_BasicSectionCommand);
            AddSpanAfter   = new CommandRelay(UserSection.AddSpanAfterSelectedSpan, CanExecute_BasicSectionCommand);
            ClearSpan      = new CommandRelay(UserSection.ClearSelectedSpan, CanExecute_BasicSectionCommand);
            RemoveSpan     = new CommandRelay(UserSection.RemoveSelectedSpan, CanExecute_RemoveSpanCommand);
            ClearAll       = new CommandRelay(UserSection.ClearBackToBasicSection, CanExecute_ClearAllSectionCommand);
            ManuallyCheckUserSectionIntegrity = new CommandRelay(UserSection.ManualIntegrityCheck, () => true);
            ToggleXAxisDataInputModeCommand   = new CommandRelay(ToggleXAxisDataInputMode, () => true);

            CloseReportCommand = new CommandRelay(UserSection.HideReport, UserSection.CanExecute_HideReport);

            ToggleConductorDetailsCommand = new CommandRelay(ToggleConductorDetails, () => true);
        }