Exemplo n.º 1
0
 private void btnSubscribe_Click(object sender, RoutedEventArgs e)
 {
     if (subscriptionState == (int)SubscriptionState.Unsubscribed)
     {
         try
         {
             foreach (var item in bridgeConfig.getTopicList())
             {
                 bridgeLogic.sendSubscription(item.name, item.throttle);
             }
             subscriptionState    = (int)SubscriptionState.Subscribed;
             btnSubscribe.Content = "Unsubscribe";
             bridgeLogic.SetUpdateListener();
         }
         catch (Exception se)
         {
             MessageBox.Show(se.Message);
         }
     }
     else
     {
         try
         {
             foreach (var item in bridgeConfig.getTopicList())
             {
                 bridgeLogic.sendUnsubscribe(item.name);
             }
             //bridgeLogic.sendUnsubscribe("/turtle1/pose");
             subscriptionState    = (int)SubscriptionState.Unsubscribed;
             btnSubscribe.Content = "Subscribe";
         }
         catch (Exception se)
         {
             MessageBox.Show(se.Message);
         }
     }
 }