Ejemplo n.º 1
0
        public TimeLine()
        {
            InitializeComponent();
            DataContext = this;
            Intervals   = new List <Interval>();
            FullTime    = TimeSpan.FromSeconds(450);

            T1.T_full = FullTime;
            T1.T_el   = TimeSpan.FromSeconds(60);
            T1.ChangeDashesHeight(12);
            T1.ChangeDashesWidth(1);

            T2.T_full = FullTime;
            T2.T_el   = TimeSpan.FromSeconds(10);
            T2.ChangeDashesHeight(6);

            Cursor1.Container = this;


            Binding binding = new Binding();

            binding.ElementName = "Cursor1";                      // элемент-источник
            binding.Path        = new PropertyPath("CRPosition"); // свойство элемента-источника
            binding.Mode        = BindingMode.TwoWay;
            this.SetBinding(TimeLine.POSProperty, binding);       // установка привязки для элемента-приемника

            OnPOSChanged         += TimeLine_OnPOSChanged;
            Cursor1.OnCRPChanged += Cursor1_OnCRPChanged;
            Cursor1.OnStartDrag  += Cursor1_OnStartDrag;
            Cursor1.OnEndDrag    += Cursor1_OnEndDrag;



            OnSelectedItemChanged += TimeLine_OnSelectedItemChanged;
        }
Ejemplo n.º 2
0
        void RefreshDashes()
        {
            T1.T_full  = FullTime;
            T2.T_full  = FullTime;
            T10.T_full = FullTime;

            T1.T_el  = TimeSpan.FromSeconds(60);
            T2.T_el  = TimeSpan.FromSeconds(10);
            T10.T_el = TimeSpan.FromSeconds(600);


            int N = (int)Math.Round((FullTime.TotalSeconds / T1.T_el.TotalSeconds)) + 1;

            T1.ClearDashes();
            T1.FillDashes(N);

            N = (int)Math.Round((FullTime.TotalSeconds / T2.T_el.TotalSeconds)) + 1;
            T2.ClearDashes();
            T2.FillDashes(N);

            N = (int)Math.Round((FullTime.TotalSeconds / T10.T_el.TotalSeconds)) + 1;
            T10.ClearDashes();
            T10.FillDashes(N);


            T1.ChangeDashesHeight(12);
            T1.ChangeDashesWidth(1);

            T2.ChangeDashesHeight(6);

            T10.ChangeDashesHeight(18);
            T10.ChangeDashesWidth(2);

            T1.Visibility  = Visibility.Visible;
            T2.Visibility  = Visibility.Visible;
            T10.Visibility = Visibility.Visible;

            if (FullTime < TimeSpan.FromMinutes(1))
            {
                T1.TimeLabelVisibility  = Visibility.Hidden;
                T2.TimeLabelVisibility  = Visibility.Visible;
                T10.TimeLabelVisibility = Visibility.Hidden;
            }
            else if (FullTime < TimeSpan.FromMinutes(20))
            {
                T1.TimeLabelVisibility  = Visibility.Visible;
                T2.TimeLabelVisibility  = Visibility.Hidden;
                T10.TimeLabelVisibility = Visibility.Hidden;
            }
            else if (FullTime >= TimeSpan.FromMinutes(20))
            {
                T1.TimeLabelVisibility  = Visibility.Hidden;
                T2.TimeLabelVisibility  = Visibility.Hidden;
                T10.TimeLabelVisibility = Visibility.Visible;
                T2.Visibility           = Visibility.Hidden;
            }
        }
Ejemplo n.º 3
0
        public TimeLine()
        {
            InitializeComponent();

            Intervals = new ObservableCollection <Interval>();
            FullTime  = TimeSpan.FromSeconds(450);

            T1.T_full = FullTime;
            T1.T_el   = TimeSpan.FromSeconds(60);
            T1.ChangeDashesHeight(12);
            T1.ChangeDashesWidth(1);

            T2.T_full = FullTime;
            T2.T_el   = TimeSpan.FromSeconds(10);
            T2.ChangeDashesHeight(6);

            Cursor1.Container = this;
        }
Ejemplo n.º 4
0
        void RefreshDashes()
        {
            T1.T_full       = FullTime;
            T_tenSec.T_full = FullTime;
            T_Sec.T_full    = FullTime;
            T10.T_full      = FullTime;

            T1.T_el       = TimeSpan.FromSeconds(60);
            T_tenSec.T_el = TimeSpan.FromSeconds(10);
            T_Sec.T_el    = TimeSpan.FromSeconds(1);
            T10.T_el      = TimeSpan.FromSeconds(600);


            int N = (int)Math.Round((FullTime.TotalSeconds / T1.T_el.TotalSeconds)) + 2;

            T1.ClearDashes();
            T1.FillDashes(N);

            N = (int)Math.Round((FullTime.TotalSeconds / T_tenSec.T_el.TotalSeconds)) + 2;
            T_tenSec.ClearDashes();
            T_tenSec.FillDashes(N);

            if (FullTime.TotalSeconds < 60)
            {
                N = (int)Math.Round((FullTime.TotalSeconds / T_Sec.T_el.TotalSeconds)) + 2;
                T_Sec.ClearDashes();
                T_Sec.FillDashes(N);
            }

            N = (int)Math.Round((FullTime.TotalSeconds / T10.T_el.TotalSeconds)) + 2;
            T10.ClearDashes();
            T10.FillDashes(N);


            T1.ChangeDashesHeight(20);
            T1.ChangeDashesWidth(1);

            T_tenSec.ChangeDashesHeight(14);

            T_Sec.ChangeDashesHeight(10);

            T10.ChangeDashesHeight(26);
            T10.ChangeDashesWidth(2);

            T1.Visibility       = Visibility.Visible;
            T_tenSec.Visibility = Visibility.Visible;
            T_Sec.Visibility    = Visibility.Visible;
            T10.Visibility      = Visibility.Visible;

            if (FullTime < TimeSpan.FromMinutes(0.5))
            {
                T1.TimeLabelVisibility       = Visibility.Hidden;
                T_tenSec.TimeLabelVisibility = Visibility.Visible;
                T_Sec.TimeLabelVisibility    = Visibility.Visible;
                T10.TimeLabelVisibility      = Visibility.Hidden;
            }
            else if (FullTime < TimeSpan.FromMinutes(30))
            {
                T1.TimeLabelVisibility       = Visibility.Visible;
                T_tenSec.TimeLabelVisibility = Visibility.Hidden;
                T_Sec.TimeLabelVisibility    = Visibility.Hidden;
                T10.TimeLabelVisibility      = Visibility.Visible;
                T_Sec.Visibility             = Visibility.Hidden;
            }
            else if (FullTime >= TimeSpan.FromMinutes(30))
            {
                T1.TimeLabelVisibility       = Visibility.Hidden;
                T_tenSec.TimeLabelVisibility = Visibility.Hidden;
                T_Sec.TimeLabelVisibility    = Visibility.Hidden;
                T10.TimeLabelVisibility      = Visibility.Visible;
                T_tenSec.Visibility          = Visibility.Hidden;
                T_Sec.Visibility             = Visibility.Hidden;
            }

            T_Sec.HideRepeatedDashes(T_tenSec.Dashes);
            T_tenSec.HideRepeatedDashes(T1.Dashes);
            T1.HideRepeatedDashes(T10.Dashes);
        }