Пример #1
0
        /// <summary>
        /// ControlPanel je parametr, který představuje UserControl pro stránkování a řazení.
        /// </summary>
        /// <param name="controlPanel"></param>
        public ControlPanelGeneric(ControlPanel controlPanel)
        {
            // Události UserControlu jsou řešeny v této třídě, ne ve třídě user controlu (protože user control nemůže být generický)
            this._cp            = controlPanel;
            _cp.btnFirst.Click += btnFirst_Click;
            _cp.btnNext.Click  += btnNext_Click;
            _cp.btnPrev.Click  += btnPrev_Click;
            _cp.btnLast.Click  += btnLast_Click;
            _cp.cbNumberOfRecords.SelectionChanged += cbNumberOfRecords_SelectionChanged;
            _cp.btnClear.Click   += btnClear_Click;
            _cp.btnSearch.Click  += btnSearch_Click;
            _cp.tbSearch.KeyDown += tbSearch_KeyDown;
            _cp.Loaded           += UserControl_Loaded;

            // Události řazení
            _cp.btnOrderAlphabetical.Click        += btnOrderAlphabetical_Click;
            _cp.btnOrderReverseAlphabetical.Click += btnOrderReverseAlphabetical_Click;
            _cp.cbOrderBy.SelectionChanged        += cbOrderBy_SelectionChanged;

            _numberOfRecordsPerPage = Convert.ToInt32(((ComboBoxItem)_cp.cbNumberOfRecords.SelectedItem).Content);

            string comboBoxSelection = ((ComboBoxItem)_cp.cbNumberOfRecords.SelectedItem).Content.ToString();

            if (comboBoxSelection.Trim() == "Vše")
            {
                _numberOfRecordsPerPage = DataToTransform.Count();
            }
            else
            {
                _numberOfRecordsPerPage = Convert.ToInt32(comboBoxSelection);
            }
        }
Пример #2
0
        private void dataTransformationThread_DoWork(object sender, DoWorkEventArgs e)
        {
            int    i, r;
            String StrParam1, StrParam2, StrParam3;
            int    recursion = 1;
            Dictionary <String, String> tParams = new Dictionary <string, string>();
            List <Equity> DataToTransform;

            SET_DATA_INVALID();

            //Point to the data set to be transformed
            if (AllTransformApplied == true)
            {
                DataToTransform = statsMarketData.Constituents;
            }
            else
            {
                DataToTransform = dataSet;
            }

            //Validate the required control parameters
            if (trfWorkerParamText.Length != 4)
            {
                trfWorkerSelectedIndex = -1;
            }

            //Validate the selected transformation combobox index
            if (trfWorkerSelectedIndex >= 0)
            {
                switch (TransformTList[trfWorkerSelectedIndex])
                {
                case TransformType.TRF_GAUSS:
                    StrParam1 = trfWorkerParamText[1];
                    StrParam2 = trfWorkerParamText[2];
                    StrParam3 = trfWorkerParamText[3];

                    //If input parameter is valid, perform the transformation
                    if (Helpers.ValidateNumeric(StrParam1) && Helpers.ValidateNumeric(StrParam2))
                    {
                        recursion = int.Parse(StrParam2);
                        for (r = 0; r < recursion; r++)
                        {
                            tParams.Add("pSigma", StrParam1);
                            for (i = 0; i < DataToTransform.Count(); i++)
                            {
                                //dataSet[i].TransformData(Transformation.GAUSS, tParams);
                                DataToTransform[i].TransformData(Transformation.GAUSS, tParams);
                            }
                            tParams.Clear();
                        }
                    }
                    break;

                case TransformType.TRF_MEAN:
                    StrParam1 = trfWorkerParamText[1];
                    StrParam2 = trfWorkerParamText[2];
                    StrParam3 = trfWorkerParamText[3];

                    //If input parameter is valid, perform the transformation
                    if (Helpers.ValidateNumeric(StrParam1) && Helpers.ValidateNumeric(StrParam2))
                    {
                        recursion = int.Parse(StrParam2);
                        for (r = 0; r < recursion; r++)
                        {
                            tParams.Add("Window", StrParam1);
                            for (i = 0; i < DataToTransform.Count(); i++)
                            {
                                DataToTransform[i].TransformData(Transformation.MEAN, tParams);
                            }
                            tParams.Clear();
                        }
                    }

                    break;

                case TransformType.TRF_NORM:
                    tParams.Clear();
                    for (i = 0; i < DataToTransform.Count(); i++)
                    {
                        DataToTransform[i].TransformData(Transformation.NORMALIZE, tParams);
                    }
                    break;

                case TransformType.TRF_SHIFT_PPC:
                    StrParam1 = trfWorkerParamText[1];

                    if (lastSelectedTab >= 0 && lastSelectedTab < DataToTransform.Count() && Helpers.ValidateNumeric(StrParam1))
                    {
                        for (i = 0; i < statsMarketData.Constituents.Count; i++)
                        {
                            if (statsMarketData.Constituents[i].Name == DataToTransform[lastSelectedTab].Name)
                            {
                                statsMarketData.Constituents[i].TrimDataLeft(int.Parse(StrParam1));
                            }
                            else
                            {
                                statsMarketData.Constituents[i].TrimDataRight(int.Parse(StrParam1));
                            }
                        }
                    }

                    break;

                default:
                    break;
                }
            }

            SET_DATA_VALID();
        }