Ejemplo n.º 1
0
        /// <summary>
        /// Ask AppModelControl if objModel exists. Return true if objModel exists(and vv) and, if objModel exists, it assign objModel via
        /// ref parameter to the existing object (objModel = existingObject)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="objModel"></param>
        /// <returns></returns>
        public static bool AskForObjModel(ref object sender, ref object objModel)
        {
            ModelControlEventArgs e = new ModelControlEventArgs(ref objModel);

            if (!_MsgDict.ContainsKey(sender))
            {
                _MsgDict.Add(sender, null);
            }
            ObjModelAskedEvent(ref sender, e);

            if (_MsgDict[sender] == null)
            {
                _MsgDict.Remove(sender);
                AddModel(ref objModel);
                return(false);
            }

            objModel = _MsgDict[sender];
            _MsgDict.Remove(sender);
            return(true);

            /*bool ret =(_MsgDict[sender] == null ? false : (bool)_MsgDict[sender]);
             * _MsgDict.Remove(sender);
             * return ret;*/
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add object Model to the corresponding dictionary, WITHOUT checking if owners exists. The model have to be asked first with
        /// AppModelControlMessenger.AskForModel
        /// </summary>
        /// <param name="objModel"></param>
        internal static void AddModel(ref object objModel)
        {
            ModelControlEventArgs e = new ModelControlEventArgs(ref objModel);

            ModelAddedEvent(null, e);
        }