Пример #1
0
        /// <summary>
        /// Validates data items are registered with the DataContext.
        /// Loads them if the given key is not found.
        /// </summary>
        public void ConfirmDataItemsRegistered()
        {
            string viewContext = MyRootMaster.GetViewString(ViewMask);

            for (int i = 0; i < Controls.Count; i++)
            {
                if (Controls[i] is BaseDataControl)
                {
                    if (Controls[i] is OsHttpRequest)
                    {
                        OsHttpRequest ctl = (OsHttpRequest)Controls[i];
                        MyDataContext.RegisterDataItem(ctl, viewContext,
                                                       ctl.UseClientDataResolver, false, false);
                    }
                    else
                    {
                        MyDataContext.RegisterDataItem((BaseDataControl)Controls[i], viewContext,
                                                       ((BaseDataControl)Controls[i]).UseClientDataResolver, true, false);
                    }
                }
                else if (Controls[i] is VariableTag)
                {
                    VariableTag osvar = (VariableTag)Controls[i];
                    if (MyDataContext.MasterData.ContainsKey(osvar.VariableKey))
                    {
                        if (null == MyDataContext.MasterData[osvar.VariableKey].Data)
                        {
                            MyDataContext.MasterData[osvar.VariableKey].Data = osvar.GetVariableValue();
                        }
                    }
                    else
                    {
                        MyDataContext.RegisterDataItem(osvar.VariableKey, osvar.GetVariableValue());
                    }
                }
            }
        }