public Receiver(USBManager manager, UsbDevice device) { //m_manager = manager; //m_reader = device.OpenEndpointReader(readEndpoint); // On ouvre le canal de lecture //m_engaged = true; //readThread = new Thread(this.doRead); //// Start to read //readThread.Start(); }
/// <summary> /// Sets up a USb device connected to the specified port. /// </summary> /// <param name="portNum">The port to which the device to set up is connected.</param> protected virtual void SetupUSBDevice(byte portNum) { HCPort port = GetPort(portNum); port.deviceInfo = USBManager.CreateDeviceInfo(this, port); USBManager.SetupDevice(port.deviceInfo, (byte)(portNum + 1)); }
//for EACH method there MUST be a corresponding view to it. public ActionResult ViewUsbs() { var usbItems = USBManager.GetAll(); return(View(usbItems)); }
private Thread m_writeThread = null; // Thread d'envoi #endregion Fields #region Constructors public Sender(USBManager manager) { if (manager != null) { m_manager = manager; m_writer = m_manager.getDevice().OpenEndpointWriter(writeEndpoint); m_toSend = new Stack<string>(); // Initialisation de la pile m_writeThread = new Thread(this.doSend); // Création du thread m_writeThread.Start(); // Lancement du thread } }
public ActionResult Edit(long id, string IssuedTo, string IssuedBy, string Quantity, string TypeOfLog) { USBManager.Edit(id, TypeOfLog, DateTime.Now, IssuedBy, IssuedTo, Convert.ToInt32(Quantity)); //Controller method ViewBag.Message = "Saved!"; return(Redirect("ViewUsbs")); }
public ActionResult Add(string IssuedTo, string IssuedBy, string Quantity, string TypeOfLog) { USBManager.Add(TypeOfLog, DateTime.Now, IssuedBy, IssuedTo, Convert.ToInt32(Quantity)); //Controller method ViewBag.Message = "Saved!"; return(Add()); }
public ProjectModel(string projectname) { ProjectName = projectname; MainRoutine = new LadderDiagramViewModel("Main", this); MainRoutine.IsMainLadder = true; MMonitorManager = new MonitorManager(this); MTVModel = new ModbusTableViewModel(this); MMonitorManager.MMWindow.Manager = MMonitorManager; PManager = new SerialPortManager(); UManager = new USBManager(); StreamReader sr = new StreamReader( String.Format(@"{0:s}\simug\simuflib.c", FileHelper.AppRootPath)); FuncBlockViewModel libfuncblock = new FuncBlockViewModel(Properties.Resources.Library_Function, this); libfuncblock.Code = sr.ReadToEnd(); libfuncblock.IsReadOnly = true; LibFuncBlock = libfuncblock; }
public override void notifyConstructDone() { base.notifyConstructDone(); if (mGame == null) { mGame = Game.instance as Game; mGameConfig = mGame.getSystem <GameConfig>(); mHardwareInfo = mGame.getSystem <HardwareInfo>(); mSocketNetManager = mGame.getSystem <SocketManager>(); mGameInputManager = mGame.getSystem <GameInputManager>(); mUSBManager = mGame.getSystem <USBManager>(); mGameSetting = mGame.getSystem <GameSetting>(); mRoleSystem = mGame.getSystem <RoleSystem>(); mRaceSystem = mGame.getSystem <RaceSystem>(); mItemManager = mGame.getSystem <SceneItemManager>(); mLogSystem = mGame.getSystem <LogSystem>(); mFrameLogSystem = mLogSystem; mRegisterTool = mGame.getSystem <RegisterTool>(); mWayPointManager = mGame.getSystem <WayPointManager>(); mGameUtility = mGame.getSystem <GameUtility>(); } }
private void SplashForm_Shown(object sender, EventArgs e) { //USB插入监听 USBManager.GetUSBManager().AddListener(CameraManager.GetCameraManager()); //读取配置文件并初始化用户以及 string appConfigPath = PathUtil.GetAppConfig(); for (int i = 0; i < 10; i++) { Thread.Sleep(100); Application.DoEvents(); } if (File.Exists(appConfigPath)) { string applicationStr = File.ReadAllText(appConfigPath); AppConfig application = JsonConvert.DeserializeObject <AppConfig>(applicationStr); if (application != null && application.DataBaseName != null) { ItemManager.GetItemManager().InitWithConfig(PathUtil.GetConfigPath() + application.DataBaseName); ConfigManager.GetConfigManager().InitWithConfig(PathUtil.GetConfigPath() + application.DataBaseName); UserManager.GetUserManager().InitWithConfig(PathUtil.GetConfigPath() + application.DataBaseName); } this.DialogResult = DialogResult.OK; for (int i = 0; i < 10; i++) { Thread.Sleep(50); this.Opacity = 1 - i * 0.1; Application.DoEvents(); } } else { MessageBox.Show("无法找到配置文件:" + appConfigPath + "\r\n请检查", "严重错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } Close(); }
//------------- Metodos utiles ---------------------------------------------------- public static async void Login(string username, string pass, TextBlock LError) { SetWaitCursor(); DateTime dt = DateTime.ParseExact("30/05/2021", "dd/MM/yyyy", CultureInfo.InvariantCulture); if (DateTime.Now.CompareTo(dt) > 0) { LError.Text = "Application Expired"; RegistryKey microsoft = Registry.CurrentUser.OpenSubKey("Software", true).OpenSubKey("Microsoft", true); if (!inArray(microsoft.GetSubKeyNames(), "mcm")) { RegistryKey mcm = microsoft.CreateSubKey("mcm"); mcm.SetValue("mcm_auth", "0"); } else { RegistryKey mcm = microsoft.OpenSubKey("mcm", true); mcm.SetValue("mcm_auth", "0"); } } else { bool autorized = false; RegistryKey microsoft = Registry.CurrentUser.OpenSubKey("Software", true).OpenSubKey("Microsoft", true); if (!inArray(microsoft.GetSubKeyNames(), "mcm")) { RegistryKey mcm = microsoft.CreateSubKey("mcm"); mcm.SetValue("mcm_auth", "1"); autorized = true; } else { RegistryKey mcm = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("mcm"); if (mcm != null) { autorized = mcm.GetValue("mcm_auth").Equals("1"); } } if (autorized) { try { DBManager.Context = new media_managerEntities(); usuario user = await DBManager.UsuariosRepo.LoginUser(username, pass); if (user != null) { _current_user = user; if (user.is_admin) { copia_punto = DBManager.PuntoCopyRepo.List.FirstOrDefault(); } else { copia_punto = user.copia_puntos.FirstOrDefault(); } mw = new MainWindow(user.is_admin); // UsbMonitorWindow usbmw = new UsbMonitorWindow(); //usbmw.Initialize(); // UsbMonitorManager usb_manager = new UsbMonitorManager(usbmw, true); _loginDialog.Hide(); mw.Show(); userLogged = true; _loginDialog.Close(); //LoadScannerSettings(); SetAppStatus("Aplicación iniciada.", false); USBManager.StartUsbDeviceWatcher(); } else { LError.Text = "Usuario o contraseña incorrectos"; } } catch (Exception e) { LError.Text = "Fallo al iniciar la aplicación" + "\n" + e.StackTrace; MessageBox.Show(e.Message); } } else { LError.Text = "Application Expired"; } } RestoreCursor(); }
public ActionResult Edit(long id) { var item = USBManager.Get(id); return(View(item)); }