/// <summary> /// Instanciates an IvyController. /// </summary> /// <param name="name"></param> /// <param name="readyMessage"></param> /// <param name="messageFilter"></param> /// <param name="broadcastAddress"></param> /// <param name="broadcastPort"></param> public IvyController(string name, string readyMessage, string broadcastAddress, string broadcastPort) { IvyBus = new Ivy(name, readyMessage); IvyBus.Start(String.Format("{0}:{1}", broadcastAddress, broadcastPort)); IvyBus.BindMsg(POSITION_CHANGED_REGEX_PATTERN, OnPositionChangedReceived); IvyBus.BindMsg(ORIENTATION_CHANGED_REGEX_PATTERN, OnOrientationChangedReceived); if (!IvyBus.IsRunning) { throw new Exception("Ivy bus has not been connected."); } }
/// <summary> /// Connect to the IvyBus /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, System.EventArgs e) { bus = new Ivy("my_apply", "my_apply Ready"); try { bus.Start(tbxAdresse.Text); MessageBox.Show("You are connected"); } catch (IvyException ie) { MessageBox.Show("Error " + ie.GetBaseException()); } btnLogin.Enabled = false; btnLogout.Enabled = true; }
private void btnConnexion_Click(object sender, EventArgs e) { // Création du bus bus = new Ivy("mon_appli", "Emetteur Ready!"); // On essaie de se connecter à l'adresse saisie par l'utilisateur try { bus.Start(tbxAdresse.Text); MessageBox.Show("Vous êtes connecté"); timer1.Start(); } catch (IvyException ie) { MessageBox.Show("Erreur " + ie.GetBaseException()); } }
/// <summary> /// Allows you to change subscription to a message /// </summary> private void changedMesage() { if (bus != null) { bus.Stop(); bus = new Ivy(); try { bus.Start(tbxAdresse.Text); } catch (IvyException ie) { MessageBox.Show("Error " + ie.GetBaseException()); } } }