public ScreenControl()
        {
            InitializeComponent();
            this.ScreenGrid.Height = m_BoxEnd.Y;
            this.ScreenGrid.Width = m_BoxEnd.X;
            this.telemetryCollection = new List<TelemetryObject>();
            this.ghostCollection = new List<GhostObject>();
            InitializeBackgroundWorker();

            //-- Create Random trailing lines ...
            for (int trailCount = 0; trailCount < 15; trailCount++)
            {
                GhostObject go = new GhostObject();
                int nextGhostTrailx = 0;
                nextGhostTrailx = getNextGhostTrailx();
                int randHeight = rand.Next((int)(m_BoxEnd.Y - (20 * charTall)), 100);
                go.xPos = nextGhostTrailx;
                go.yPos = randHeight;
                ghostCollection.Add(go);
            }

            RefreshTelemetry();
            UpdateScreen();
        }
Beispiel #2
0
        public ScreenControl()
        {
            InitializeComponent();
            this.ScreenGrid.Height   = m_BoxEnd.Y;
            this.ScreenGrid.Width    = m_BoxEnd.X;
            this.telemetryCollection = new List <TelemetryObject>();
            this.ghostCollection     = new List <GhostObject>();
            InitializeBackgroundWorker();

            //-- Create Random trailing lines ...
            for (int trailCount = 0; trailCount < 15; trailCount++)
            {
                GhostObject go = new GhostObject();
                int         nextGhostTrailx = 0;
                nextGhostTrailx = getNextGhostTrailx();
                int randHeight = rand.Next((int)(m_BoxEnd.Y - (20 * charTall)), 100);
                go.xPos = nextGhostTrailx;
                go.yPos = randHeight;
                ghostCollection.Add(go);
            }

            RefreshTelemetry();
            UpdateScreen();
        }
        protected override void OnRender(DrawingContext dc)
        {
            m_BoxEnd.X = this.ScreenGrid.Width;
            m_BoxEnd.Y = this.ScreenGrid.Height;

            SolidColorBrush backgroundBrush = new SolidColorBrush();
            backgroundBrush = BackColor as SolidColorBrush;
            Pen outerRectPen = new Pen(m_BorderColor, m_BorderWidth);

            // Main outer rectangle ...
            Rect outerRect = new Rect(m_Start, m_BoxEnd);
            dc.DrawRectangle(backgroundBrush, outerRectPen, outerRect);

            FormattedText printText;

            List<TelemetryObject> dispTelemetry = new List<TelemetryObject>();
            dispTelemetry = telemetryCollection;

            foreach (TelemetryObject thisObj in dispTelemetry.ToList<TelemetryObject>())
            {
                // Increment Y value
                thisObj.yPos++;

                //------ Advance the active item -------
                thisObj.yPos = thisObj.yPos + (m_ScrollSpeed / m_SpeedMultiplier);
                printBrush = activeBrush;

                // -- Display the active data ...
                char[] printArray = thisObj.telemetryData.ToCharArray();
                for (int printCount = 0; printCount < thisObj.telemetryData.Length; printCount++)
                {
                    // Print the Item Vertical
                    printText = new FormattedText(
                        printArray[printCount].ToString().ToUpper(),
                        CultureInfo.GetCultureInfo("en-us"),
                        FlowDirection.LeftToRight,
                        new Typeface("Georgia"),
                        10,
                        printBrush);
                    // Do not draw outside the box ...
                    //          if ( (thisObj.yPos + (printCount * charTall)) < m_BoxEnd.Y)
                    if (((thisObj.yPos - (int)(printCount * charTall)) + BorderWidth < m_BoxEnd.Y) && ((thisObj.yPos - (int)printCount * charTall) > m_Start.Y + m_YStart))
                        dc.DrawText(printText, new Point(thisObj.xPos, thisObj.yPos + (printCount * charTall)));
                }

                //-- Trail behind the active item ...
                //if (thisObj.yPos > (thisObj.telemetryData.Length * charTall))
                for (float trailCount = 0; trailCount < (thisObj.tailArray.Length - 1); trailCount++)
                {
                    if (trailCount <= m_TailFrontLength) printBrush = trailBrush;
                    else
                        printBrush = ghostBrush;
                    printText = new FormattedText(
                        thisObj.tailArray[(int)trailCount].ToString(),
                        CultureInfo.GetCultureInfo("en-us"),
                        FlowDirection.LeftToRight,
                        new Typeface("Verdana"),
                        10,
                        printBrush);
                    // Do not draw outside the box ...  Bottom && Top
                    if (((thisObj.yPos - (int)(trailCount * charTall)) + BorderWidth < m_BoxEnd.Y) && ((thisObj.yPos - (int)trailCount * charTall) > m_Start.Y + m_YStart))
                    {
                        dc.DrawText(printText, new Point(thisObj.xPos, ((thisObj.yPos - charTall) - (int)trailCount * charTall)));
                    }
                }
            }

            // -- Clear out any items that have scrolled off screen...
            List<TelemetryObject> cleanedCollection = new List<TelemetryObject>();
            foreach (TelemetryObject thisObj in telemetryCollection)
            {
                if ((m_BoxEnd.Y + (thisObj.tailArray.Length * charTall) + (thisObj.telemetryData.Length * charTall)) > thisObj.yPos)
                {
                    cleanedCollection.Add(thisObj);
                }
                else
                {
                    xPos[(int)thisObj.xPos] = 0;
                    //printStatus("Remove: " + thisObj.telemetryData, dc);
                }
            }
            telemetryCollection = cleanedCollection;

            foreach (GhostObject ghostTrail in ghostCollection)
            {
                // Advance ghost scrollers
                ghostTrail.yPos = ghostTrail.yPos + (m_GhostScrollSpeed / m_SpeedMultiplier);
                printBrush = ghostBrush;
                char[] printArray = ghostTrail.tailArray;
                for (int printCount = 0; printCount < ghostTrail.tailArray.Length; printCount++)
                {
                    // Print the Item Vertical
                    printText = new FormattedText(
                    printArray[printCount].ToString(),
                              CultureInfo.GetCultureInfo("en-us"),
                              FlowDirection.LeftToRight,
                              new Typeface(m_GhostFont),
                              10,
                              printBrush);
                    // Do not draw outside the box ...  Bottom && Top
                    if (((ghostTrail.yPos - (int)(printCount * charTall)) + BorderWidth < m_BoxEnd.Y) && ((ghostTrail.yPos - (int)printCount * charTall) > m_Start.Y + m_YStart))
                    {
                        dc.DrawText(printText, new Point(ghostTrail.xPos, ((ghostTrail.yPos - charTall) - (int)printCount * charTall)));
                    }
                }
            }
            // -- Clear out any items that have scrolled off screen...
            List<GhostObject> cleanedGhostCollection = new List<GhostObject>();
            foreach (GhostObject thisObj in ghostCollection)
            {
                if ((m_BoxEnd.Y + (thisObj.tailArray.Length * charTall)) > thisObj.yPos)
                {
                    cleanedGhostCollection.Add(thisObj);
                }
                else
                {
                    // Replace the one removed...
                    GhostObject newGO = new GhostObject();
                    int nextGhostTrailx = 0;
                    nextGhostTrailx = getNextGhostTrailx();
                    int randHeight = rand.Next((int)(m_BoxEnd.Y - (20 * charTall)), 100);
                    newGO.xPos = nextGhostTrailx;
                    newGO.yPos = randHeight;
                    cleanedGhostCollection.Add(newGO);
                }
            }
            ghostCollection = cleanedGhostCollection;
        }
Beispiel #4
0
        protected override void OnRender(DrawingContext dc)
        {
            m_BoxEnd.X = this.ScreenGrid.Width;
            m_BoxEnd.Y = this.ScreenGrid.Height;

            SolidColorBrush backgroundBrush = new SolidColorBrush();

            backgroundBrush = BackColor as SolidColorBrush;
            Pen outerRectPen = new Pen(m_BorderColor, m_BorderWidth);

            // Main outer rectangle ...
            Rect outerRect = new Rect(m_Start, m_BoxEnd);

            dc.DrawRectangle(backgroundBrush, outerRectPen, outerRect);

            FormattedText printText;

            List <TelemetryObject> dispTelemetry = new List <TelemetryObject>();

            dispTelemetry = telemetryCollection;

            foreach (TelemetryObject thisObj in dispTelemetry.ToList <TelemetryObject>())
            {
                // Increment Y value
                thisObj.yPos++;

                //------ Advance the active item -------
                thisObj.yPos = thisObj.yPos + (m_ScrollSpeed / m_SpeedMultiplier);
                printBrush   = activeBrush;

                // -- Display the active data ...
                char[] printArray = thisObj.telemetryData.ToCharArray();
                for (int printCount = 0; printCount < thisObj.telemetryData.Length; printCount++)
                {
                    // Print the Item Vertical
                    printText = new FormattedText(
                        printArray[printCount].ToString().ToUpper(),
                        CultureInfo.GetCultureInfo("en-us"),
                        FlowDirection.LeftToRight,
                        new Typeface("Georgia"),
                        10,
                        printBrush);
                    // Do not draw outside the box ...
                    //          if ( (thisObj.yPos + (printCount * charTall)) < m_BoxEnd.Y)
                    if (((thisObj.yPos - (int)(printCount * charTall)) + BorderWidth < m_BoxEnd.Y) && ((thisObj.yPos - (int)printCount * charTall) > m_Start.Y + m_YStart))
                    {
                        dc.DrawText(printText, new Point(thisObj.xPos, thisObj.yPos + (printCount * charTall)));
                    }
                }

                //-- Trail behind the active item ...
                //if (thisObj.yPos > (thisObj.telemetryData.Length * charTall))
                for (float trailCount = 0; trailCount < (thisObj.tailArray.Length - 1); trailCount++)
                {
                    if (trailCount <= m_TailFrontLength)
                    {
                        printBrush = trailBrush;
                    }
                    else
                    {
                        printBrush = ghostBrush;
                    }
                    printText = new FormattedText(
                        thisObj.tailArray[(int)trailCount].ToString(),
                        CultureInfo.GetCultureInfo("en-us"),
                        FlowDirection.LeftToRight,
                        new Typeface("Verdana"),
                        10,
                        printBrush);
                    // Do not draw outside the box ...  Bottom && Top
                    if (((thisObj.yPos - (int)(trailCount * charTall)) + BorderWidth < m_BoxEnd.Y) && ((thisObj.yPos - (int)trailCount * charTall) > m_Start.Y + m_YStart))
                    {
                        dc.DrawText(printText, new Point(thisObj.xPos, ((thisObj.yPos - charTall) - (int)trailCount * charTall)));
                    }
                }
            }

            // -- Clear out any items that have scrolled off screen...
            List <TelemetryObject> cleanedCollection = new List <TelemetryObject>();

            foreach (TelemetryObject thisObj in telemetryCollection)
            {
                if ((m_BoxEnd.Y + (thisObj.tailArray.Length * charTall) + (thisObj.telemetryData.Length * charTall)) > thisObj.yPos)
                {
                    cleanedCollection.Add(thisObj);
                }
                else
                {
                    xPos[(int)thisObj.xPos] = 0;
                    //printStatus("Remove: " + thisObj.telemetryData, dc);
                }
            }
            telemetryCollection = cleanedCollection;

            foreach (GhostObject ghostTrail in ghostCollection)
            {
                // Advance ghost scrollers
                ghostTrail.yPos = ghostTrail.yPos + (m_GhostScrollSpeed / m_SpeedMultiplier);
                printBrush      = ghostBrush;
                char[] printArray = ghostTrail.tailArray;
                for (int printCount = 0; printCount < ghostTrail.tailArray.Length; printCount++)
                {
                    // Print the Item Vertical
                    printText = new FormattedText(
                        printArray[printCount].ToString(),
                        CultureInfo.GetCultureInfo("en-us"),
                        FlowDirection.LeftToRight,
                        new Typeface(m_GhostFont),
                        10,
                        printBrush);
                    // Do not draw outside the box ...  Bottom && Top
                    if (((ghostTrail.yPos - (int)(printCount * charTall)) + BorderWidth < m_BoxEnd.Y) && ((ghostTrail.yPos - (int)printCount * charTall) > m_Start.Y + m_YStart))
                    {
                        dc.DrawText(printText, new Point(ghostTrail.xPos, ((ghostTrail.yPos - charTall) - (int)printCount * charTall)));
                    }
                }
            }
            // -- Clear out any items that have scrolled off screen...
            List <GhostObject> cleanedGhostCollection = new List <GhostObject>();

            foreach (GhostObject thisObj in ghostCollection)
            {
                if ((m_BoxEnd.Y + (thisObj.tailArray.Length * charTall)) > thisObj.yPos)
                {
                    cleanedGhostCollection.Add(thisObj);
                }
                else
                {
                    // Replace the one removed...
                    GhostObject newGO           = new GhostObject();
                    int         nextGhostTrailx = 0;
                    nextGhostTrailx = getNextGhostTrailx();
                    int randHeight = rand.Next((int)(m_BoxEnd.Y - (20 * charTall)), 100);
                    newGO.xPos = nextGhostTrailx;
                    newGO.yPos = randHeight;
                    cleanedGhostCollection.Add(newGO);
                }
            }
            ghostCollection = cleanedGhostCollection;
        }