Beispiel #1
0
        /// <summary>
        /// Gets the current value of the shared counter.
        /// </summary>
        /// <returns>Current value</returns>
        public int GetValue()
        {
            var currentMachine = Runtime.GetCurrentMachine();

            Runtime.SendEvent(CounterMachine, SharedCounterEvent.GetEvent(currentMachine.Id));
            var response = currentMachine.Receive(typeof(SharedCounterResponseEvent)).Result;

            return((response as SharedCounterResponseEvent).Value);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the current value of the shared counter.
        /// </summary>
        public int GetValue()
        {
            var currentMachine = this.Runtime.GetExecutingMachine <Machine>();

            this.Runtime.SendEvent(this.CounterMachine, SharedCounterEvent.GetEvent(currentMachine.Id));
            var response = currentMachine.Receive(typeof(SharedCounterResponseEvent)).Result;

            return((response as SharedCounterResponseEvent).Value);
        }