Exemplo n.º 1
0
        private void OnShowDatasetClick(object sender, EventArgs e)
        {
            int    curveIndex = UiControls.TryGetValue <int>(uiRChartDown_CrvIdx_Num);
            string signature  = MethodBase.GetCurrentMethod().Name + '(' + curveIndex + ')';

            log.Info(signature);

            if (curveIndex < 0 || curveIndex >= Settings.Ui.CurvesNo)
            {
                return;
            }

            try {
                Series controlsSpecifiedSeries = GetUiSpecifiedSeries();

                using (var dialog = new GridPreviewer(controlsSpecifiedSeries)) {
                    WindowDimensions dimensions = new WindowDimensions();
                    dialog.Width  = dimensions.GridPreviewer.Width;
                    dialog.Height = dimensions.GridPreviewer.Height;
                    UiControls.TryShowDialog(dialog, this);
                }
            }
            catch (OutOfMemoryException ex) {
                AppMessages.General.StopOfOutOfMemoryException();
                log.Fatal(signature, ex);
            }
            catch (Exception ex) {
                log.Fatal(signature, ex);
            }
        }
Exemplo n.º 2
0
        private void OnShowDataSetClick(object sender, EventArgs e)
        {
            DataSetCurveType curveType = (DataSetCurveType)UiControls.TryGetSelectedIndex(uiPnlMod_CrvT_ComBx);
            int    curveIndex          = UiControls.TryGetValue <int>(uiPnlMod_CrvIdx_Num);
            string signature           = MethodBase.GetCurrentMethod().Name + '(' + curveType + ',' + curveIndex + ')';

            switch (curveType)
            {
            case DataSetCurveType.Ideal:
            case DataSetCurveType.Modified:
            case DataSetCurveType.Average:
                break;

            default:
                log.Info(signature);
                AppMessages.MainWindow.AsteriskOfCurveTypeNotSelected();
                return;
            }

            Series curveSeries = SpecifyCurveSeries(curveType, curveIndex);

            if (curveSeries == null || curveSeries.Points.Count == 0)
            {
                log.Info(MethodBase.GetCurrentMethod().Name + '(' + nameof(curveSeries) + ')');
                AppMessages.MainWindow.ExclamationOfSeriesSelection();
                return;
            }

            using (var dialog = new GridPreviewer(SeriesAssist.GetCopy(curveSeries))) {
                dialog.Height = Settings.Dimensions.GridPreviewer.Height;
                dialog.Width  = Settings.Dimensions.GridPreviewer.Width;
                UiControls.TryShowDialog(dialog, this);

                try {
                    if (dialog.DialogResult == DialogResult.OK)
                    {
                        DataChart.AlterCurve(dialog.Curve, curveType, curveIndex);
                        ChartAssist.Refresh(dialog.Curve, Color.Indigo, uiCharts_Crv);
                    }
                }
                catch (InvalidOperationException ex) {
                    log.Error(signature, ex);
                    AppMessages.MainWindow.ErrorOfChartRefreshing();
                }
                catch (Exception ex) {
                    log.Fatal(signature, ex);
                }
            }

            log.Info(signature);
        }