Пример #1
0
        /// <summary>
        ///     Set up data sources and load stored models as selected choices
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cpConsequenceModels_Load(object sender, EventArgs e)
        {
            var qraInst = QraStateContainer.Instance;

            cbNotionalNozzleModel.DataSource   = qraInst.NozzleModels;
            cbNotionalNozzleModel.SelectedItem = QraStateContainer.GetValue <NozzleModel>("NozzleModel");

            cbDeflagrationModel.DataSource = qraInst.DeflagrationModels;
            var model = QraStateContainer.GetValue <DeflagrationModel>("DeflagrationModel");

            cbDeflagrationModel.SelectedItem = model;
            UpdateCfdInput(model);

            cbThermalProbitModel.DataSource   = qraInst.ThermalProbitModels;
            cbThermalProbitModel.SelectedItem = QraStateContainer.GetValue <ThermalProbitModel>("ThermalProbit");

            cbOverpressureProbitModel.DataSource   = qraInst.OverpressureProbitModels;
            cbOverpressureProbitModel.SelectedItem =
                QraStateContainer.GetValue <OverpressureProbitModel>("OverpressureProbit");

            var radModel = QraStateContainer.GetValue <RadiativeSourceModels>("RadiativeSourceModel");

            cbRadiativeSourceModel.Fill(UiStateRoutines.GetRadiativeSourceModelDict(), radModel);
            cbRadiativeSourceModel.SelectedItem = radModel;
        }
Пример #2
0
 private void ReadFromGlobalDataCollectionAndSet()
 {
     if (DesignMode)
     {
         return;
     }
     //UIStateRoutines.SetSelectedDropdownValue(cbNotionalNozzleModel, (string)QraStateContainer.Instance.GlobalData["NozzleModel"]);
     UiStateRoutines.SetSelectedDropdownValue(cbNotionalNozzleModel,
                                              QraStateContainer.GetObject("NozzleModel").ToString());
 }
Пример #3
0
        /// <summary>
        /// Handle selection of panels to display, including updating buttons.
        /// </summary>
        /// <param name="mainForm"></param>
        /// <param name="sender"></param>
        /// <param name="containerPanel"></param>
        /// <param name="panelToActivate">New panel</param>
        /// <param name="panelNarrativeText">Text pulled from RTF to display as header</param>
        /// <param name="clickOption"></param>
        public static void ActivateActionPanel(FrmQreMain mainForm, Button sender, Panel containerPanel,
                                               UserControl panelToActivate, string panelNarrativeText,
                                               ApButtonClickOption clickOption = ApButtonClickOption.PerformClick)
        {
            mainForm.SuspendLayout();
            try
            {
                var panelThatOwnsCaller = (Panel)sender.Parent;
                containerPanel.Controls.Clear();
                if (panelThatOwnsCaller != null)
                {
                    UiStateRoutines.UnselectButtons(panelThatOwnsCaller);
                }

                UiStateRoutines.UnselectButtons(containerPanel);
                sender.ForeColor = Color.Green;

                // Clear unneeded controls
                foreach (Control thisControl in containerPanel.Controls)
                {
                    if (thisControl is Button)
                    {
                        containerPanel.Controls.Remove(thisControl);
                    }
                }

                panelToActivate.Dock = DockStyle.Fill;
                containerPanel.Controls.Add(panelToActivate);
                ActiveScreen.lblActionNarrative.Text = panelNarrativeText;
                if (clickOption == ApButtonClickOption.PerformClick)
                {
                    var firstButton = QuickFunctions.GetTopButton(panelToActivate, ChildNavOptions.NavigateChildren);
                    if (firstButton != null)
                    {
                        firstButton.PerformClick();
                    }
                    else
                    {
                        MessageBox.Show(@"Cannot perform click for the " + panelToActivate.GetType().Name +
                                        @" action panel because it contains no buttons.");
                    }
                }
            }
            finally
            {
                mainForm.ResumeLayout();
            }
        }
Пример #4
0
        public static void SetContentScreen(Button caller, UserControl controlToUse)
        {
            UiStateRoutines.UnselectButtons(caller.Parent);

            controlToUse.Dock = DockStyle.Fill;
            var cpParent = new ContentPanel();

            FrmQreMain.UpdateControls(cpParent);

            cpParent.Dock         = DockStyle.Fill;
            cpParent.ChildControl = controlToUse;
            _mActiveContentPanel  = (IQraBaseNotify)controlToUse;

            caller.ForeColor = Color.Green;
            _mActiveContentPanel.Notify_LoadComplete();
        }
Пример #5
0
        private void btnConsequenceModels_Click(object sender, EventArgs e)
        {
            try
            {
                UiStateRoutines.UnselectButtons(this);
                var actionsNarrative = "Output";
                ResultsActionPanel = new ApOutputNavigator();
                ActivateActionPanel(this, (Button)sender, pnlActionButtons, ResultsActionPanel, actionsNarrative,
                                    ApButtonClickOption.NoClick);

                ActionUtils.SetContentScreen((Button)sender, new CpConsequenceModels());
            }
            catch (Exception ex)
            {
                Trace.TraceError(Environment.StackTrace);
                MessageBox.Show(genericNavErrorMsg + ex.Message);
            }
        }
Пример #6
0
        /// <summary>
        /// Display result panels
        /// </summary>
        private void btnSystemDescription_Click(object sender, EventArgs e)
        {
            try
            {
                UiStateRoutines.UnselectButtons(this);

                var actionsNarrative = "Output";
                ActivateActionPanel(this, (Button)sender, pnlActionButtons, new ApOutputNavigator(),
                                    actionsNarrative, ApButtonClickOption.NoClick);

                UserControl newControl = new CpSystemDescription();
                ActionUtils.SetContentScreen((Button)sender, newControl);
            }
            catch (Exception ex)
            {
                Trace.TraceError(Environment.StackTrace);
                MessageBox.Show(genericNavErrorMsg + ex.Message);
            }
        }
Пример #7
0
        /// <summary>
        ///     Set up progress screen and execute analysis task.
        ///     Callback will be called once analysis is complete.
        /// </summary>
        /// <param name="sender"></param>
        private void PrepForAnalysis(Button sender)
        {
            try
            {
                UiStateRoutines.UnselectButtons(FindForm());
                _progressCp = new ProgressDisplay();
                ActionUtils.SetContentScreen(sender, _progressCp);

                FrmQreMain.ActiveScreen.DisableNavigation(); // ugly way to ensure user can't navigate away
                _analysisToken = new CancellationTokenSource();
                //var StartTime = DateTime.Now;
                var task = Task.Factory.StartNew(ConductAnalysis, _analysisToken.Token);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                MessageBox.Show("Action failed with this error: " + ex.Message);
            }
        }
Пример #8
0
        private void ChangePanel(string actionsNarrative, object sender, UserControl nextControl)
        {
            try
            {
                // Track displayed control and free up resources when it changes
                if (_currentControl != null)
                {
                    _currentControl.Dispose();
                }
                _currentControl = nextControl;

                UiStateRoutines.UnselectButtons(this);
                ResultsActionPanel = new ApOutputNavigator();
                ActivateActionPanel(this, (Button)sender, pnlActionButtons, ResultsActionPanel, actionsNarrative,
                                    ApButtonClickOption.NoClick);
                ActionUtils.SetContentScreen((Button)sender, nextControl);
            }
            catch (Exception ex)
            {
                Trace.TraceError(Environment.StackTrace);
                MessageBox.Show(genericNavErrorMsg + ex.Message);
            }
        }
Пример #9
0
        private void SetRadiativeSourceModel()
        {
            var current = QraStateContainer.GetValue <RadiativeSourceModels>("RadiativeSourceModel");

            cbRadiativeSourceModel.Fill(UiStateRoutines.GetRadiativeSourceModelDict(), current);
        }
Пример #10
0
        void IQraBaseNotify.Notify_LoadComplete()
        {
            ContentPanel.SetNarrative(this, Narratives.HM__ExternalFactor);

            UiStateRoutines.SetSelectedDropdownValue(cbPipeDiams, "0.31");
        }