public void Save(PageView currentPage, string controlPlaceId, ControlData[] data)
 {
     if(_connectionString!=string.Empty)
     {
         SqlContext context = new SqlContext();
         context.ConnectionString=_connectionString;
         try
         {
             context.BeginTransaction();
             //delete all controls in control place
             SqlHelper.ExecuteNonQuery(context,CommandType.StoredProcedure,"page_ControlPropertiesDeleteAllInControlPlace",
                 new SqlParameter("@PageUID",currentPage.Id),new SqlParameter("@ControlPlaceID",controlPlaceId));
             //add new controls from array "data"
             for(int i=0;i<data.Length;i++)
             {
                 SqlHelper.ExecuteNonQuery(context,CommandType.StoredProcedure,"page_ControlPropertiesInsertInControlPlace",
                     new SqlParameter("@PageUID",currentPage.Id),
                     new SqlParameter("@ControlPlaceID",controlPlaceId),
                     new SqlParameter("@ControlIndex",i),
                     new SqlParameter("@ControlUID",data[i].ControlUID),
                     new SqlParameter("@ControlProperties",data[i].Settings));
             }
             context.Commit();
         }
         catch
         {
             context.Rollback();
             throw;
         }
     }//if(_connectionString!=string.Empty)
 }
예제 #2
0
파일: GUIControl.cs 프로젝트: srndpty/VFW
		public GUIControl(ControlData data)
		{
			this.data = data;

			vSpacing = BaseGUI.GetVSpacing(data.type);
			hSpacing = BaseGUI.GetHSpacing(data.type);

			width  = null;
			height = null;
		}
예제 #3
0
        public static void IRControl(Guid?tmpGuid, int tmpAction, int tmpSpeed, int tmpParameter, Guid?UserGuid)
        {
            ControlData tmpCommand = new ControlData();

            if (tmpGuid != null)
            {
                tmpCommand.VideoGuid = tmpGuid;
                tmpCommand.iAction   = tmpAction;
                tmpCommand.iSpeed    = tmpSpeed;
                tmpCommand.Parameter = tmpParameter;
                tmpCommand.UserGuid  = UserGuid;
                Control_Command.IRControl(tmpCommand);
            }
        }
예제 #4
0
        private Dependent FindDependent(ControlData cd, string name, string shortName)
        {
            Dependent dep = (from d in cd.Dependents where d.Prop == name select d).FirstOrDefault();

            if (dep == null)
            {
                dep = new Dependent {
                    Prop      = name,
                    PropShort = shortName
                };
                cd.Dependents.Add(dep);
            }
            return(dep);
        }
예제 #5
0
    public void Save(string name)
    {
        // создать список для сохранения данных каждого Control
        worldData = new WorldData();
        worldData.controlsData = new List <ControlData>();
        for (int i = 0; i < _controls.Count; ++i)
        {
            print(i);
            ControlData cd = _controls[i].PrepareDataToSave();
            worldData.controlsData.Add(cd);
        }

        worldData.Save(Path.Combine(Application.dataPath, name));
    }
예제 #6
0
        public override void HelpBox(string message, MessageType type)
        {
            var content = GetContent(message);
            var size    = GUIHelper.HelpBox.CalcSize(content);
            var layout  = Layout.sHeight(Mathf.Max(size.y, 20f));
            var data    = new ControlData(content, GUIHelper.HelpBox, layout, ControlType.HelpBox);

            Rect position;

            if (CanDrawControl(out position, data))
            {
                EditorGUI.HelpBox(position, message, type);
            }
        }
예제 #7
0
        public override void HelpBox(string message, MessageType type)
        {
            var content = GetContent(message);
            var height  = GUIStyles.HelpBox.CalcHeight(content, Width);
            var layout  = Layout.sHeight(height);
            var data    = new ControlData(content, GUIStyles.HelpBox, layout, ControlType.HelpBox);

            Rect position;

            if (CanDrawControl(out position, data))
            {
                EditorGUI.HelpBox(position, message, type);
            }
        }
예제 #8
0
        public override int Popup(string text, int selectedIndex, string[] displayedOptions, GUIStyle style, Layout option)
        {
            var content = GetContent(text);
            var popup   = new ControlData(content, style, option, ControlType.Popup);

            Rect position;

            if (CanDrawControl(out position, popup))
            {
                return(EditorGUI.Popup(position, content.text, selectedIndex, displayedOptions, style));
            }

            return(selectedIndex);
        }
예제 #9
0
 public override void Space(float pixels)
 {
     if (!_allocatedMemory)
     {
         var parent = _blockStack.Peek();
         var option = parent.Space(pixels);
         var space  = new ControlData(GUIContent.none, GUIStyle.none, option, ControlType.Space);
         NewControl(space);
     }
     else
     {
         _nextControlIdx++;
     }
 }
예제 #10
0
        public override string ToolbarSearch(string value, Layout option)
        {
            var data = new ControlData(GetContent(value), GUIStyles.TextField, option, ControlType.TextField);

            Rect position;

            if (CanDrawControl(out position, data))
            {
                int searchMode = 0;
                return(GUIHelper.ToolbarSearchField(null, new object[] { position, null, searchMode, value }) as string);
            }

            return(value);
        }
예제 #11
0
    public void Save()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/gameControl.dat");

        ControlData data = new ControlData();

        data.evento1 = evento1;
        data.evento2 = evento2;
        data.evento3 = evento3;

        bf.Serialize(file, data);
        file.Close();
    }
예제 #12
0
 private static void ParseDesign(XPOReader reader, FormData data)
 {
     while (!reader.EndOfStream)
     {
         string line = reader.ReadLine().TrimStart();
         if (line.StartsWith(KeyWords.CONTROL))
         {
             data.AddControl(ControlData.Parse(line, reader));
         }
         else if (line.StartsWith(KeyWords.ENDDESIGN))
         {
             break;
         }
     }
 }
예제 #13
0
        void UpdateControl(ViewControlId id, ControlData data)
        {
            var controls = GetControlsSet(id);

            if (controls != null)
            {
                UpdateActionLink(controls.content, data.Content, data.Color, !data.Disabled, id);

                if (controls.progress != null)
                {
                    controls.progress.Hidden      = data.Progress == null;
                    controls.progress.DoubleValue = data.Progress.GetValueOrDefault(0d) * 100d;
                }
            }
        }
예제 #14
0
        public override string TextFieldDropDown(GUIContent label, string value, string[] dropDownElements, Layout option)
        {
            var data = new ControlData(label, GUIStyles.TextFieldDropDown, option, ControlType.TextFieldDropDown);

            Rect totalRect;

            if (CanDrawControl(out totalRect, data))
            {
                Rect textRect  = new Rect(totalRect.x, totalRect.y, totalRect.width - GUIStyles.TextFieldDropDown.fixedWidth, totalRect.height);
                Rect popupRect = new Rect(textRect.xMax, textRect.y, GUIStyles.TextFieldDropDown.fixedWidth, totalRect.height);

                value = EditorGUI.TextField(textRect, "", value, GUIStyles.TextFieldDropDownText);

                string[] displayedOptions;
                if (dropDownElements.Length > 0)
                {
                    displayedOptions = dropDownElements;
                }
                else
                {
                    (displayedOptions = new string[1])[0] = "--empty--";
                }

                if (popupRect.Contains(Event.current.mousePosition))
                {
                    hoveringOnPopup = true;
                }

                // if there were a lot of options to be displayed, we don't need to always invoke
                // Popup cause Unity does a lot of allocation inside and it would have a huge negative impact
                // on editor performance so we only display the options when we're hoving over it
                if (!hoveringOnPopup)
                {
                    EditorGUI.Popup(popupRect, string.Empty, -1, emptyStringArray, GUIStyles.TextFieldDropDown);
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    int selection = EditorGUI.Popup(popupRect, string.Empty, -1, displayedOptions, GUIStyles.TextFieldDropDown);
                    if (EditorGUI.EndChangeCheck() && displayedOptions.Length > 0)
                    {
                        hoveringOnPopup = false;
                        value           = displayedOptions[selection];
                    }
                }
            }
            return(value);
        }
예제 #15
0
        public IHttpActionResult GetAllActiveControlDataForTransactions(List <long> transaction_ids)
        {
            var ua = UserAccess.GetUserAccess(User.Identity.Name);

            if (ua.current_access == UserAccess.access_type.no_access)
            {
                return(Unauthorized());
            }

            if (!TransactionData.ValidateTransactionListAccess(transaction_ids, ua))
            {
                return(Unauthorized());
            }

            return(Ok(ControlData.GetAllActiveControlDataForTransactions(transaction_ids)));
        }
예제 #16
0
        private bool Find <T> (ref ControlDataKey key, out ControlData <T> result)
        {
            if (Items.Count == 0)
            {
                result = default;
                return(false);
            }

            for (int i = 0, c = Items.Count; i < c; i++)
            {
                ref var item = ref Items.Item(i);
                if (item.KeyEquals(in key))
                {
                    result = (ControlData <T>)item;
                    return(true);
                }
            }
예제 #17
0
        static void Main(string[] args)
        {
            BlackBoard blackBoard = new BlackBoard();

            ControlData data1 = new ControlData("PrimeNumbers", new object[] { 100 });

            blackBoard.update("DAT0001", data1);

            PrimeFinder primeFinder = new PrimeFinder();

            blackBoard.addKnowledgeWorker(primeFinder);

            blackBoard.print();
            blackBoard.control.loop();
            blackBoard.print();
            System.Console.ReadKey();
        }
예제 #18
0
    private PatternData()
    {
        ControlData data = new ControlData();

        data.positionLimit    = 10;
        data.angleLimit       = 0;
        data.isPositionActive = true;
        data.isAngleActive    = false;
        rectPattern.Add(data);

        data = new ControlData();
        data.positionLimit    = 0;
        data.angleLimit       = 90;
        data.isPositionActive = false;
        data.isAngleActive    = true;
        rectPattern.Add(data);
    }
예제 #19
0
        public override Gradient GradientField(GUIContent content, Gradient value, Layout option)
        {
            var data = new ControlData(content, GUIStyles.None, option, ControlType.GradientField);

            Rect position;

            if (CanDrawControl(out position, data))
            {
                if (value == null)
                {
                    value = new Gradient();
                }
                return(_gradientField(null, new object[] { content, position, value }));
            }

            return(value);
        }
예제 #20
0
        public override void Prefix(string label)
        {
            if (string.IsNullOrEmpty(label))
            {
                return;
            }
            var content = GetContent(label);
            var style   = EditorStyles.label;
            var data    = new ControlData(content, style, Layout.sWidth(EditorGUIUtility.labelWidth), ControlType.PrefixLabel);

            Rect position;

            if (CanDrawControl(out position, data))
            {
                EditorGUI.HandlePrefixLabel(position, position, content, 0, style);
            }
        }
예제 #21
0
        public override AnimationCurve Curve(GUIContent content, AnimationCurve value, Layout option)
        {
            var data = new ControlData(content, GUIStyles.None, option, ControlType.CurveField);

            Rect position;

            if (CanDrawControl(out position, data))
            {
                if (value == null)
                {
                    value = new AnimationCurve();
                }
                return(EditorGUI.CurveField(position, content, value));
            }

            return(value);
        }
예제 #22
0
        /**
         * input:
         * ControlData control - controler data
         *
         * output:
         * accelerated vector from engins in aircraft coordinate system
         */
        Vector3 accelEngine(ControlData control)
        {
            Vector3 result     = Vector3.zero;
            float   totalPower = 0;

            foreach (var component in Aircraft.Components)
            {
                if (component is Engine engine)
                {
                    engine.CurrentPower = engine.MaxPower * control.Power;
                    totalPower         += (float)engine.CurrentPower;
                }
            }
            result.y = totalPower;

            return(result);
        }
예제 #23
0
        public static void ControlCharacter(User target, ControlData data)
        {
            BinaryWriter write = GetWriter();

            write.Write((byte)4);
            write.Write(data.id);
            write.Write(data.lvl);
            write.Write(data.str);
            write.Write(data.vit);
            write.Write(data.dex);
            write.Write(data.intel);
            write.Write(data.statPoints);
            write.Write(data.gold);
            byte[] d = GetBytes();
            target.SendData(d);
            Clear(stream);
        }
예제 #24
0
        protected override void PerformStep(ControlData control, float deltaTime)
        {
            var rRate    = control.AileronAngle - _data.DeadZone;
            var controlR = Mathf.Abs(control.AileronAngle) > _data.DeadZone
                ? Mathf.Abs(rRate) * Mathf.Sign(rRate) * _data.ControlRate
                : 0f;
            var pRate    = control.ElevatorAngle - _data.DeadZone;
            var controlP = Mathf.Abs(control.ElevatorAngle) > _data.DeadZone
                ? Mathf.Abs(pRate) * Mathf.Sign(pRate) * _data.ControlRate
                : 0f;
            var yRate    = control.RudderAngle - _data.DeadZone;
            var controlY = Mathf.Abs(control.RudderAngle) > _data.DeadZone
                ? Mathf.Abs(yRate) * Mathf.Sign(yRate) * _data.ControlRate
                : 0f;

            float P = Mathf.Lerp(PreviousState.RollRate, controlR, _data.Lerp);
            float Q = Mathf.Lerp(PreviousState.PitchRate, controlP, _data.Lerp);
            float R = Mathf.Lerp(PreviousState.YawRate, controlY, _data.Lerp);

            float U = PreviousState.U;
            float V = PreviousState.V;
            float W = PreviousState.W;
            float m = (float)Aircraft.Mass;

            // engine control
            float totalPower = 0;

            foreach (var component in Aircraft.Components)
            {
                if (component is Engine engine)
                {
                    engine.CurrentPower = engine.MaxPower * control.Power;
                    totalPower         += (float)engine.CurrentPower;
                }
            }

            // evaluate current state
            // this is not physics!!!
            CurrentState.U         = 0;
            CurrentState.V         = totalPower;
            CurrentState.W        += deltaTime * Simulator.GravityConstant * 0.1f;
            CurrentState.RollRate  = P;
            CurrentState.PitchRate = Q;
            CurrentState.YawRate   = R;
        }
예제 #25
0
            /// <summary>
            /// Adds a bind with the given name and the given key combo.
            /// </summary>
            public void Add(string bindName, ControlData con1, ControlData con2 = null, ControlData con3 = null)
            {
                var indices = new List <int>();

                indices.Add(con1);

                if (con2 != null)
                {
                    indices.Add(con2);
                }

                if (con3 != null)
                {
                    indices.Add(con3);
                }

                bindData.Add(new MyTuple <string, IReadOnlyList <int> >(bindName, indices));
            }
예제 #26
0
    // Update is called once per frame
    void Update()
    {
        // Process the current instruction in our control data array
        ControlData cd     = pattern[patternIndex];
        float       deltaX = cd.moveX * speed * Time.deltaTime;
        float       deltaY = cd.moveY * speed * Time.deltaTime;

        transform.position += new Vector3(deltaX, deltaY, 0);

        // Increment the patternIndex so that we move to the next piece of pattern data
        patternIndex++;

        // Reset the patternIndex if we are at the end of the instruction array
        if (patternIndex >= pattern.Length)
        {
            patternIndex = 0;
        }
    }
예제 #27
0
        protected virtual Type ResolveWidgetType(ControlData ctrlData)
        {
            if (ctrlData == null)
                throw new ArgumentNullException("ctrlData");

            // different logic for MvcControllerProxy, as designer needs to be obtained from the
            // controller
            if (ctrlData.ObjectType == typeof(MvcControllerProxy).FullName)
            {
                var controllerName = ctrlData.Properties.Where(p => p.Name == "ControllerName" && p.Value != null).First().Value;
                var controllerType = TypeResolutionService.ResolveType(controllerName);
                return controllerType;
            }
            else
            {
                return TypeResolutionService.ResolveType(PageManager.GetControlType(ctrlData).AssemblyQualifiedName);
            }
        }
예제 #28
0
        public void _03_shutdown()
        {
            int initialCount = 0;
            int viewSize     = 1000;
            int fileSize     = 1000000;
            int capacity     = 500;

            TEST = false;
            MMChannel mmMain = null;

            string QueueName = "_08_testPutTake_fixed";

            // Create the MMChannel which will instantiate the memory mapped files, mutexes, semaphores etc ...
            mmMain = MMChannel.GetInstance(QueueName, fileSize, viewSize, capacity, TEST, initTestDataStructureType);

            // perform the test from the main thread
            try
            {
                ControlData controlData = mmMain.MMFControlData;

                // verify that the queue is empty
                Console.WriteLine("_03_shutdown() Queue is empty? = (Count {1} == initialCount {2}) = {0}",
                                  controlData.totalItemsEnqueued - controlData.totalItemsDequeued == initialCount,
                                  controlData.totalItemsEnqueued - controlData.totalItemsDequeued, initialCount);

                Console.WriteLine("Press ENTER to shutdown the Channel");
                Console.ReadLine();
                mmMain.shutdown();

                Console.WriteLine("Press ENTER to FINISH");
                Console.ReadLine();
            }
            catch (Exception unexpected)
            {
                Console.Write(unexpected);
                // throw;
            }
            finally
            {
                Console.WriteLine("\n");
                mmMain.Report();
                mmMain.Dispose();
            }
        }
예제 #29
0
        protected override void EditValue(string key)
        {
            var result = PopupEditors.EditString(ControlData.GetString("valueprompt"), List[key], allowEmptyString: true);

            if (result.Cancelled)
            {
                return;
            }
            if (result.Result == List[key])
            {
                return;
            }

            PrepareForEditing();

            Controller.StartTransaction(string.Format("Update '{0}='{1}'", key, result.Result));
            List.Update(key, result.Result);
            Controller.EndTransaction();
        }
예제 #30
0
    public void ShowControl(NFCWindows.UI_WIN_STATE eState, int nControlID)
    {
        if (mhtWindows.ContainsKey(eState))
        {
            WindowData xWindowData = (WindowData)mhtWindows[eState];

            ControlData xControl = xWindowData.mhtControl[nControlID];
            if (null != xControl && null != xControl.xControlGameObject)
            {
                xControl.xControlGameObject.SetActive(true);

                if (null != xControl.doControlHandleDel)
                {
                    xControl.nActiveCount += 1;
                    xControl.doControlHandleDel(eState, nControlID, true, xControl.nActiveCount);
                }
            }
        }
    }
예제 #31
0
파일: Filter.cs 프로젝트: rinavin/RCJS
        /// <summary>
        /// get data describing control from the windows message
        /// </summary>
        /// <param name="m"></param>
        /// <returns> null, if not magic control,
        /// ControlData if it is magic control</returns>
        private static ControlData MessageToMapData(Message m)
        {
            ControlData controlData = null;
            Control     control     = Control.FromChildHandle(m.HWnd);

            if (control != null)
            {
                MapData mapData = ControlsMap.getInstance().getControlMapData(control);
                if (mapData != null) //this is a magic control
                {
                    controlData = new ControlData()
                    {
                        Control = control, MapData = mapData
                    }
                }
                ;
            }
            return(controlData);
        }
예제 #32
0
        public void AddControl(ControlData control)
        {
            string name = control.Name.ToUpper();

            if (controls.Keys.Contains(name))
            {
                lineCount       -= controls[name].LineCount;
                lineCountOfFile -= controls[name].LineCount;
                controls[name].MergeWith(control);
                lineCount       += controls[name].LineCount;
                lineCountOfFile += controls[name].LineCount;
            }
            else
            {
                controls[name]   = control;
                lineCount       += control.LineCount;
                lineCountOfFile += control.LineCount;
            }
        }
예제 #33
0
        public ActionResult SetTemp(double value1, double value2)
        {
            if (value2 - value1 < 0)
            {
                return(Content("请核对您输入的温度范围"));
            }

            var datas = ControlDataServices.LoadEntities(u => true).LastOrDefault();

            if (datas == null)
            {
                ControlData dat = new ControlData();
                dat.MaxTemperate = value1;
                dat.MinTemperate = value2;
                dat.Oxygen       = 0;
                dat.PhValues     = 0;

                try
                {
                    ControlDataServices.Add(dat);
                    return(Content("设置成功"));
                }
                catch (Exception)
                {
                    return(Content("设置失败,请检查您输入的格式"));
                }
            }
            else
            {
                datas.MaxTemperate = value2;
                datas.MinTemperate = value1;

                try
                {
                    ControlDataServices.Add(datas);
                    return(Content("设置成功"));
                }
                catch (Exception)
                {
                    return(Content("设置失败,请检查您输入的格式"));
                }
            }
        }
예제 #34
0
        protected override void PrepareControlDesigner(ControlData ctrlData)
        {
            var mvcDesigner = this.ResolveMvcDesigner(this.ResolveWidgetType(ctrlData));
            if (mvcDesigner == null)
            {
                base.PrepareControlDesigner(ctrlData);
            }
            else
            {
                var stringWriter = new StringWriter();
                var htmlWriter = new HtmlTextWriter(stringWriter);
                mvcDesigner.RenderControl(htmlWriter);
                var designerLiteral = new LiteralControl() { Text = stringWriter.ToString() };

                this.implementsDesigner = true;
                this.Container.GetControl<Control>("simpleModeView", true).Controls.Add(designerLiteral);

                if (mvcDesigner.Controller.ViewBag.Styles != null)
                {
                    var styles = mvcDesigner.Controller.ViewBag.Styles;
                    foreach (var style in styles)
                    {
                        this.Page.Header.Controls.Add(new LiteralControl() { Text = style.ToHtmlString() });
                    }
                }

                if (mvcDesigner.Controller.ViewBag.Scripts != null)
                {
                    var scripts = mvcDesigner.Controller.ViewBag.Scripts;
                    foreach (var script in scripts)
                    {
                        this.Page.Controls.Add(new LiteralControl() { Text = script.ToHtmlString() });
                    }
                }
            }
        }
예제 #35
0
        public void RegisterControl(Type type)
        {
            if (type == null) throw new ArgumentNullException();
            if (!type.IsSubclassOf(typeof(Control))) throw new ArgumentException();

            Image small, large;
            System.Windows.Forms.Cursor cursor;
            if (!CursorHelper.GetComponentImages(type, out small, out large, out cursor))
                return;

            ControlData newControl = new ControlData(type, cursor);
            ListViewItem newItem = new ListViewItem();
            newItem.Tag = newControl;
            newItem.Text = type.Name;
            newItem.ImageKey = type.ToString();
            listViewComp.Items.Add(newItem);
            SmallImageList.Images.Add(type.ToString(), small);
            LargeImageList.Images.Add(type.ToString(), large);
        }
 public Type InvokeResolveWidgetType(ControlData controlData)
 {
     return base.ResolveWidgetType(controlData);
 }
        private void LoadBlocksToCell(TableCell cell, ControlData[] blocks, string prefix, bool needToBind)
        {
            for (int i = 0; i < blocks.Length; i++)
            {
                if (!String.IsNullOrEmpty(blocks[i].Settings))
                {
                    XmlDocument settings = new XmlDocument();
                    settings.LoadXml(blocks[i].Settings);
                    XmlNode nameNode = settings.SelectSingleNode("MetaDataBlockViewControl/Name");
                    XmlNodeList mfNodeList = settings.SelectNodes("MetaDataBlockViewControl/MetaField");

                    // BlockHeader
                    BlockHeaderLightWithMenu blockHeader = (BlockHeaderLightWithMenu)LoadControl("~/Modules/BlockHeaderLightWithMenu.ascx");
                    blockHeader.ID = String.Concat(prefix, i.ToString());
                    cell.Controls.Add(blockHeader);

                    // Collapsible Table
                    Table collapsibleTable = new Table();
                    collapsibleTable.CssClass = "ibn-stylebox-light text";
                    collapsibleTable.CellSpacing = 0;
                    collapsibleTable.CellPadding = 5;
                    collapsibleTable.Width = Unit.Percentage(100);
                    collapsibleTable.ID = String.Concat("tbl", prefix, i.ToString());
                    cell.Controls.Add(collapsibleTable);

                    blockHeader.CollapsibleControlId = collapsibleTable.ID;
                    blockHeader.AddText(nameNode.InnerText);

                    foreach (XmlNode mfNode in mfNodeList)
                    {
                        foreach (MetaField field in mc.UserMetaFields)
                        {
                            if (field.Name == mfNode.InnerText)
                            {
                                TableRow row = new TableRow();
                                collapsibleTable.Rows.Add(row);

                                TableCell cellTitle = new TableCell();
                                cellTitle.VerticalAlign = VerticalAlign.Middle;
                                cellTitle.CssClass = "ibn-label";
                                cellTitle.Width = Unit.Pixel(220);
                                cellTitle.Text = String.Concat(field.FriendlyName, ":");
                                row.Cells.Add(cellTitle);

                                TableCell cellValue = new TableCell();
                                row.Cells.Add(cellValue);

                                object fieldValue = obj[field.Name];
                                System.Web.UI.UserControl control = null;

                                switch (field.DataType)
                                {
                                    case MetaDataType.Binary:
                                        cellValue.Text = "[BinaryData]";
                                        break;
                                    case MetaDataType.File:
                                        cellTitle.VerticalAlign = VerticalAlign.Top;
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/FileValue.ascx");
                                        break;
                                    case MetaDataType.ImageFile:
                                        cellTitle.VerticalAlign = VerticalAlign.Top;
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/ImageFileValue.ascx");
                                        break;
                                    case MetaDataType.DateTime:
                                        Mediachase.UI.Web.Modules.EditControls.DateTimeValue control_datetime = (Mediachase.UI.Web.Modules.EditControls.DateTimeValue)Page.LoadControl("~/Modules/EditControls/DateTimeValue.ascx");
                                        control_datetime.Path_JS = "../../Scripts/";
                                        control = (System.Web.UI.UserControl)control_datetime;
                                        break;
                                    case MetaDataType.Money:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/MoneyValue.ascx");
                                        break;
                                    case MetaDataType.Float:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/FloatValue.ascx");
                                        break;
                                    case MetaDataType.Integer:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/IntValue.ascx");
                                        break;
                                    case MetaDataType.Boolean:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/BooleanValue.ascx");
                                        break;
                                    case MetaDataType.Date:
                                        Mediachase.UI.Web.Modules.EditControls.DateValue control_date = (Mediachase.UI.Web.Modules.EditControls.DateValue)Page.LoadControl("~/Modules/EditControls/DateValue.ascx");
                                        control_date.Path_JS = "../../Scripts/";
                                        control = (System.Web.UI.UserControl)control_date;
                                        break;
                                    case MetaDataType.Email:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/EmailValue.ascx");
                                        break;
                                    case MetaDataType.Url:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/URLValue.ascx");
                                        break;
                                    case MetaDataType.ShortString:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/ShortStringValue.ascx");
                                        break;
                                    case MetaDataType.LongString:
                                        cellTitle.VerticalAlign = VerticalAlign.Top;
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/LongStringValue.ascx");
                                        break;
                                    case MetaDataType.LongHtmlString:
                                        cellTitle.VerticalAlign = VerticalAlign.Top;
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/LongHTMLStringValue.ascx");
                                        break;
                                    case MetaDataType.DictionarySingleValue:
                                    case MetaDataType.EnumSingleValue:
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/DictionarySingleValue.ascx");
                                        ((DictionarySingleValue)control).InitControl(field.Id, (field.AllowNulls ? !field.IsRequired : field.AllowNulls));
                                        break;
                                    case MetaDataType.DictionaryMultivalue:
                                    case MetaDataType.EnumMultivalue:
                                        cellTitle.VerticalAlign = VerticalAlign.Top;
                                        control = (System.Web.UI.UserControl)Page.LoadControl("~/Modules/EditControls/DictionaryMultivalue.ascx");
                                        ((DictionaryMultivalue)control).InitControl(field.Id);
                                        break;
                                    default:
                                        if (fieldValue != null)
                                            cellValue.Text = fieldValue.ToString();
                                        break;
                                }

                                if (control != null)
                                {
                                    cellValue.Controls.Add(control);

                                    if (field.DataType == MetaDataType.File)
                                    {
                                        ((FileValue)control).MetaClassName = MetaClassName;
                                        ((FileValue)control).ObjectId = ObjectId;
                                    }
                                    else if (field.DataType == MetaDataType.ImageFile)
                                    {
                                        ((ImageFileValue)control).MetaClassName = MetaClassName;
                                        ((ImageFileValue)control).ObjectId = ObjectId;
                                    }

                                    ICustomField iCustomField = ((ICustomField)control);
                                    iCustomField.FieldName = field.Name;
                                    if (fieldValue != null && needToBind)
                                        iCustomField.Value = fieldValue;
                                    iCustomField.AllowEmptyValues = !mc.GetFieldIsRequired(field);
                                }
                            }
                        }
                    }
                }
            }
        }