예제 #1
0
        /// <summary>
        /// Create the static resources required for a FluidTrade.FluidTradeClient.ViewerEquityBlotter.
        /// </summary>
        static ViewerEquityBlotter()
        {
            // AnimationSpeed Property
            ViewerEquityBlotter.AnimationSpeedProperty = DependencyProperty.Register(
                "AnimationSpeed",
                typeof(AnimationSpeed),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(AnimationSpeed.Off, new PropertyChangedCallback(OnAnimationSpeedChanged)));

            // IsFilledFilter Property
            ViewerEquityBlotter.IsFilledFilterProperty = DependencyProperty.Register(
                "IsFilledFilter",
                typeof(Boolean),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(false, new PropertyChangedCallback(OnIsFilledFilterChanged)));

            // IsHeaderFrozen Property
            ViewerEquityBlotter.IsHeaderFrozenProperty = DependencyProperty.Register(
                "IsHeaderFrozen",
                typeof(Boolean),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(true, new PropertyChangedCallback(OnIsHeaderFrozenChanged)));

            // IsLayoutFrozen Property
            ViewerEquityBlotter.IsLayoutFrozenProperty = DependencyProperty.Register(
                "IsLayoutFrozen",
                typeof(Boolean),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(true, new PropertyChangedCallback(OnIsLayoutFrozenChanged)));

            // IsNavigationPaneVisible Property
            ViewerEquityBlotter.IsNavigationPaneVisibleProperty = DependencyProperty.Register(
                "IsNavigationPaneVisible",
                typeof(Boolean),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(true, new PropertyChangedCallback(OnIsNavigationPaneVisibleChanged)));

            // IsRunningFilter Property
            ViewerEquityBlotter.IsRunningFilterProperty = DependencyProperty.Register(
                "IsRunningFilter",
                typeof(Boolean),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(false, new PropertyChangedCallback(OnIsRunningFilterChanged)));

            // Scale Property
            ViewerEquityBlotter.ScaleProperty = DependencyProperty.Register(
                "Scale",
                typeof(Double),
                typeof(ViewerEquityBlotter),
                new FrameworkPropertyMetadata(1.0, new PropertyChangedCallback(OnScaleChanged)));

            // For performance purposes, a single, shared report is used to display all content.  Since the greatest delays are incurred when elements are
            // removed and added to the visual tree, recycling the same report makes things appear quicker because the visual elements remain in place but the
            // data bindings to those elements points to the new content.
            ViewerEquityBlotter.reportWorkingOrder = new ReportEquityWorkingOrder();
            ViewerEquityBlotter.reportMatch        = new ReportMatch();
            ViewerEquityBlotter.reportExecution    = new ExecutionReport();
            ViewerEquityBlotter.negotiationConsole = new NegotiationConsole();
        }
        /// <summary>
        /// Handles a change to the animation speed.
        /// </summary>
        /// <param name="dependencyObject">The object that owns the property.</param>
        /// <param name="dependencyPropertyChangedEventArgs">A description of the changed property.</param>
        private static void OnAnimationSpeedChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            // Set the speed for animation.
            ReportEquityWorkingOrder reportPrototype = dependencyObject as ReportEquityWorkingOrder;
            AnimationSpeed           animationSpeed  = (AnimationSpeed)dependencyPropertyChangedEventArgs.NewValue;

            reportPrototype.Duration = ReportEquityWorkingOrder.animationDurations[(Int32)animationSpeed];
        }
        private void OnTextChanged(object sender, RoutedEventArgs routedEventArgs)
        {
            TextBox textBox = routedEventArgs.OriginalSource as TextBox;
            ReportEquityWorkingOrder report = sender as ReportEquityWorkingOrder;

            if (textBox == null || report == null)
            {
                return;
            }

            if (InputHelper.IsUserInitiated(textBox, TextBox.TextProperty))
            {
                report.CurrentSelectionChanged = true;
            }
        }
        /// <summary>
        /// Handler for the textbox class
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="routedEventArgs"></param>
        private void OnTextBoxLostFocus(object sender, RoutedEventArgs routedEventArgs)
        {
            TextBox textBox = routedEventArgs.OriginalSource as TextBox;
            ReportEquityWorkingOrder report = sender as ReportEquityWorkingOrder;

            if (textBox == null || report == null)
            {
                return;
            }

            IContent iContent = textBox.DataContext as IContent;

            // This filters all the ComboBox events looking for user initiated actions that are bound to the data model.
            if (report.CurrentSelectionChanged == true && iContent != null && iContent.Key is DataTableCoordinate)
            {
                DataTableCoordinate dataTableCoordiante = iContent.Key as DataTableCoordinate;
                ConsumerRow         workingOrderRow     = dataTableCoordiante.DataRow as ConsumerRow;

                report.CurrentSelectionChanged = false;
            }
        }
        /// <summary>
        /// Handles a change to the status of the 'Running' filter.
        /// </summary>
        /// <param name="dependencyObject">The object that owns the property.</param>
        /// <param name="dependencyPropertyChangedEventArgs">A description of the changed property.</param>
        private static void OnIsRunningFilterChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            // Insall or remove the filter for the filled orders.
            ReportEquityWorkingOrder reportPrototype = dependencyObject as ReportEquityWorkingOrder;
            Boolean isRunningFilter = (Boolean)dependencyPropertyChangedEventArgs.NewValue;

            if (isRunningFilter)
            {
                if (!reportPrototype.filter.Contains(reportPrototype.FilterRunningOrders))
                {
                    reportPrototype.filter.Add(reportPrototype.FilterRunningOrders);
                }
            }
            else
            {
                if (reportPrototype.filter.Contains(reportPrototype.FilterRunningOrders))
                {
                    reportPrototype.filter.Remove(reportPrototype.FilterRunningOrders);
                }
            }

            // Once the filter is changed, the report will need to be regenerated.
            reportPrototype.Refresh();
        }