using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace MuchInfo.Chart.WPF.Controls.ValueScaling { /// /// ValueScaleDisplayCollection.xaml 的交互逻辑 /// public partial class ValueScaleDisplayCollection : UserControl { #region Fields private bool ValueScaleDisplayCollection_1984; #endregion Fields #region Constructors public ValueScaleDisplayCollection() { this.SelectedIndexXml = -1; this.ValueScaleDisplayCollection_1984 = false; this.InitializeComponent(); this.borderControls.Visibility = Visibility.Collapsed; } #endregion Constructors #region Properties #region Public Properties public int SelectedIndexXml { get; set; } #endregion Public Properties #endregion Properties #region Methods #region Public Methods public object AddScale(FrameworkElement aScale) { this.stackMain.Children.Add(aScale); this.ValueScaleDisplayCollection_5629(); return null; } public object DoPending() { bool flag = !this.ValueScaleDisplayCollection_1984; if (flag) { this.ValueScaleDisplayCollection_1984 = true; this.ValueScaleDisplayCollection_5631(); } object result = null; return result; } public object RemoveScale(FrameworkElement aScale) { bool flag = this.stackMain.Children.Contains(aScale); if (flag) { this.stackMain.Children.Remove(aScale); this.ValueScaleDisplayCollection_5629(); } object result = null; return result; } #endregion Public Methods #region Internal Methods internal FrameworkElement ValueScaleDisplayCollection_5630() { bool flag = this.borderControls.Visibility == Visibility.Visible; FrameworkElement result; if (flag) { result = this.borderRight; } else { result = null; } return result; } internal void ValueScaleDisplayCollection_5631() { bool flag = this.SelectedIndexXml >= 0 && this.SelectedIndexXml < this.stackMain.Children.Count; checked { if (flag) { int num = 0; try { var enumerator = this.stackMain.Children.GetEnumerator(); while (enumerator.MoveNext()) { var current = enumerator.Current as UIElement; flag = (num == this.SelectedIndexXml); if (flag) { current.Visibility = Visibility.Visible;// Visibility.Visible; } else { current.Visibility = Visibility.Collapsed;//Visibility.Collapsed; } num++; } } finally { //IEnumerator enumerator; //flag = (enumerator != null); //if (flag) //{ // enumerator.Dispose(); //} } } else { this.SelectedIndexXml = -1; try { var enumerator2 = this.stackMain.Children.GetEnumerator(); while (enumerator2.MoveNext()) { var current2 = enumerator2.Current as UIElement; current2.Visibility = Visibility.Visible; } } finally { //IEnumerator enumerator2; //flag = (enumerator2 != null); //if (flag) //{ // enumerator2.Dispose(); //} } } } } #endregion Internal Methods #region Private Methods private void borderControls_MouseEnter(object sender, MouseEventArgs e) { this.borderRight.Opacity = (1.0); } private void borderControls_MouseLeave(object sender, MouseEventArgs e) { this.borderRight.Opacity = (0.5); } private void borderRight_MouseEnter(object sender, MouseEventArgs e) { //ChartToolTip.ShowTip(this.borderRight, e, "Toggle Scale Display"); } private void borderRight_MouseLeave(object sender, MouseEventArgs e) { //ChartToolTip.HideTip(this.borderRight); } private void borderRight_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.ValueScaleDisplayCollection_5632(); //TutorialActions.RaiseTutorialAction(TutorialActions.eTutorialAction.MultiScaleToggle); } /// /// 若stackMain中有Element则显示,否则隐藏初始内容 /// private void ValueScaleDisplayCollection_5629() { bool flag = this.stackMain.Children.Count > 1; if (flag) { this.borderControls.Visibility = Visibility.Visible;//Visibility.Visible; } else { this.borderControls.Visibility = Visibility.Collapsed;// Visibility.Collapsed; this.SelectedIndexXml = 0; } this.ValueScaleDisplayCollection_5631(); } private void ValueScaleDisplayCollection_5632() { checked { this.SelectedIndexXml++; this.ValueScaleDisplayCollection_5631(); } } #endregion Private Methods #endregion Methods } }