WPF Matrix Rain Dashboard Control

 

WPF Dashboard

Matrix Rain Dashboard Gauge

Video of the dashboard control running is at : http://youtu.be/_2ys7-kSh14

CodePlex Updated:

Source code for this project is now hosted at CodePlex (https://matrixdashboard.codeplex.com/)

The hardest part of this (or any) dashboard gauge is the collection of the telemetry / data feed.

I say ‘hard’ because it involves getting the data from various sources such as log files and re-formatting to an object that can be used by the control.

The data collection part is usually going to be very specific coding that is single-use only.

However, the control objects are general purpose and can be used with any data that can be translated into one short string.

 

Excerpt of the User Control code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Linq;

namespace ModernUIApp2
{
 [TemplatePart(Name = “LayoutRoot”, Type = typeof(Grid))]
public partial class ScreenControl : UserControl
{
// The actual data being tracked …
public List <TelemetryObject> telemetryCollection;

// This is just for additional background movement
public List <GhostObject> ghostCollection ;

// Use a bgworker to read files, so your gui doesnt drag / stop …
public BackgroundWorker bgwRefresh = new BackgroundWorker();

private static Random rand = new Random();

// Time of last screen refresh…
private DateTime timeLast = DateTime.Now;
// Time of last file read / data update…
private DateTime timeLastRefresh = DateTime.Now;

// This marks the tracks that are in use so the active data does not get overwritten…
int[] xPos = new int[1000];

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();

        }

Proactive technologist.

Posted in New, WPF

What do you think?