So how old school is this.... This is syncing to a SQL Compact database from a desktop console application.
All I need now is an application....
This is the class that draws the nice little progress bar... Note in a change to our published program this is a full framework C# (rather than our usual compact framework)
using System;
using System.Collections.Generic;
using System.Text;
namespace CompactFrameWorkConsole
{
public class ProgressBar
{
// draws a progress bar
int intmax = 100;
int intbarlength = 20;
ConsoleColor colend = ConsoleColor.Green;
ConsoleColor colbar = ConsoleColor.Red;
char barchar = '.';
int drawat = -1;
public int DrawAt
{
set
{
drawat = value;
}
}
// properties
public int BarLength
{
set
{
if (value < 0 || value > 80) throw new Exception("Bar Length Out Of Bounds");
intbarlength = value;
}
}
public char BarChar
{
set
{
barchar = value;
}
}
public ConsoleColor ColEnd
{
set
{
colend = value;
}
}
public ConsoleColor ColBar
{
set
{
colbar = value;
}
}
// constructors
public ProgressBar(int intmax)
{
if (intmax <= 0) return;
this.intmax = intmax;
}
public ProgressBar()
{
}
public void Hit(int val)
{
if (drawat > -1)
Console.CursorTop = drawat;
Console.CursorLeft = 0;
Console.ForegroundColor = colend;
Console.Write("[");
Console.ResetColor();
decimal barsize = (decimal) intbarlength / (decimal) intmax;
int strlen =(int) ((decimal) val * barsize);
if (strlen == 0)
Console.Write(" ".PadRight(intbarlength));
else
Console.Write(barchar.ToString().PadRight(strlen, barchar).PadRight(intbarlength));
Console.ForegroundColor = colend;
Console.Write("]");
Console.ResetColor();
}
}
}