コード例 #1
0
ファイル: PremiseCommand.cs プロジェクト: tig/Premise
 public PremiseCommand(PremiseObject holdingObject, string propertyName) {
     _holdingObject = holdingObject;
     _propertyName = propertyName;
 }
コード例 #2
0
ファイル: PremiseServer.cs プロジェクト: tig/Premise
 /// <summary>
 /// Send an unsubscribe request to the server.
 /// </summary>
 /// <param name="po"></param>
 /// <param name="propertyName"></param>
 public async Task Unsubscribe(PremiseObject po, string propertyName) {
     try {
         // Find subscription 
         foreach (var subscription in _subscriptions) {
             if (subscription.Value.PropertyName == propertyName &&
                 subscription.Value.Object.Location == po.Location) {
                 _subscriptions.Remove(subscription.Key);
                 string command = "?c?" + subscription.Key;
                 if (FastMode)
                     await SendRequestFastMode(command);
                 else {
                     await SendRequest(command);
                 }
                 return;
             }
         }
     }
     catch (Exception ex) {
         Dispose();
         throw ex;
     }
 }
コード例 #3
0
ファイル: PremiseServer.cs プロジェクト: tig/Premise
 // Default implementation of method to set an object property's value
 // Assumes same thread.
 public void DispatchSetMember(PremiseObject obj, string propertyName, string value) {
     obj.SetMember(propertyName, value, false);
 }
コード例 #4
0
ファイル: PremiseServer.cs プロジェクト: tig/Premise
        /// <summary>
        /// Send a subscription request to the server.
        /// </summary>
        /// <param name="po">The object with the property to subscribe.</param>
        /// <param name="propertyName">Name of the property to subscribe.</param>
        public async Task Subscribe(PremiseObject po, string propertyName) {
            try {
                Debug.Assert(_subscriptionClient != null);

                // Ignore multiple subscripitons
                foreach (var subscription in _subscriptions) {
                    if (subscription.Value.PropertyName == propertyName &&
                        subscription.Value.Object.Location == po.Location)
                        return;
                }

                Subscription sub = new Subscription {Object = po, PropertyName = propertyName};
                _subscriptions.Add(sub.GetHashCode(), sub);
                await SendSubscriptionRequest(sub);

            }
            catch (Exception ex) {
                Dispose();
                throw ex;
            }
        }