public CellConditionTypeItemControl(CellConditionType type)
        {
            m_Type = type;
            Text   = type.ToString();

            switch (type)
            {
            case CellConditionType.Equal:
                Icon = UriResources.Images.Equal16;
                Text = Localization.ValueFilter_Equal;
                break;

            case CellConditionType.NotEqual:
                Icon = UriResources.Images.NotEqual16;
                Text = Localization.ValueFilter_NotEqual;
                break;

            case CellConditionType.Less:
                Icon = UriResources.Images.Less16;
                Text = Localization.ValueFilter_Less;
                break;

            case CellConditionType.LessOrEqual:
                Icon = UriResources.Images.LessOrEqual16;
                Text = Localization.ValueFilter_LessOrEqual;
                break;

            case CellConditionType.Greater:
                Icon = UriResources.Images.Greater16;
                Text = Localization.ValueFilter_Greater;
                break;

            case CellConditionType.GreaterOrEqual:
                Icon = UriResources.Images.GreaterOrEqual16;
                Text = Localization.ValueFilter_GreaterOrEqual;
                break;

            case CellConditionType.Between:
                Icon = UriResources.Images.Between16;
                Text = Localization.ValueFilter_Between;
                break;

            case CellConditionType.NotBetween:
                Icon = UriResources.Images.NotBetween16;
                Text = Localization.ValueFilter_NotBetween;
                break;

            case CellConditionType.None:
                Text = Localization.ComboBoxItem_None;
                break;
            }
        }
        public void SelectItem(CellConditionType type)
        {
            if (comboBox.Items.Count > 0)
                comboBox.SelectedIndex = 0;
            else
                comboBox.SelectedIndex = -1;

            int i = 0;
            foreach (CellConditionTypeItemControl item in comboBox.Items)
            {
                if (item.Type == type)
                {
                    comboBox.SelectedIndex = i;
                    break;
                }
                i++;
            }
        }
        public CellConditionTypeItemControl(CellConditionType type)
        {
            m_Type = type;
            Text = type.ToString();

            switch (type)
            {
                case CellConditionType.Equal:
                    Icon = UriResources.Images.Equal16;
                    Text = Localization.ValueFilter_Equal;
                    break;
                case CellConditionType.NotEqual:
                    Icon = UriResources.Images.NotEqual16;
                    Text = Localization.ValueFilter_NotEqual;
                    break;
                case CellConditionType.Less:
                    Icon = UriResources.Images.Less16;
                    Text = Localization.ValueFilter_Less;
                    break;
                case CellConditionType.LessOrEqual:
                    Icon = UriResources.Images.LessOrEqual16;
                    Text = Localization.ValueFilter_LessOrEqual;
                    break;
                case CellConditionType.Greater:
                    Icon = UriResources.Images.Greater16;
                    Text = Localization.ValueFilter_Greater;
                    break;
                case CellConditionType.GreaterOrEqual:
                    Icon = UriResources.Images.GreaterOrEqual16;
                    Text = Localization.ValueFilter_GreaterOrEqual;
                    break;
                case CellConditionType.Between:
                    Icon = UriResources.Images.Between16;
                    Text = Localization.ValueFilter_Between;
                    break;
                case CellConditionType.NotBetween:
                    Icon = UriResources.Images.NotBetween16;
                    Text = Localization.ValueFilter_NotBetween;
                    break;
                case CellConditionType.None:
                    Text = Localization.ComboBoxItem_None;
                    break;
            }
        }
        public void SelectItem(CellConditionType type)
        {
            if (comboBox.Items.Count > 0)
            {
                comboBox.SelectedIndex = 0;
            }
            else
            {
                comboBox.SelectedIndex = -1;
            }

            int i = 0;

            foreach (CellConditionTypeItemControl item in comboBox.Items)
            {
                if (item.Type == type)
                {
                    comboBox.SelectedIndex = i;
                    break;
                }
                i++;
            }
        }
        static CellConditionsDescriptor Deserialize(XmlReader reader)
        {
            if (reader != null)
            {
                try
                {
                    CellConditionsDescriptor target = null;

                    if (!(reader.NodeType == XmlNodeType.Element &&
                          reader.Name == XML_CellConditionsDescriptor))
                    {
                        reader.ReadToFollowing(XML_CellConditionsDescriptor);
                    }

                    if (reader.NodeType == XmlNodeType.Element &&
                        reader.Name == XML_CellConditionsDescriptor)
                    {
                        target = new CellConditionsDescriptor();
                        reader.Read();

                        var data = Jayrock.Json.Conversion.JsonConvert.Import(reader.Value) as JsonArray;
                        target.MemberUniqueName = data[0] != null?CellSetData.ConvertFromJson(data[0]).ToString() : String.Empty;

                        var conditions = data.GetArray(1);
                        for (int i = 0; i < conditions.Length; i++)
                        {
                            var cond_data = conditions.GetArray(i);

                            CellCondition cond = new CellCondition();
                            String        type = cond_data.GetValue(0) != null?cond_data.GetValue(0).ToString() : CellConditionType.None.ToString();

                            cond.ConditionType = (CellConditionType)(CellConditionType.Parse(typeof(CellConditionType), type, true));
                            cond.Value1        = Convert.ToDouble(cond_data.GetValue(1));
                            cond.Value2        = Convert.ToDouble(cond_data.GetValue(2));

                            var cellAppearance = cond_data.GetArray(3);
                            cond.Appearance.BackColor      = FromJsonColor(cellAppearance.GetArray(0));
                            cond.Appearance.BorderColor    = FromJsonColor(cellAppearance.GetArray(1));
                            cond.Appearance.ForeColor      = FromJsonColor(cellAppearance.GetArray(2));
                            cond.Appearance.CustomImageUri = Convert.ToString(cellAppearance.GetValue(3));

                            var options = cellAppearance.GetArray(4);
                            cond.Appearance.Options.IgnoreAllOptions = Convert.ToBoolean(options[0]);
                            cond.Appearance.Options.ShowValue        = Convert.ToBoolean(options[1]);
                            cond.Appearance.Options.UseAllOptions    = Convert.ToBoolean(options[2]);
                            cond.Appearance.Options.UseBackColor     = Convert.ToBoolean(options[3]);
                            cond.Appearance.Options.UseBorderColor   = Convert.ToBoolean(options[4]);
                            cond.Appearance.Options.UseForeColor     = Convert.ToBoolean(options[5]);
                            cond.Appearance.Options.UseImage         = Convert.ToBoolean(options[6]);
                            cond.Appearance.Options.UseProgressBar   = Convert.ToBoolean(options[7]);

                            var progressBarOptions = cellAppearance.GetArray(5);
                            cond.Appearance.ProgressBarOptions.StartColor      = FromJsonColor(progressBarOptions.GetArray(0));
                            cond.Appearance.ProgressBarOptions.EndColor        = FromJsonColor(progressBarOptions.GetArray(1));
                            cond.Appearance.ProgressBarOptions.MinValue        = Convert.ToDouble(progressBarOptions.GetValue(2));
                            cond.Appearance.ProgressBarOptions.MaxValue        = Convert.ToDouble(progressBarOptions.GetValue(3));
                            cond.Appearance.ProgressBarOptions.IsIndeterminate = Convert.ToBoolean(progressBarOptions.GetValue(4));

                            target.Conditions.Add(cond);
                        }

                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_CellConditionsDescriptor)
                        {
                            reader.ReadEndElement();
                        }
                    }
                    return(target);
                }
                catch (XmlException ex)
                {
                    throw ex;
                    //return null;
                }
            }
            return(null);
        }
 public CellCondition(CellConditionType type, double val1, double val2, CellAppearanceObject appearance)
     : this(type, val1, val2)
 {
     m_Appearance = appearance;
 }
 public CellCondition(CellConditionType type, double val1, double val2)
 {
     m_ConditionType = type;
     m_Value1        = val1;
     m_Value2        = val2;
 }
        public CellCondition(CellConditionType type, double val1, double val2, CellAppearanceObject appearance)
            : this(type, val1, val2)
        {

            m_Appearance = appearance;
        }
 public CellCondition(CellConditionType type, double val1, double val2)
 {
     m_ConditionType = type;
     m_Value1 = val1;
     m_Value2 = val2;
 }