Esempio n. 1
0
        /// <summary>
        /// Indicates to the boolean set that the given item is now complete.
        /// If that item was the last incomplete item in the boolean set,
        /// it raises the event for the boolean set on this object.
        /// </summary>
        /// <param name="itemName">Name of the item to complete</param>
        /// <exception cref="KeyNotFoundException">KeyNotFoundException is thrown if the itemName does not exist in the set</exception>
        /// <exception cref="NoNullAllowedException">NoNullAllowedException is thrown if the Callback function was not defined</exception>
        public void CompleteItem(string itemName)
        {
            Validation.IsNotNullOrEmpty(itemName, "itemName");
            Validation.Validate <KeyNotFoundException>(_set.ContainsKey(itemName), "{0} not found", itemName);
            Validation.Validate <NoNullAllowedException>(_callback.IsNotNull(), "Callback function was null");

            _set.Remove(itemName);

            if (_set.Count == 0)
            {
                _callback.Invoke(new RealmEventArgs(_table["message"].ToString(), _table));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Indicates to the boolean set that the given item is now complete.
        /// If that item was the last incomplete item in the boolean set,
        /// it raises the event for the boolean set on this object.
        /// </summary>
        /// <param name="itemName">Name of the item to complete</param>
        /// <exception cref="KeyNotFoundException">KeyNotFoundException is thrown if the itemName does not exist in the set</exception>
        /// <exception cref="NoNullAllowedException">NoNullAllowedException is thrown if the Callback function was not defined</exception>
        public void CompleteItem(string itemName)
        {
            Validation.IsNotNullOrEmpty(itemName, "itemName");
            Validation.Validate <KeyNotFoundException>(_set.ContainsKey(itemName), Resources.ERR_KEY_NOT_FOUND, itemName);
            Validation.Validate <NoNullAllowedException>(_callback.IsNotNull(), Resources.ERR_NULL_CALLBACK);

            _set.Remove(itemName);

            if (_set.Count == 0)
            {
                _callback.Invoke(new RealmEventArgs(_table["message"].ToString(), _table));
            }
        }