| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- namespace MuchInfo.Chart.WPF.Controls.ValueScaling
- {
- /// <summary>
- /// ValueScaleDisplayCollection.xaml 的交互逻辑
- /// </summary>
- 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<UIElement> 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<UIElement> 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);
- }
- /// <summary>
- /// 若stackMain中有Element则显示,否则隐藏初始内容
- /// </summary>
- 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
- }
- }
|