コード例 #1
0
ファイル: RAM.cs プロジェクト: CryptonZylog/cf635
 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();
 }
コード例 #2
0
ファイル: Net.cs プロジェクト: CryptonZylog/cf635
 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();
 }
コード例 #3
0
ファイル: Dispatcher.cs プロジェクト: CryptonZylog/cf635
        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();
        }
コード例 #4
0
ファイル: HDDSpace.cs プロジェクト: CryptonZylog/cf635
 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);
 }
コード例 #5
0
ファイル: HDDSpace.cs プロジェクト: CryptonZylog/cf635
 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;
     }
 }
コード例 #6
0
ファイル: HDD.cs プロジェクト: CryptonZylog/cf635
 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();
 }
コード例 #7
0
ファイル: Weather.cs プロジェクト: CryptonZylog/cf635
 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);
 }
コード例 #8
0
ファイル: Weather.cs プロジェクト: CryptonZylog/cf635
 public Weather(CrystalFontz635 cf)
     : base(cf)
 {
     cf.OnKeyDown += new KeyDownEventHandler(cf_OnKeyDown);
     cf.SetCGRAM(1, sym_degree);
 }
コード例 #9
0
ファイル: Module.cs プロジェクト: CryptonZylog/cf635
 public Module(CrystalFontz635 cf)
 {
     this.LcdModule = cf;
     this.LcdModule.ClearScreen();
 }
コード例 #10
0
ファイル: InfoService.cs プロジェクト: CryptonZylog/cf635
 void cf635_OnKeyDown(CrystalFontz635 api, KeyCodes pressedKeys)
 {
     switch (pressedKeys) {
         case KeyCodes.Enter:
             bool t = thAppMgrReset.Set();
             Console.WriteLine("Key press");
             break;
     }
 }
コード例 #11
0
ファイル: InfoService.cs プロジェクト: CryptonZylog/cf635
 protected void StopDevice()
 {
     TerminateAllCommThreads();
     lock (this) {
         if (cf635 != null) {
             cf635.SetBacklight(0);
             cf635.ClearScreen();
             cf635.Dispose();
             cf635 = null;
             GC.Collect();
         }
     }
 }
コード例 #12
0
ファイル: InfoService.cs プロジェクト: CryptonZylog/cf635
 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);
         }
     }
 }