BlueSky.Windows.ValueLablesDialog.checkMaxFactorsAndLoadFMap C# (CSharp) Method

checkMaxFactorsAndLoadFMap() private method

private checkMaxFactorsAndLoadFMap ( ) : bool
return bool
        private bool checkMaxFactorsAndLoadFMap()
        {
            bool success = true;
            IAnalyticsService analyticServ = LifetimeService.Instance.Container.Resolve<IAnalyticsService>();

            string fromTo = "from " + changeFrom + " to " + changeTo;
            object numfactors = null;
            string[] factors;
            if (changeFrom.Equals("Scale") && ( changeTo.Equals("Nominal") || changeTo.Equals("Ordinal") )) // S to N/O
            {
                //get the list of factors(numeric)
                numfactors = analyticServ.GetColNumFactors(colName, datasetName);

                if (numfactors != null && (numfactors as UAReturn).SimpleTypeData.GetType().Name == "String[]")
                {
                    factors = (string[])(numfactors as UAReturn).SimpleTypeData;
                    if (factors.Length > maxfactors)
                    {
                        string msg = "Conversion " + fromTo + " cannot be done, as number of factors are greater than " + maxfactors + ".";
                        if (changeMeasureCombo.SelectedIndex != 2)
                            MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        changeMeasureCombo.SelectedIndex = 2;
                        success = false;
                    }
                    else
                    {
                        _factormapList = new List<FactorMap>();
                        FactorMap fm = null;
                        foreach (string str in factors)
                        {
                            if (!str.Trim().Equals("."))//exclude '.'
                            {
                                fm = new FactorMap();
                                fm.labels = str;
                                fm.textbox = str;
                                _factormapList.Add(fm);
                            }
                        }
                    }
                }
                else//if empty levels/factors
                {
                    string msg = "Conversion " + fromTo + " cannot be done, as number of values are less than 1. Please enter some values in data grid." ;
                    if (changeMeasureCombo.SelectedIndex != 2)
                        MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    changeMeasureCombo.SelectedIndex = 2;
                    success = false;
                }
            }
            else if (changeTo.Equals("Scale") && (changeFrom.Equals("Nominal") || changeFrom.Equals("Ordinal")))// N/O to S
            {
                //get list of level names. 
                _factormapList = analyticServ.GetColumnFactormap(colName, datasetName);

            }
            //else
            //{
            //    success = false;
            //}
            //MessageBox.Show("Selection changed"+s);
            return (success);
        }