public RAM(CrystalFontz635 cf) : base(cf) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; pfRAM = new PerformanceCounter("Memory", "Available MBytes"); using (ManagementObject mo = new ManagementObject(@"Win32_ComputerSystem.Name=""" + Environment.MachineName + "\"")) { TotalInstalled = (ulong)mo["TotalPhysicalMemory"]; } pfRAM.NextValue(); LcdModule.ClearScreen(); LcdModule.SetCursorPosition(0, 0); LcdModule.SendData(0, 0, string.Format("RAM USAGE (T:{0}Mb)", Math.Round(TotalInstalled / 1024.0 / 1024.0)).PadRight(20)); LcdModule.SetCGRAM(0, new byte[] { 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f }); time = new Stopwatch(); time.Start(); }
public Net(CrystalFontz635 cf) : base(cf) { pfc = new PerformanceCounter("IPv4", "Datagrams Received/sec"); LcdModule.SendData(0, 0, "NET LOAD"); LcdModule.SendData(1, 0, "datagrams/second"); time = new Stopwatch(); time.Start(); }
public Dispatcher(CrystalFontz635 cf635) { this.cf635 = cf635; thInbox = new Thread(new ThreadStart(InboxQueue)); thInbox.Priority = ThreadPriority.Highest; thOutbox = new Thread(new ThreadStart(OutboxQueue)); thOutbox.Priority = ThreadPriority.Highest; thInbox.Start(); thOutbox.Start(); }
public HDDSpace(CrystalFontz635 cf) : base(cf) { DriveInfo[] _drives = DriveInfo.GetDrives(); drives = new CachedDriveInfo[_drives.Length]; for (int i = 0; i < _drives.Length; i++) { var _drive = _drives[i]; cf.SendString(0, 0, ("Loading " + _drive.Name).PadRight(20)); drives[i] = new CachedDriveInfo(_drive); } cf.OnKeyDown += new KeyDownEventHandler(cf_OnKeyDown); }
void cf_OnKeyDown(CrystalFontz635 api, KeyCodes pressedKeys) { switch (pressedKeys) { case KeyCodes.Up: if (index - 1 > 0) { index--; } break; case KeyCodes.Down: if (index + 1 < drives.Length) { index++; } break; } }
public HDD(CrystalFontz635 cf) : base(cf) { pfc = new PerformanceCounter("PhysicalDisk", "% Disk Time", "_Total"); LcdModule.SendData(0, 0, "HDD TOTAL LOAD"); LcdModule.SetCGRAM(0, new byte[] { 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f }); time = new Stopwatch(); time.Start(); }
void cf_OnKeyDown(CrystalFontz635 api, KeyCodes pressedKeys) { switch (pressedKeys) { case KeyCodes.Left: if (display - 1 >= 1) display--; break; case KeyCodes.Right: if (display + 1 <= 3) display++; break; } Draw(TimeSpan.MaxValue); }
public Weather(CrystalFontz635 cf) : base(cf) { cf.OnKeyDown += new KeyDownEventHandler(cf_OnKeyDown); cf.SetCGRAM(1, sym_degree); }
public Module(CrystalFontz635 cf) { this.LcdModule = cf; this.LcdModule.ClearScreen(); }
void cf635_OnKeyDown(CrystalFontz635 api, KeyCodes pressedKeys) { switch (pressedKeys) { case KeyCodes.Enter: bool t = thAppMgrReset.Set(); Console.WriteLine("Key press"); break; } }
protected void StopDevice() { TerminateAllCommThreads(); lock (this) { if (cf635 != null) { cf635.SetBacklight(0); cf635.ClearScreen(); cf635.Dispose(); cf635 = null; GC.Collect(); } } }
protected void StartDevice() { TerminateAllCommThreads(); lock (this) { if (cf635 == null) { const int BAUD = 115200; // 115200 for (int i = 0; i < 10; i++) { try { cf635 = new CrystalFontz635(BAUD, "COM3"); break; } catch (Exception ex) { Thread.Sleep(100); cf635 = null; } } if (cf635 == null) throw new InvalidOperationException("Failed to create device"); cf635.Reset(); cf635.SetCursorStyle(CursorStyles.None); cf635.OnKeyDown += new KeyDownEventHandler(cf635_OnKeyDown); } } }