Exemplo n.º 1
0
        public void Creation()
        {
            TickBar p = new TickBar();

            Assert.AreEqual(p.Minimum, 0, "Minimum");
            Assert.AreEqual(p.Maximum, 100, "Maximum");
            Assert.AreEqual(p.Placement, TickBarPlacement.Top, "Placement");
            Assert.AreEqual(p.TickFrequency, 1, "Placement");
            Assert.IsTrue(p.IsEnabled, "IsEnabled");
            Assert.IsTrue(p.SnapsToDevicePixels, "SnapsToDevicePixels");
        }
Exemplo n.º 2
0
 void Bind(TickBar tickBar)
 {
     Utility.SetBinding(tickBar, TickBar.IsDirectionReversedProperty, this, "IsDirectionReversed");
     Utility.SetBinding(tickBar, TickBar.IsSelectionRangeEnabledProperty, this, "IsSelectionRangeEnabled");
     Utility.SetBinding(tickBar, TickBar.MaximumProperty, this, "Maximum");
     Utility.SetBinding(tickBar, TickBar.MinimumProperty, this, "Minimum");
     Utility.SetBinding(tickBar, TickBar.SelectionEndProperty, this, "SelectionEnd");
     Utility.SetBinding(tickBar, TickBar.SelectionStartProperty, this, "SelectionStart");
     Utility.SetBinding(tickBar, TickBar.TickFrequencyProperty, this, "TickFrequency");
     Utility.SetBinding(tickBar, TickBar.TicksProperty, this, "Ticks");
 }
Exemplo n.º 3
0
            public BindingsSlider()
            {
                Window w = new Window();

                w.Show();
                w.Content = this;
                ApplyTemplate();
                TickBar bottom_tick = (TickBar)GetTemplateChild("BottomTick");

                Assert.IsNull(bottom_tick.DataContext);
            }
Exemplo n.º 4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            track = (Track)GetTemplateChild("PART_Track");
            if (track == null)
            {
                return;
            }
            Utility.SetBinding(track, Track.MaximumProperty, this, "Maximum");
            Utility.SetBinding(track, Track.MinimumProperty, this, "Minimum");
            Utility.SetBinding(track, Track.ValueProperty, this, "Value");
            Utility.SetBinding(track, Track.OrientationProperty, this, "Orientation");
            Utility.SetBinding(track, Track.IsDirectionReversedProperty, this, "IsDirectionReversed");
            SetSelectionRangeBounds();
            Bind(track.DecreaseRepeatButton);
            Bind(track.IncreaseRepeatButton);
            TickBar top_tick = GetTopTick();

            if (top_tick != null)
            {
                Bind(top_tick);
                Bind(GetBottomTick());
                track.SizeChanged += delegate(object sender, SizeChangedEventArgs e)
                {
                    UpdateReservedSpace();
                };
            }
            Thumb thumb = track.Thumb;

            #region Auto tool tip
            if (auto_tool_tip != null)
            {
                SetAutoToolTipPlacementTarget(track);
            }
            #endregion
            #region Thumb drag methods
            //FIXME: Do I need to remove these handlers?
            thumb.DragStarted += delegate(object sender, global::System.Windows.Controls.Primitives.DragStartedEventArgs e)
            {
                OnThumbDragStarted(e);
            };

            thumb.DragDelta += delegate(object sender, global::System.Windows.Controls.Primitives.DragDeltaEventArgs e)
            {
                OnThumbDragDelta(e);
            };

            thumb.DragCompleted += delegate(object sender, global::System.Windows.Controls.Primitives.DragCompletedEventArgs e)
            {
                OnThumbDragCompleted(e);
            };
            #endregion
        }
Exemplo n.º 5
0
        public void SetBarType(MinBarType tp)
        {
            if (tp == MinBarType.BTick)
            {
                TickBar = m_TickBar;
            }
            else
            {
                TickBar = m_OneMinBar;
            }

            TickBar.FitScreen();
        }
Exemplo n.º 6
0
        public CandleContext()
        {
            ClickPoint = new Point();

            //TickBar = new TickBar();

            m_TickBar   = new TickBar();
            m_OneMinBar = new OneMinBar();

            TickBar = m_TickBar;

            //TickBar = new OneMinBar();
        }
Exemplo n.º 7
0
        //public static MarketData TransferMarketData(XAPI.DepthMarketDataNClass marketData)
        //{
        //    MarketData rspMarketData = new MarketData();
        //    XAPI.DepthField bidField = marketData.Bids[0];
        //    XAPI.DepthField askField = marketData.Asks[0];
        //    rspMarketData.BuyMount = askField.Size;
        //    rspMarketData.BuyPrice = (float)askField.Price;
        //    rspMarketData.SellMount = bidField.Size;
        //    rspMarketData.SellPrice = (float)bidField.Price;
        //    rspMarketData.Price = (float)marketData.OpenPrice;
        //    rspMarketData.Time = marketData.ActionDay + Math.Round(((double)marketData.UpdateTime) / 100000, 6);

        //    return rspMarketData;
        //}

        public static ITickBar TransferTickBar(XAPI.DepthMarketDataNClass xapiMarketData)
        {
            TickBar tickBar = new TickBar();

            //tickBar.Code = transferCode(xapiMarketData.InstrumentID);
            tickBar.Code       = xapiMarketData.InstrumentID;
            tickBar.Time       = xapiMarketData.ActionDay + Math.Round((double)xapiMarketData.UpdateTime / 1000000, 6);
            tickBar.Price      = (float)xapiMarketData.LastPrice;
            tickBar.Mount      = 0;
            tickBar.TotalMount = (int)xapiMarketData.Volume;
            tickBar.Add        = 0;
            tickBar.Hold       = (int)xapiMarketData.OpenInterest;
            tickBar.BuyMount   = xapiMarketData.Bids.Length == 0 ? 0 : xapiMarketData.Bids[0].Size;
            tickBar.BuyPrice   = xapiMarketData.Bids.Length == 0 ? 0 : (float)xapiMarketData.Bids[0].Price;
            tickBar.IsBuy      = xapiMarketData.LastPrice == tickBar.BuyPrice;
            tickBar.SellMount  = xapiMarketData.Asks.Length == 0 ? 0 : xapiMarketData.Asks[0].Size;
            tickBar.SellPrice  = xapiMarketData.Asks.Length == 0 ? 0 : (float)xapiMarketData.Asks[0].Price;
            return(tickBar);
        }
Exemplo n.º 8
0
            public LayoutSlider()
            {
                Window w = new Window();

                w.Show();
                w.Content     = this;
                TickPlacement = TickPlacement.Both;
                ApplyTemplate();
                Width          = 100;
                SelectionStart = 4;
                SelectionEnd   = 9;
                Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                Arrange(new Rect(new Point(), DesiredSize));
                TickBar bottom_tick = (TickBar)GetTemplateChild("BottomTick");

                Assert.AreEqual(bottom_tick.ActualWidth, 100, "bottom_tick.ActualWidth");
                FrameworkElement selection_range = (FrameworkElement)GetTemplateChild("PART_SelectionRange");

                Assert.AreEqual(selection_range.ActualWidth, 1, "selection_range.ActualWidth");
                Assert.AreEqual(Canvas.GetLeft(selection_range), 41.100000000000001d, "Canvas.GetLeft(selection_range)");
            }
Exemplo n.º 9
0
            public TickBarSlider()
            {
                Window w = new Window();

                w.Content = this;
                w.Show();
                OnApplyTemplate();
                TickBar top_tick = (TickBar)GetTemplateChild("TopTick");
                Track   track    = (Track)GetTemplateChild("PART_Track");

                Assert.IsTrue(top_tick.SnapsToDevicePixels, "SnapsToDevicePixels");
                Assert.AreEqual(top_tick.ActualWidth, 0, "ActualWidth");
                TickPlacement = TickPlacement.Both;
                Assert.AreEqual(top_tick.ActualWidth, 0, "ActualWidth 2");
                Assert.AreEqual(top_tick.Width, double.NaN, "Width 2");
                Assert.AreEqual(top_tick.Margin.Right, 0, "Margin.Right");
                Assert.AreEqual(top_tick.Placement, TickBarPlacement.Top, "TopTick Placement 2");
                TickBar bottom_tick = (TickBar)GetTemplateChild("BottomTick");

                Assert.AreEqual(bottom_tick.Placement, TickBarPlacement.Bottom, "BottomTick Placement 2");
                Assert.AreEqual(top_tick.ReservedSpace, 0, "ReservedSpace");
            }
 public static IObservable <EventPattern <DragEventArgs> > DropObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(h => This.Drop += h, h => This.Drop -= h));
 }
 public static IObservable <EventPattern <MouseButtonEventArgs> > MouseLeftButtonDownObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.MouseLeftButtonDown += h, h => This.MouseLeftButtonDown -= h));
 }
Exemplo n.º 12
0
		void Bind (TickBar tickBar)
		{
			Utility.SetBinding (tickBar, TickBar.IsDirectionReversedProperty, this, "IsDirectionReversed");
			Utility.SetBinding (tickBar, TickBar.IsSelectionRangeEnabledProperty, this, "IsSelectionRangeEnabled");
			Utility.SetBinding (tickBar, TickBar.MaximumProperty, this, "Maximum");
			Utility.SetBinding (tickBar, TickBar.MinimumProperty, this, "Minimum");
			Utility.SetBinding (tickBar, TickBar.SelectionEndProperty, this, "SelectionEnd");
			Utility.SetBinding (tickBar, TickBar.SelectionStartProperty, this, "SelectionStart");
			Utility.SetBinding (tickBar, TickBar.TickFrequencyProperty, this, "TickFrequency");
			Utility.SetBinding (tickBar, TickBar.TicksProperty, this, "Ticks");
		}
 public static IObservable <EventPattern <TouchEventArgs> > TouchLeaveObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.TouchLeave += h, h => This.TouchLeave -= h));
 }
 public static IObservable <EventPattern <MouseButtonEventArgs> > PreviewMouseUpObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.PreviewMouseUp += h, h => This.PreviewMouseUp -= h));
 }
 public static IObservable <EventPattern <GiveFeedbackEventArgs> > GiveFeedbackObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <GiveFeedbackEventHandler, GiveFeedbackEventArgs>(h => This.GiveFeedback += h, h => This.GiveFeedback -= h));
 }
 public static IObservable <EventPattern <TextCompositionEventArgs> > TextInputObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <TextCompositionEventHandler, TextCompositionEventArgs>(h => This.TextInput += h, h => This.TextInput -= h));
 }
 public static IObservable <EventPattern <ManipulationInertiaStartingEventArgs> > ManipulationInertiaStartingObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationInertiaStartingEventArgs>, ManipulationInertiaStartingEventArgs>(h => This.ManipulationInertiaStarting += h, h => This.ManipulationInertiaStarting -= h));
 }
 public static IObservable <EventPattern <ManipulationBoundaryFeedbackEventArgs> > ManipulationBoundaryFeedbackObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationBoundaryFeedbackEventArgs>, ManipulationBoundaryFeedbackEventArgs>(h => This.ManipulationBoundaryFeedback += h, h => This.ManipulationBoundaryFeedback -= h));
 }
 public static IObservable <EventPattern <RoutedEventArgs> > LostFocusObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.LostFocus += h, h => This.LostFocus -= h));
 }
 public static IObservable <EventPattern <TouchEventArgs> > PreviewTouchUpObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.PreviewTouchUp += h, h => This.PreviewTouchUp -= h));
 }
 public static IObservable <EventPattern <EventArgs> > LayoutUpdatedObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(h => This.LayoutUpdated += h, h => This.LayoutUpdated -= h));
 }
 public static IObservable <EventPattern <RoutedEventArgs> > UnloadedObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.Unloaded += h, h => This.Unloaded -= h));
 }
 public static IObservable <EventPattern <DependencyPropertyChangedEventArgs> > IsStylusCaptureWithinChangedObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(h => This.IsStylusCaptureWithinChanged += h, h => This.IsStylusCaptureWithinChanged -= h));
 }
 public static IObservable <EventPattern <EventArgs> > InitializedObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(h => This.Initialized += h, h => This.Initialized -= h));
 }
 public static IObservable <EventPattern <ManipulationCompletedEventArgs> > ManipulationCompletedObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationCompletedEventArgs>, ManipulationCompletedEventArgs>(h => This.ManipulationCompleted += h, h => This.ManipulationCompleted -= h));
 }
 public static IObservable <EventPattern <DragEventArgs> > PreviewDragLeaveObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(h => This.PreviewDragLeave += h, h => This.PreviewDragLeave -= h));
 }
 public static IObservable <EventPattern <ToolTipEventArgs> > ToolTipClosingObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <ToolTipEventHandler, ToolTipEventArgs>(h => This.ToolTipClosing += h, h => This.ToolTipClosing -= h));
 }
 public static IObservable <EventPattern <QueryContinueDragEventArgs> > QueryContinueDragObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <QueryContinueDragEventHandler, QueryContinueDragEventArgs>(h => This.QueryContinueDrag += h, h => This.QueryContinueDrag -= h));
 }
 public static IObservable <EventPattern <ContextMenuEventArgs> > ContextMenuClosingObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <ContextMenuEventHandler, ContextMenuEventArgs>(h => This.ContextMenuClosing += h, h => This.ContextMenuClosing -= h));
 }
 public static IObservable <EventPattern <DependencyPropertyChangedEventArgs> > FocusableChangedObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(h => This.FocusableChanged += h, h => This.FocusableChanged -= h));
 }
 public static IObservable <EventPattern <TouchEventArgs> > LostTouchCaptureObserver(this TickBar This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.LostTouchCapture += h, h => This.LostTouchCapture -= h));
 }