void initPivotGridButton_Click(object sender, RoutedEventArgs e)
		{
			// pivotGridControl.URL = WSDataUrl;
			pivotGridControl.Connection = ConnectionStringId;
			pivotGridControl.Query = tbMdxQuery.Text;
			pivotGridControl.UpdateScript = tbUpdateScript.Text;
			pivotGridControl.MembersViewMode = (Ranet.AgOlap.Controls.ViewModeTypes)cbMembersViewMode.SelectedIndex;
			pivotGridControl.MemberVisualizationType = (Ranet.Olap.Core.Data.MemberVisualizationTypes)cbMemberVisualizationType.SelectedIndex;
			pivotGridControl.DataReorganizationType = (Ranet.Olap.Core.Providers.DataReorganizationTypes)cbDataReorganizationType.SelectedIndex;
			pivotGridControl.DefaultMemberAction = (Ranet.AgOlap.Controls.MemberClickBehaviorTypes)cbDefaultMemberAction.SelectedIndex;
			pivotGridControl.ColumnTitleClickBehavior = (Ranet.AgOlap.Controls.ColumnTitleClickBehavior)cbColumnTitleClickBehavior.SelectedIndex;
			pivotGridControl.DrillDownMode = (Ranet.AgOlap.Controls.DrillDownMode)cbDrillDownMode.SelectedIndex;
			pivotGridControl.IsUpdateable = ckbIsUpdateable.IsChecked.Value;
			pivotGridControl.AutoWidthColumns = ckbAutoWidthColumns.IsChecked.Value;
			pivotGridControl.ColumnsIsInteractive = ckbColumnsIsInteractive.IsChecked.Value;
			pivotGridControl.RowsIsInteractive = ckbRowsIsInteractive.IsChecked.Value;
			pivotGridControl.UseColumnsAreaHint = ckbUseColumnsAreaHint.IsChecked.Value;
			pivotGridControl.UseRowsAreaHint = ckbUseRowsAreaHint.IsChecked.Value;
			pivotGridControl.UseCellsAreaHint = ckbUseCellsAreaHint.IsChecked.Value;
			pivotGridControl.UseCellConditionsDesigner = ckbUseCellConditionsDesigner.IsChecked.Value;
			if (!pivotGridControl.UseCellConditionsDesigner)
			{
				var conds = new CellConditionsDescriptor("[Measures].[Internet Sales Amount]");
				var cellApp = new CellAppearanceObject(Colors.Cyan, Colors.Black, Colors.Black);
				cellApp.Options.UseBackColor = true;
				// cellApp.Options.UseBorderColor=true;
				var cond = new CellCondition(CellConditionType.GreaterOrEqual, 1000000.0, 1000000.0, cellApp);
				conds.Conditions.Add(cond);
				pivotGridControl.CustomCellsConditions = new List<CellConditionsDescriptor>();
				pivotGridControl.CustomCellsConditions.Add(conds);
			}
			pivotGridControl.Initialize();
		}
Exemple #2
0
        public void Initialize(CellCondition condition)
        {
            m_Condition = condition;
            IsEnabled   = Condition != null;

            ConditionTypeCombo.EditEnd      -= new EventHandler(ConditionTypeCombo_EditEnd);
            ConditionTypeCombo.ConditionType = Condition != null ? Condition.ConditionType : CellConditionType.None;
            ConditionTypeCombo.Value1        = Condition != null ? Condition.Value1 : 0;
            ConditionTypeCombo.Value2        = Condition != null ? Condition.Value2 : 0;
            ConditionTypeCombo.EditEnd      += new EventHandler(ConditionTypeCombo_EditEnd);

            ShowValue.Checked   -= new RoutedEventHandler(PropertyChecked);
            ShowValue.Unchecked -= new RoutedEventHandler(PropertyChecked);
            ShowValue.IsChecked  = Condition != null ? Condition.Appearance.Options.ShowValue : false;
            ShowValue.Checked   += new RoutedEventHandler(PropertyChecked);
            ShowValue.Unchecked += new RoutedEventHandler(PropertyChecked);

            ShowImage.Checked   -= new RoutedEventHandler(PropertyChecked);
            ShowImage.Unchecked -= new RoutedEventHandler(PropertyChecked);
            ShowImage.IsChecked  = Condition != null ? Condition.Appearance.Options.UseImage : false;
            ShowImage.Checked   += new RoutedEventHandler(PropertyChecked);
            ShowImage.Unchecked += new RoutedEventHandler(PropertyChecked);

            UseBackColor.Checked   -= new RoutedEventHandler(PropertyChecked);
            UseBackColor.Unchecked -= new RoutedEventHandler(PropertyChecked);
            UseBackColor.IsChecked  = Condition != null ? Condition.Appearance.Options.UseBackColor : false;
            UseBackColor.Checked   += new RoutedEventHandler(PropertyChecked);
            UseBackColor.Unchecked += new RoutedEventHandler(PropertyChecked);

            UseForeColor.Checked   -= new RoutedEventHandler(PropertyChecked);
            UseForeColor.Unchecked -= new RoutedEventHandler(PropertyChecked);
            UseForeColor.IsChecked  = Condition != null ? Condition.Appearance.Options.UseForeColor : false;
            UseForeColor.Checked   += new RoutedEventHandler(PropertyChecked);
            UseForeColor.Unchecked += new RoutedEventHandler(PropertyChecked);

            UseAllOptions.Checked   -= new RoutedEventHandler(PropertyChecked);
            UseAllOptions.Unchecked -= new RoutedEventHandler(PropertyChecked);
            UseAllOptions.IsChecked  = Condition != null ? Condition.Appearance.Options.UseAllOptions : false;
            UseAllOptions.Checked   += new RoutedEventHandler(PropertyChecked);
            UseAllOptions.Unchecked += new RoutedEventHandler(PropertyChecked);

            IgnoreAllOptions.Checked   -= new RoutedEventHandler(PropertyChecked);
            IgnoreAllOptions.Unchecked -= new RoutedEventHandler(PropertyChecked);
            IgnoreAllOptions.IsChecked  = Condition != null ? Condition.Appearance.Options.IgnoreAllOptions : false;
            IgnoreAllOptions.Checked   += new RoutedEventHandler(PropertyChecked);
            IgnoreAllOptions.Unchecked += new RoutedEventHandler(PropertyChecked);

            ShowProgressBar.Checked   -= new RoutedEventHandler(PropertyChecked);
            ShowProgressBar.Unchecked -= new RoutedEventHandler(PropertyChecked);
            ShowProgressBar.IsChecked  = Condition != null ? Condition.Appearance.Options.UseProgressBar : false;
            ShowProgressBar.Checked   += new RoutedEventHandler(PropertyChecked);
            ShowProgressBar.Unchecked += new RoutedEventHandler(PropertyChecked);

            numMinValue.Value = Condition != null ? Condition.Appearance.ProgressBarOptions.MinValue : 0;
            numMaxValue.Value = Condition != null ? Condition.Appearance.ProgressBarOptions.MaxValue : 1;

            comboBackColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboBackColor.SelectItem(Condition != null ? Condition.Appearance.BackColor : Colors.Transparent);
            comboBackColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboForeColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboForeColor.SelectItem(Condition != null ? Condition.Appearance.ForeColor : Colors.Transparent);
            comboForeColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboBorderColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboBorderColor.SelectItem(Condition != null ? Condition.Appearance.BorderColor : Colors.Transparent);
            comboBorderColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboStartColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboStartColor.SelectItem(Condition != null ? Condition.Appearance.ProgressBarOptions.StartColor : Colors.Transparent);
            comboStartColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboEndColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboEndColor.SelectItem(Condition != null ? Condition.Appearance.ProgressBarOptions.EndColor : Colors.Transparent);
            comboEndColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            try
            {
                imgCustomImage.Source = Condition != null ? new BitmapImage(new Uri(Condition.Appearance.CustomImageUri, UriKind.Relative)) : null;
            }
            catch { }
        }
        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 void Initialize(CellCondition condition)
        {
            m_Condition = condition;
            IsEnabled = Condition != null;

            ConditionTypeCombo.EditEnd -= new EventHandler(ConditionTypeCombo_EditEnd);
            ConditionTypeCombo.ConditionType = Condition != null ? Condition.ConditionType : CellConditionType.None;
            ConditionTypeCombo.Value1 = Condition != null ? Condition.Value1 : 0;
            ConditionTypeCombo.Value2 = Condition != null ? Condition.Value2 : 0;
            ConditionTypeCombo.EditEnd += new EventHandler(ConditionTypeCombo_EditEnd);

            ShowValue.Checked -= new RoutedEventHandler(PropertyChecked);
            ShowValue.Unchecked -= new RoutedEventHandler(PropertyChecked);
            ShowValue.IsChecked = Condition != null ? Condition.Appearance.Options.ShowValue : false;
            ShowValue.Checked += new RoutedEventHandler(PropertyChecked);
            ShowValue.Unchecked += new RoutedEventHandler(PropertyChecked);

            ShowImage.Checked -= new RoutedEventHandler(PropertyChecked);
            ShowImage.Unchecked -= new RoutedEventHandler(PropertyChecked);
            ShowImage.IsChecked = Condition != null ? Condition.Appearance.Options.UseImage : false;
            ShowImage.Checked += new RoutedEventHandler(PropertyChecked);
            ShowImage.Unchecked += new RoutedEventHandler(PropertyChecked);

            UseBackColor.Checked -= new RoutedEventHandler(PropertyChecked);
            UseBackColor.Unchecked -= new RoutedEventHandler(PropertyChecked);
            UseBackColor.IsChecked = Condition != null ? Condition.Appearance.Options.UseBackColor : false;
            UseBackColor.Checked += new RoutedEventHandler(PropertyChecked);
            UseBackColor.Unchecked += new RoutedEventHandler(PropertyChecked);

            UseForeColor.Checked -= new RoutedEventHandler(PropertyChecked);
            UseForeColor.Unchecked -= new RoutedEventHandler(PropertyChecked);
            UseForeColor.IsChecked = Condition != null ? Condition.Appearance.Options.UseForeColor : false;
            UseForeColor.Checked += new RoutedEventHandler(PropertyChecked);
            UseForeColor.Unchecked += new RoutedEventHandler(PropertyChecked);

            UseAllOptions.Checked -= new RoutedEventHandler(PropertyChecked);
            UseAllOptions.Unchecked -= new RoutedEventHandler(PropertyChecked);
            UseAllOptions.IsChecked = Condition != null ? Condition.Appearance.Options.UseAllOptions : false;
            UseAllOptions.Checked += new RoutedEventHandler(PropertyChecked);
            UseAllOptions.Unchecked += new RoutedEventHandler(PropertyChecked);

            IgnoreAllOptions.Checked -= new RoutedEventHandler(PropertyChecked);
            IgnoreAllOptions.Unchecked -= new RoutedEventHandler(PropertyChecked);
            IgnoreAllOptions.IsChecked = Condition != null ? Condition.Appearance.Options.IgnoreAllOptions : false;
            IgnoreAllOptions.Checked += new RoutedEventHandler(PropertyChecked);
            IgnoreAllOptions.Unchecked += new RoutedEventHandler(PropertyChecked);

            ShowProgressBar.Checked -= new RoutedEventHandler(PropertyChecked);
            ShowProgressBar.Unchecked -= new RoutedEventHandler(PropertyChecked);
            ShowProgressBar.IsChecked = Condition != null ? Condition.Appearance.Options.UseProgressBar : false;
            ShowProgressBar.Checked += new RoutedEventHandler(PropertyChecked);
            ShowProgressBar.Unchecked += new RoutedEventHandler(PropertyChecked);

            numMinValue.Value = Condition != null ? Condition.Appearance.ProgressBarOptions.MinValue : 0;
            numMaxValue.Value = Condition != null ? Condition.Appearance.ProgressBarOptions.MaxValue : 1;

            comboBackColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboBackColor.SelectItem(Condition != null ? Condition.Appearance.BackColor : Colors.Transparent);
            comboBackColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboForeColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboForeColor.SelectItem(Condition != null ? Condition.Appearance.ForeColor : Colors.Transparent);
            comboForeColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboBorderColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboBorderColor.SelectItem(Condition != null ? Condition.Appearance.BorderColor : Colors.Transparent);
            comboBorderColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboStartColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboStartColor.SelectItem(Condition != null ? Condition.Appearance.ProgressBarOptions.StartColor : Colors.Transparent);
            comboStartColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            comboEndColor.ColorsComboBox.SelectionChanged -= new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);
            comboEndColor.SelectItem(Condition != null ? Condition.Appearance.ProgressBarOptions.EndColor : Colors.Transparent);
            comboEndColor.ColorsComboBox.SelectionChanged += new SelectionChangedEventHandler(ColorsComboBox_SelectionChanged);

            try
            {
                imgCustomImage.Source = Condition != null ? new BitmapImage(new Uri(Condition.Appearance.CustomImageUri, UriKind.Relative)) : null;
            }
            catch { }
        }
        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;
        }