public AppletMediaJukebox(MediaJukeboxAutomation mj, MainInterface ui) { MJ = mj; UI = ui; LgLcdLib = new Lglcd(); LglcdApplet = new Applet() { SupportedDevices = SupportedDevices.QVGA, Title = "Media Jukebox" }; QvgaDevice = new Device<QvgaImageUpdater>() { Applet = LglcdApplet }; LglcdApplet.DeviceArrival += new EventHandler<DeviceEventArgs>(LglcdApplet_DeviceArrival); LglcdApplet.DeviceRemoval += new EventHandler<DeviceEventArgs>(LglcdApplet_DeviceRemoval); m_RaisePriorityUntil = DateTime.Now.Add(Properties.Settings.Default.RaisedPriorityTimeout); /*try { Initialize(); InitializeLcdForm(); UpdateValues(); UpdateGraphics(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("A Fatal error has occured while creating plugin:-" + e.Message + "\n The Failure Occured" + "\n In Class Object " + e.Source + "\n when calling Method " + e.TargetSite + "\n \n The following Inner Exception was caused" + e.InnerException + "\n \n The Stack Trace Follows: \n\n" + e.StackTrace); }*/ TrackChange += new EventHandler<MediaJukeboxEventArgs>(AppletMediaJukebox_TrackChange); PlayerStateChange += new EventHandler<MediaJukeboxEventArgs>(AppletMediaJukebox_PlayerStateChange); InitializeLcdForm(); m_InitializationTimer = new Timer(new TimerCallback(TimerHandler), null, TimeSpan.Zero, TimeSpan.FromSeconds(1.0)); }
static void Main(string[] args) { Console.WriteLine("Testing basic functionality for CsLglcd"); Console.WriteLine("Loading applet..."); using (Lglcd lglcd = new Lglcd()) { Applet helloWorldApplet = new Applet(); helloWorldApplet.SupportedDevices = SupportedDevices.QVGA; helloWorldApplet.Title = "Hello World 1"; helloWorldApplet.Connect(); Device<QvgaImageUpdater> qvgaDevice = new Device<QvgaImageUpdater>(); qvgaDevice.Applet = helloWorldApplet; qvgaDevice.DeviceType = Devices.QVGA; qvgaDevice.Attach(); Console.WriteLine("Press ENTER to draw a test image"); Console.ReadLine(); Bitmap testImage = qvgaDevice.SpecializedImageUpdater.CreateValidImage(); using (Graphics g = Graphics.FromImage(testImage)) { g.FillRectangle(Brushes.Red, 0, 0, testImage.Width, testImage.Height); g.DrawString("Hello world", new Font("monospace", 12f), Brushes.White, 15f, 15f); } qvgaDevice.SpecializedImageUpdater.SetPixels(testImage); qvgaDevice.Update(); Console.WriteLine("Press ENTER to cleanup memory"); Console.ReadLine(); testImage.Dispose(); qvgaDevice.Detach(); qvgaDevice.Dispose(); helloWorldApplet.Disconnect(); helloWorldApplet.Dispose(); } Console.WriteLine("Press ENTER to close application"); Console.ReadLine(); }
/// <summary> /// Initializes Engine /// </summary> public Engine() { Console.WriteLine(@"_________ _____ _____ _________ "); Console.WriteLine(@"\_ ___ \ _____/ ____\/ ____\____ ____ \_ ___ \ __ ________ "); Console.WriteLine(@"/ \ \/ / _ \ __\\ __\/ __ \_/ __ \/ \ \/| | \____ \ "); Console.WriteLine(@"\ \___( <_> ) | | | \ ___/\ ___/\ \___| | / |_> >"); Console.WriteLine(@" \______ /\____/|__| |__| \___ >\___ >\______ /____/| __/ "); Console.WriteLine(@" \/ \/ \/ \/ |__| "); Console.WriteLine(@" _________ __ .___.__ "); Console.WriteLine(@" / _____// |_ __ __ __| _/|__| ____ ______ ©"); Console.WriteLine(@" \_____ \\ __\ | \/ __ | | |/ _ \/ ___/"); Console.WriteLine(@" / \| | | | / /_/ | | ( <_> )___ \ "); Console.WriteLine(@"/_______ /|__| |____/\____ | |__|\____/____ >"); Console.WriteLine(@" \/ \/ \/ "); Console.WriteLine(); Console.WriteLine("CoffeeCup Studios 2D LCD Game Engine for the Logitech G19 Keyboard"); Console.WriteLine("------------------------------------------------------------------"); Console.WriteLine(); Log.Write("Initializing LCD"); lgLcd = new Lglcd(); Log.Done(); applet = new Applet(); QvgaDevice = new Device<QvgaImageUpdater>(); applet.SupportedDevices = SupportedDevices.QVGA; Log.Write("Initializing render area"); screen = new Screen(); Log.Done(); Log.Write("Initializing input"); sw = new System.Diagnostics.Stopwatch(); input = new Input(QvgaDevice); content = new Content(); Log.Done(); }
static void Main(string[] args) { Console.WriteLine("Testing basic functionality for CsLglcd"); Console.WriteLine("Loading applet..."); using (Lglcd lglcd = new Lglcd()) { Applet helloWorldApplet = new Applet(); helloWorldApplet.SupportedDevices = SupportedDevices.QVGA; helloWorldApplet.Title = "Hello World 2"; helloWorldApplet.Connect(); Device<QvgaImageUpdater> qvgaDevice = new Device<QvgaImageUpdater>(); qvgaDevice.Applet = helloWorldApplet; qvgaDevice.DeviceType = Devices.QVGA; qvgaDevice.Attach(); Console.WriteLine("Press ENTER to draw a test image with CsLglcd.UI"); Console.ReadLine(); Bitmap testImage = qvgaDevice.SpecializedImageUpdater.CreateValidImage(); using (Graphics drawer = Graphics.FromImage(testImage)) { QvgaScreen form = new QvgaScreen(helloWorldApplet, qvgaDevice); ContainerControl controls = new ContainerControl(); form.Control = controls; controls.AddControl(new TextControl() { Text = "test", X = 5, BaseFont = form.BaseFont }); var progressbarcontrol = new ProgressBarControl() { X = 8, Y = 100 }; controls.AddControl(progressbarcontrol); form.Draw(testImage, drawer); Console.WriteLine("Current percentage: {0}%", progressbarcontrol.Percentage * 100); qvgaDevice.SpecializedImageUpdater.SetPixels(testImage); qvgaDevice.Update(); Console.WriteLine("Press ENTER for 0%"); Console.ReadLine(); progressbarcontrol.Current = 0; form.Draw(testImage, drawer); Console.WriteLine("Current percentage: {0}%", progressbarcontrol.Percentage * 100); qvgaDevice.SpecializedImageUpdater.SetPixels(testImage); qvgaDevice.Update(); Console.WriteLine("Press ENTER for 100%"); Console.ReadLine(); progressbarcontrol.Current = 1000; form.Draw(testImage, drawer); Console.WriteLine("Current percentage: {0}%", progressbarcontrol.Percentage * 100); qvgaDevice.SpecializedImageUpdater.SetPixels(testImage); qvgaDevice.Update(); // Try raising app to front Console.WriteLine("Press ENTER for 100% and BRING APPLICATION TO FRONT"); Console.ReadLine(); progressbarcontrol.Current = 1000; form.Draw(testImage, drawer); Console.WriteLine("Current percentage: {0}%", progressbarcontrol.Percentage * 100); qvgaDevice.ForegroundApplet = true; qvgaDevice.SpecializedImageUpdater.SetPixels(testImage); qvgaDevice.Update(UpdatePriorities.Alert); } Console.WriteLine("Press ENTER to cleanup memory"); Console.ReadLine(); testImage.Dispose(); qvgaDevice.Detach(); qvgaDevice.Dispose(); helloWorldApplet.Disconnect(); helloWorldApplet.Dispose(); } Console.WriteLine("Press ENTER to close application"); Console.ReadLine(); }
public override string ToString() { return(string.Format("Device: {0}, Applet: {1}", Enum.GetName(DeviceType.GetType(), DeviceType), Applet != null ? Applet.ToString() : "None")); }