private void CreateRootHierarchy(string tableName = null)
        {
            // set the GameObject name; this needs to happen after MakeSerializable because the name is set there as well
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = _sourceTable.Name;
            }
            else
            {
                tableName = tableName
                            .Replace("%TABLENAME%", _sourceTable.Name)
                            .Replace("%INFONAME%", _sourceContainer.InfoName);
            }

            _tableGo     = new GameObject(tableName);
            _playfieldGo = new GameObject("Playfield");
            var backglassGo = new GameObject("Backglass");
            var cabinetGo   = new GameObject("Cabinet");

            _tableComponent = _tableGo.AddComponent <TableComponent>();
            _tableComponent.SetData(_sourceTable.Data);

            _playfieldGo.transform.SetParent(_tableGo.transform, false);
            backglassGo.transform.SetParent(_tableGo.transform, false);
            cabinetGo.transform.SetParent(_tableGo.transform, false);

            _playfieldComponent = _playfieldGo.AddComponent <PlayfieldComponent>();
            _playfieldGo.AddComponent <PlayfieldColliderComponent>();
            _playfieldGo.AddComponent <PlayfieldMeshComponent>();
            _playfieldGo.AddComponent <MeshFilter>();
            _playfieldGo.transform.localRotation = PlayfieldComponent.GlobalRotation;
            _playfieldGo.transform.localPosition = new Vector3(-_sourceTable.Width / 2 * PlayfieldComponent.GlobalScale, 0f, _sourceTable.Height / 2 * PlayfieldComponent.GlobalScale);
            _playfieldGo.transform.localScale    = new Vector3(PlayfieldComponent.GlobalScale, PlayfieldComponent.GlobalScale, PlayfieldComponent.GlobalScale);
            _playfieldComponent.SetData(_sourceTable.Data);
        }
Esempio n. 2
0
        public TableComponentColumnForm(TableComponent tablecomponent)
            : this()
        {
            _tablecomponent = tablecomponent;

            this.RefreshForm();
        }
Esempio n. 3
0
        public List <TableComponent> GetTableComponentReport(int IdBaoCao)
        {
            List <TableComponent>    tableComponents  = new List <TableComponent>();
            tongcuclamnghiepEntities tongcuclamnghiep = new tongcuclamnghiepEntities();

            tongcuclamnghiep.m_component.Where(a => a.reporttable_id == IdBaoCao).GroupBy(a => a.orderrow).ToList().ForEach(a => {
                TableComponent tableComponent  = new TableComponent();
                tableComponent.RowId           = a.Key.Value;
                List <HeaderComponent> headers = new List <HeaderComponent>();
                a.ToList().ForEach(b => {
                    headers.Add(new HeaderComponent()
                    {
                        Id        = b.header_id.Value,
                        Title     = b.componentname,
                        TypeValue = b.typevalue.Value,
                        TextAlign = b.m_header.valuetextalign,
                        TextBold  = b.m_header.is_valuebold.Value,
                        TextUpper = b.m_header.is_valueupper.Value
                    });
                });
                tableComponent.headers = headers;
                tableComponents.Add(tableComponent);
            });

            return(tableComponents);
        }
        public void Render(TableComponent tableComponent, CoilListData data, Rect cellRect, int column, Action <CoilListData> updateAction)
        {
            EditorGUI.BeginDisabledGroup(Application.isPlaying);
            var coilStatuses = Application.isPlaying
                                ? tableComponent.gameObject.GetComponent <Player>()?.CoilStatuses
                                : null;

            switch ((CoilListColumn)column)
            {
            case CoilListColumn.Id:
                RenderId(coilStatuses, ref data.Id, id => UpdateId(data, id), data, cellRect, updateAction);
                break;

            case CoilListColumn.Description:
                RenderDescription(data, cellRect, updateAction);
                break;

            case CoilListColumn.Destination:
                RenderDestination(data, cellRect, updateAction);
                break;

            case CoilListColumn.Element:
                RenderElement(data, cellRect, updateAction);
                break;
            }
            EditorGUI.EndDisabledGroup();
        }
Esempio n. 5
0
        public void Render(TableComponent tableComponent, WireListData data, Rect cellRect, int column, Action <WireListData> updateAction)
        {
            EditorGUI.BeginDisabledGroup(Application.isPlaying);
            var switchStatuses = Application.isPlaying
                                ? tableComponent.gameObject.GetComponent <Player>()?.WireStatuses
                                : null;

            switch ((WireListColumn)column)
            {
            case WireListColumn.Description:
                RenderDescription(switchStatuses, data, cellRect, updateAction);
                break;

            case WireListColumn.Source:
                RenderSource(data, cellRect, updateAction);
                break;

            case WireListColumn.SourceElement:
                RenderSourceElement(data, cellRect, updateAction);
                break;

            case WireListColumn.DestinationElement:
                RenderDestinationElement(data, cellRect, updateAction);
                break;

            case WireListColumn.Dynamic:
                RenderIsDynamic(switchStatuses, data, cellRect, updateAction);
                break;

            case WireListColumn.PulseDelay:
                RenderPulseDelay(data, cellRect, updateAction);
                break;
            }
            EditorGUI.EndDisabledGroup();
        }
Esempio n. 6
0
        public static Parent LaunchExample()
        {
            var data = new ObservableCollection <Example>
            {
                new Example {
                    Name = "Test", Number = 7, Color = ConsoleColor.Cyan
                },
                new Example {
                    Name = "Woosh", Number = 18, Color = ConsoleColor.Red
                },
                new Example {
                    Name = "Yeet", Number = 68, Color = ConsoleColor.Gray
                }
            };

            var par = new Parent(new BorderStrategy())
            {
                ClearAreaBeforePrint = true
            };

            var table = new TableComponent <Example> {
                Data = data
            };

            table.ActionOnListElement += (o, args) => { data.Remove(args.Item); };
            table.AddColumn(new IndicatorColumnType <Example>());
            table.AddColumn(new BasicColumnType <Example>("Name", e => e.Name));
            table.AddColumn(new ColorColumnType());
            par.AddComponent(table, BorderStrategy.Center);

            return(par);
        }
Esempio n. 7
0
 public SwitchListViewItemRenderer(List <GamelogicEngineSwitch> gleSwitches, TableComponent tableComponent, InputManager inputManager)
 {
     _gleSwitches    = gleSwitches;
     _inputManager   = inputManager;
     _devicePicker   = new ObjectReferencePicker <ISwitchDeviceComponent>("Switch Devices", tableComponent, false);
     _tableComponent = tableComponent;
 }
Esempio n. 8
0
        public void Render(TableComponent tableComponent, SwitchListData data, Rect cellRect, int column, Action <SwitchListData> updateAction)
        {
            EditorGUI.BeginDisabledGroup(Application.isPlaying);
            var switchStatuses = Application.isPlaying
                                ? tableComponent.gameObject.GetComponent <Player>()?.SwitchStatuses
                                : null;

            switch ((SwitchListColumn)column)
            {
            case SwitchListColumn.Id:
                RenderId(switchStatuses, ref data.Id, id => data.Id = id, data, cellRect, updateAction);
                break;

            case SwitchListColumn.Nc:
                RenderNc(data, cellRect, updateAction);
                break;

            case SwitchListColumn.Description:
                RenderDescription(data, cellRect, updateAction);
                break;

            case SwitchListColumn.Source:
                RenderSource(data, cellRect, updateAction);
                break;

            case SwitchListColumn.Element:
                RenderElement(data, cellRect, updateAction);
                break;

            case SwitchListColumn.PulseDelay:
                RenderPulseDelay(data, cellRect, updateAction);
                break;
            }
            EditorGUI.EndDisabledGroup();
        }
Esempio n. 9
0
        public ViuDemo()
        {
            var mainContainer = new Parent {
                ClearAreaBeforePrint = true
            };
            var cons = new ConsoleParent(mainContainer);

            cons.SetTitle("Viu/SCFE Demo");
            var switcher = new SwitcherStrategy(mainContainer);

            mainContainer.Strategy = switcher;


            var menu = new Parent(new LineStrategy {
                Centered = true
            });

            mainContainer.AddComponent(menu);
            menu.AddComponent(new TextComponent("~ SCFE Demo ~")
            {
                Foreground = ConsoleColor.Yellow, HAlign = HorizontalAlignment.Centered
            });
            menu.AddComponent(new Separator());
            switcher.SwitchToComponent(menu, null);

            var table = new TableComponent <ViuDemoType> {
                Data = _demos
            };

            menu.AddComponent(table);
            table.AddColumn(new IndicatorColumnType <ViuDemoType>());
            table.AddColumn(
                new BasicColumnType <ViuDemoType>("Choose a demo to get started. Exit a demo with the Escape key.",
                                                  vdt => vdt.Name));
            table.ActionOnListElement += (sender, args) =>
            {
                switcher.SwitchToComponent(args.Item.Parent, args.Graphics);
                mainContainer.Validate();
                mainContainer.Print(args.Graphics);
            };

            foreach (var vdt in _demos)
            {
                mainContainer.AddComponent(vdt.Parent);
            }

            mainContainer.ActionMap.Put(StandardActionNames.CancelAction, (o, args) =>
            {
                mainContainer.SetFocused(false, args.Graphics);
                switcher.SwitchToComponent(menu, args.Graphics);
                mainContainer.Validate();
                mainContainer.SetFocused(true, args.Graphics);
                mainContainer.Print(args.Graphics);
            });

            cons.Validate();
            cons.FocusFirst();
            cons.Print();
        }
Esempio n. 10
0
 public static string GetSQLSchema(this TableComponent item)
 {
     if (string.IsNullOrEmpty(item.Parent.DBSchema))
     {
         return("dbo");
     }
     return(item.Parent.DBSchema);
 }
Esempio n. 11
0
 /// <summary>
 /// Links a switch device to an existing switch mapping if it matches a given name.
 /// </summary>
 /// <param name="tableComponent">Table component for retrieving mappings.</param>
 /// <param name="elementName">The name that the switch device's GameObject has to match in order to be linked.</param>
 /// <param name="switchId">The ID of the switch mapping that the switch device will be linked to</param>
 /// <param name="switchDevice">The switch device to be linked</param>
 protected static void LinkSwitch(TableComponent tableComponent, string elementName, string switchId, ISwitchDeviceComponent switchDevice)
 {
     if (!string.Equals(switchDevice.gameObject.name, elementName, StringComparison.OrdinalIgnoreCase))
     {
         return;
     }
     LinkSwitch(tableComponent, switchId, switchDevice);
 }
Esempio n. 12
0
        public WireListViewItemRenderer(TableComponent tableComponent, InputManager inputManager)
        {
            _tableComponent = tableComponent;
            _inputManager   = inputManager;

            _sourceDevicePicker = new ObjectReferencePicker <ISwitchDeviceComponent>("Wire Source", tableComponent, false);
            _destDevicePicker   = new ObjectReferencePicker <IWireableComponent>("Wire Destination", tableComponent, false);
        }
Esempio n. 13
0
 /// <summary>
 /// Links a coil device to an existing coil mapping if it matches a given name.
 /// </summary>
 /// <param name="tableComponent">Table component for retrieving mappings.</param>
 /// <param name="elementName">The name that the coil device's GameObject has to match in order to be linked.</param>
 /// <param name="coilId">The ID of the coil mapping that the coil device will be linked to</param>
 /// <param name="coilDevice">The coil device to be linked</param>
 /// <param name="deviceItem">If set, it's the device item, otherwise the first item of the device.</param>
 protected static void LinkCoil(TableComponent tableComponent, string elementName, string coilId, ICoilDeviceComponent coilDevice, string deviceItem = null)
 {
     if (!string.Equals(coilDevice.gameObject.name, elementName, StringComparison.OrdinalIgnoreCase))
     {
         return;
     }
     LinkCoil(tableComponent, coilId, coilDevice, deviceItem);
 }
Esempio n. 14
0
 public ItemSearchableDropdownUntyped(Type type, AdvancedDropdownState state, TableComponent tableComponent, string title, Action <UnityEngine.Object> onElementSelected) : base(state)
 {
     _type = type;
     _onElementSelected = onElementSelected;
     _tableComponent    = tableComponent;
     minimumSize        = new Vector2(200, 300);
     _title             = title;
 }
Esempio n. 15
0
        public ResSubmit ThemMoiThanhPhan(int IdBaoCao, int RowId)
        {
            tongcuclamnghiepEntities tongcuclamnghiep = new tongcuclamnghiepEntities();
            ResSubmit resSubmit = new ResSubmit(true, "Thêm mới thành công");

            if (!tongcuclamnghiep.m_reporttable.Any(a => a.id == IdBaoCao))
            {
                resSubmit = new ResSubmit(false, "Không có báo cáo này");
            }
            if (resSubmit.success && tongcuclamnghiep.m_component.Any(a => a.reporttable_id == IdBaoCao && a.orderrow == RowId))
            {
                resSubmit = new ResSubmit(false, "Dòng này đã thêm");
            }
            if (resSubmit.success)
            {
                tongcuclamnghiep.m_header.Where(a => a.reporttable_id == IdBaoCao).ToList().ForEach(a =>
                {
                    if (!tongcuclamnghiep.m_header.Any(b => b.header_id == a.id))
                    {
                        m_component _Component = new m_component();
                        if (a.is_component == true || a.is_no == true)
                        {
                            _Component.componentname = "";
                        }
                        _Component.typevalue      = 1;
                        _Component.header_id      = a.id;
                        _Component.orderrow       = RowId;
                        _Component.reporttable_id = IdBaoCao;
                        _Component.status         = true;
                        tongcuclamnghiep.m_component.Add(_Component);
                    }
                });
                if (tongcuclamnghiep.SaveChanges() < 1)
                {
                    resSubmit = new ResSubmit(false, "Thêm mới thất bại");
                }
                else
                {
                    TableComponent tableComponent = new TableComponent();
                    tableComponent.RowId = RowId;
                    List <HeaderComponent> headers = new List <HeaderComponent>();
                    tongcuclamnghiep.m_component.Where(a => a.orderrow == RowId && a.reporttable_id == IdBaoCao).ToList().ForEach(b => {
                        headers.Add(new HeaderComponent()
                        {
                            Id        = b.header_id.Value,
                            Title     = b.componentname,
                            TypeValue = b.typevalue.Value,
                            TextAlign = b.m_header.valuetextalign,
                            TextBold  = b.m_header.is_valuebold.Value,
                            TextUpper = b.m_header.is_valueupper.Value
                        });
                    });
                    tableComponent.headers = headers;
                    resSubmit.extend       = tableComponent;
                }
            }
            return(resSubmit);
        }
Esempio n. 16
0
        public static string BuildSelectList(TableComponent component, ModelRoot model)
        {
            var index      = 0;
            var output     = new StringBuilder();
            var columnList = new List <Column>();

            foreach (Reference r in component.Columns)
            {
                columnList.Add((Column)r.Object);
            }

            foreach (var column in columnList)
            {
                var parentTable = column.ParentTableRef.Object as Table;
                output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, parentTable), column.DatabaseName);
                if ((index < columnList.Count - 1) || (component.Parent.AllowCreateAudit) || (component.Parent.AllowModifiedAudit) || (component.Parent.AllowTimestamp))
                {
                    output.Append(",");
                }
                output.AppendLine();
                index++;
            }

            if (component.Parent.AllowCreateAudit)
            {
                output.AppendFormat("	[{0}].[{1}],", GetTableDatabaseName(model, component.Parent), model.Database.CreatedByColumnName);
                output.AppendLine();

                output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, component.Parent), model.Database.CreatedDateColumnName);
                if ((component.Parent.AllowModifiedAudit) || (component.Parent.AllowTimestamp))
                {
                    output.Append(",");
                }
                output.AppendLine();
            }

            if (component.Parent.AllowModifiedAudit)
            {
                output.AppendFormat("	[{0}].[{1}],", GetTableDatabaseName(model, component.Parent), model.Database.ModifiedByColumnName);
                output.AppendLine();

                output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, component.Parent), model.Database.ModifiedDateColumnName);
                if (component.Parent.AllowTimestamp)
                {
                    output.Append(",");
                }
                output.AppendLine();
            }

            if (component.Parent.AllowTimestamp)
            {
                output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, component.Parent.GetAbsoluteBaseTable()), model.Database.TimestampColumnName);
                output.AppendLine();
            }

            return(output.ToString());
        }
Esempio n. 17
0
        protected virtual void OnEnable()
        {
            Undo.undoRedoPerformed += OnUndoRedoPerformed;

            TableComponent     = (target as MonoBehaviour)?.gameObject.GetComponentInParent <TableComponent>();
            PlayfieldComponent = (target as MonoBehaviour)?.gameObject.GetComponentInParent <PlayfieldComponent>();

            _isLockedProperty = serializedObject.FindProperty("_isLocked");
        }
 public ItemSearchableDropdown(AdvancedDropdownState state, TableComponent tableComponent,
                               string title, Action <T> onElementSelected, Func <T, bool> filter) : base(state)
 {
     _onElementSelected = onElementSelected;
     _filter            = filter;
     _tableComponent    = tableComponent;
     minimumSize        = new Vector2(200, 300);
     _title             = title;
 }
Esempio n. 19
0
        protected override void SetTable(TableComponent table)
        {
            if (_layerHandler == null)
            {
                _layerHandler = new LayerHandler();
            }

            _layerHandler.SetTable(table);
        }
 private void OnTableSelected(object sender, EventArgs e)
 {
     if (!_windowLocked && TableSelector.Instance.SelectedTable != null)
     {
         TableComponent     = TableSelector.Instance.SelectedTable;
         PlayfieldComponent = TableComponent.GetComponentInChildren <PlayfieldComponent>();
         SetTable(TableComponent);
         Repaint();
     }
 }
Esempio n. 21
0
 public override Component GetRowInformation(Example data, int index, int width, bool isFocused, bool isSelected,
                                             TableComponent <Example> parent)
 {
     return(new TextComponent
     {
         Text = typeof(ConsoleColor).GetEnumName(data.Color),
         Foreground = isFocused ? ConsoleColor.Black : data.Color,
         Background = isFocused ? data.Color : (ConsoleColor?)null
     });
 }
Esempio n. 22
0
    public void Init(Transform root)
    {
        #region CollectItem
        if (root.gameObject.tag == EXPORT_TAG)
        {
            var ui = GetComponet(root);
            if (ui != null)
            {
                Debug.Log(string.Format("Name:{0} Tag:{1}", ui.name, root.tag));
                if (!Names.ContainsKey(ui.name))
                {
                    Names.Add(ui.name, ui.GetType().Name);
                    if (typeof(GridLayoutGroup) == ui.GetType())
                    {
                        var table = new TableComponent();
                        table.Name = ui.name;
                        table.Type = TableTypes.UIGrid;
                        for (var i = 0; i < root.childCount; i++)
                        {
                            GetChildExportItems(root.GetChild(i), table.Components);
                        }
                        Tables.Add(table.Name, table);
                        return;
                    }

                    if (typeof(VerticalLayoutGroup) == ui.GetType())
                    {
                        var table = new TableComponent();
                        table.Name = ui.name;
                        table.Type = TableTypes.UITable;
                        for (var i = 0; i < root.childCount; i++)
                        {
                            GetChildExportItems(root.GetChild(i), table.Components);
                        }
                        Tables.Add(table.Name, table);
                        return;
                    }
                }
            }
            else
            {
                if (!Names.ContainsKey(root.name))
                {
                    Names.Add(root.name, root.GetType().Name);
                }
            }
        }
        #endregion

        for (var i = 0; i < root.childCount; i++)
        {
            Init(root.GetChild(i));
        }
    }
Esempio n. 23
0
        /// <summary>
        /// Links a switch device to an existing switch mapping.
        /// </summary>
        /// <param name="tableComponent">Table component for retrieving mappings.</param>
        /// <param name="switchId">The ID of the switch mapping that the switch device will be linked to</param>
        /// <param name="switchDevice">The switch device to be linked</param>
        /// <param name="switchDeviceItem">Switch ID inside of the device item. If null, the first switch will be used.</param>
        protected static void LinkSwitch(TableComponent tableComponent, string switchId, ISwitchDeviceComponent switchDevice, string switchDeviceItem = null)
        {
            var switchMapping = tableComponent.MappingConfig.Switches.FirstOrDefault(sw => sw.Id == switchId);

            if (switchMapping == null)
            {
                return;
            }
            switchMapping.Device     = switchDevice;
            switchMapping.DeviceItem = switchDeviceItem ?? switchDevice.AvailableSwitches.First().Id;
        }
Esempio n. 24
0
        /// <summary>
        /// Links a coil device to an existing coil mapping.
        /// </summary>
        /// <param name="tableComponent">Table component for retrieving mappings.</param>
        /// <param name="coilId">The ID of the coil mapping that the coil device will be linked to</param>
        /// <param name="coilDevice">The coil device to be linked</param>
        /// <param name="deviceItem">If set, it's the device item, otherwise the first item of the device.</param>
        protected static void LinkCoil(TableComponent tableComponent, string coilId, ICoilDeviceComponent coilDevice, string deviceItem = null)
        {
            var coilMapping = tableComponent.MappingConfig.Coils.FirstOrDefault(cm => cm.Id == coilId);

            if (coilMapping == null)
            {
                return;
            }
            coilMapping.Device     = coilDevice;
            coilMapping.DeviceItem = deviceItem ?? coilDevice.AvailableCoils.First().Id;
        }
Esempio n. 25
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (Application.isPlaying)
            {
                var tableApi  = TableComponent.GetComponent <Player>().TableApi;
                var switchApi = tableApi.Switchable((MonoBehaviour) target);

                if (switchApi is CollisionSwitchApi {
                    IsHittable : true
                })
Esempio n. 26
0
        /// <summary>
        /// Populates the layer data from the given table
        /// </summary>
        /// <param name="tableComponent"></param>
        public void SetTable(TableComponent tableComponent)
        {
            var tableChanged = _tableComponent != tableComponent;

            _tableComponent = tableComponent;
            _layers.Clear();
            Rebuild();
            if (tableChanged)
            {
                TableChanged?.Invoke();
            }
        }
Esempio n. 27
0
        public List <TableComponent> GetTableReportAutoRow(int IdBaoCao, AccountCookie accountCookie)
        {
            tongcuclamnghiepEntities tongcuclamnghiep = new tongcuclamnghiepEntities();
            List <TableComponent>    tableComponents  = new List <TableComponent>();
            var _Unit        = tongcuclamnghiep.m_unit.Where(a => a.account_id == accountCookie.Id && a.status == true).FirstOrDefault();
            var _Precious    = tongcuclamnghiep.m_precious.Where(a => a.status == false).FirstOrDefault();
            var _ReportTable = tongcuclamnghiep.m_reporttable.Where(a => a.status == true && a.autorow == true && a.id == IdBaoCao).FirstOrDefault();

            if (!(_Unit == null || _Precious == null || _ReportTable == null))
            {
                var  _UnitReport = tongcuclamnghiep.m_unit_precious.Where(a => a.precious_id == _Precious.id && a.unit_id == _Unit.id).FirstOrDefault();
                bool CheckView   = true;
                if (_UnitReport == null)
                {
                    CheckView = false;
                }
                else
                {
                    if (_UnitReport.completedate != null)
                    {
                        CheckView = false;
                    }
                }
                if (CheckView == true)
                {
                    tongcuclamnghiep.m_unit_datereport_autorows.Where(a => a.reporttable_id == IdBaoCao && a.unit_precious_id == _UnitReport.id).GroupBy(a => a.orderrow).ToList().ForEach(a =>
                    {
                        TableComponent tableComponent           = new TableComponent();
                        tableComponent.RowId                    = a.Key.Value;
                        List <HeaderComponent> headerComponents = new List <HeaderComponent>();
                        _ReportTable.m_header.OrderBy(b => b.level).OrderBy(b => b.order).ToList().ForEach(b =>
                        {
                            var datahead = a.Where(c => c.header_id == b.id).FirstOrDefault();
                            if (datahead != null)
                            {
                                HeaderComponent headerComponent = new HeaderComponent();
                                headerComponent.Id          = datahead.id;
                                headerComponent.OrderHeader = b.order.Value;
                                headerComponent.TextAlign   = b.valuetextalign;
                                headerComponent.TextBold    = b.is_valuebold.Value;
                                headerComponent.TextUpper   = b.is_valueupper.Value;
                                headerComponent.TextValue   = datahead.datatext;
                                headerComponent.HeaderId    = b.id;
                                headerComponents.Add(headerComponent);
                            }
                        });
                        tableComponent.headers = headerComponents;
                        tableComponents.Add(tableComponent);
                    });
                }
            }
            return(tableComponents);
        }
Esempio n. 28
0
        public ResSubmit CapNhatThanhPhanDataType(ComponentUpdate componentUpdate)
        {
            tongcuclamnghiepEntities tongcuclamnghiep = new tongcuclamnghiepEntities();
            ResSubmit resSubmit  = new ResSubmit(true, "Cập nhật thành công");
            var       _Component = tongcuclamnghiep.m_component.Where(a => a.header_id == componentUpdate.HeaderId && a.reporttable_id == componentUpdate.IdBaoCao && a.orderrow == componentUpdate.RowId).FirstOrDefault();

            if (!tongcuclamnghiep.m_reporttable.Any(a => a.id == componentUpdate.IdBaoCao))
            {
                resSubmit = new ResSubmit(false, "Không có báo cáo này");
            }
            if (resSubmit.success && _Component == null)
            {
                resSubmit = new ResSubmit(false, "Không có thành phần này");
            }
            if (resSubmit.success)
            {
                if (_Component.m_header.is_no == true || _Component.m_header.is_component == true)
                {
                    _Component.componentname = componentUpdate.Title;
                    _Component.typevalue     = 1;
                }
                else
                {
                    _Component.typevalue = componentUpdate.TypeValue;
                }
                if (tongcuclamnghiep.SaveChanges() != 1)
                {
                    resSubmit = new ResSubmit(false, "Cập nhật thất bại");
                }
                else
                {
                    TableComponent tableComponent = new TableComponent();
                    tableComponent.RowId = componentUpdate.RowId;
                    List <HeaderComponent> headers = new List <HeaderComponent>();
                    tongcuclamnghiep.m_component.Where(a => a.orderrow == componentUpdate.RowId && a.reporttable_id == componentUpdate.IdBaoCao).ToList().ForEach(b => {
                        headers.Add(new HeaderComponent()
                        {
                            Id        = b.header_id.Value,
                            Title     = b.componentname,
                            TypeValue = b.typevalue.Value,
                            TextAlign = b.m_header.valuetextalign,
                            TextBold  = b.m_header.is_valuebold.Value,
                            TextUpper = b.m_header.is_valueupper.Value
                        });
                    });
                    tableComponent.headers = headers;
                    resSubmit.extend       = tableComponent;
                }
            }
            return(resSubmit);
        }
Esempio n. 29
0
        private void OnEnable()
        {
            _gle = (PinMameGamelogicEngine)target;

            _games = new PinMameGame[] {
                new AttackFromMars(),
                new CreatureFromTheBlackLagoon(),
                new MedievalMadness(),
                new Terminator2(),
                new FlashGordon(),
                new StarTrekEnterprise(),
                new Rock(),
                new RockEncore(),
            };
            _gameNames = new[] { "-- none --" }
            .Concat(_games.Select(g => g.Name))
            .ToArray();

            if (_gle != null)
            {
                _tableComponent = _gle.gameObject.GetComponentInParent <TableComponent>();
            }

            if (IsGameSet)
            {
                for (var i = 0; i < _games.Length; i++)
                {
                    if (_games[i].Id == _gle.Game.Id)
                    {
                        _selectedGameIndex = i + 1;
                        break;
                    }
                }
                _romNames = _gle.Game.Roms.Select(g => g.ToString()).ToArray();
                if (!string.IsNullOrEmpty(_gle.romId))
                {
                    for (var i = 0; i < _gle.Game.Roms.Length; i++)
                    {
                        if (_gle.Game.Roms[i].Id == _gle.romId)
                        {
                            _selectedRomIndex = i;
                            break;
                        }
                    }
                }
            }

            _solenoidDelayProperty = serializedObject.FindProperty(nameof(_gle.SolenoidDelay));
            _disableMechsProperty  = serializedObject.FindProperty(nameof(_gle.DisableMechs));
            _disableAudioProperty  = serializedObject.FindProperty(nameof(_gle.DisableAudio));
        }
Esempio n. 30
0
        public FileOptionsPanel(ImmutableList <File> f, AbstractHierarchicalDictionary <KeyStroke, string> inputMap)
        {
            TextComponent fileName;

            Strategy = new BorderStrategy();

            var topParent = new Parent(new LineStrategy {
                Orientation = Orientation.Vertical
            });

            AddComponent(topParent, BorderStrategy.Top);
            fileName = new TextComponent(f == null ? "Current directory options" :
                                         f.Count == 1 ? f[0].GetFileName() : f.Count + " files...")
            {
                HAlign = HorizontalAlignment.Centered
            };
            topParent.AddComponent(fileName);
            topParent.AddComponent(new Separator());

            var table = new TableComponent <FileOption>
            {
                Data = new ObservableCollection <FileOption>(f == null
                    ? FileOption.OptionsForCurrentDirectory
                                                             .Where(opt => opt.CanActionBeApplied?.Invoke(null, null) ?? true).ToList()
                    : FileOption.Options
                                                             .Where(opt => opt.CanActionBeApplied(f, null)).ToList()),
                ShowHeader = false
            };

            table.AddColumn(new IndicatorColumnType <FileOption>());
            table.AddColumn(new BasicColumnType <FileOption>("", option => option.Title)
            {
                GrowPriority = 1
            });
            table.AddColumn(
                new BasicColumnType <FileOption>("", option => SearchForShortcut(option.ActionName, inputMap))
            {
                HAlign = HorizontalAlignment.Right
            });
            table.ActionOnListElement += (sender, args) => { RemovalCallback(args.Item.ActionName, args.Graphics); };
            AddComponent(table, BorderStrategy.Center);

            var btn = new Button("Back");

            btn.ActionOnComponent += (sender, args) => RemovalCallback?.Invoke(null, args.Graphics);
            AddComponent(btn, BorderStrategy.Bottom);

            ActionMap.Put(StandardActionNames.CancelAction, (o, args) => RemovalCallback?.Invoke(null, args.Graphics));
        }
		public SQLSelectComponentByFieldTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
		public DomainComponentCollectionExtenderTemplate(ModelRoot model, TableComponent currentComponent)
    {
      _model = model;
      _currentComponent = currentComponent;
		}
		public DomainComponentCollectionGeneratedTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
		public SQLSelectComponentByPrimaryKeyTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
		public SQLSelectComponentByModifiedDateTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
		public BusinessComponentExtenderTemplate(ModelRoot model, TableComponent currentComponent)
    {
      _model = model;
			_currentComponent = currentComponent;
		}
		public SqlSelectComponentTemplate(ModelRoot model, TableComponent currentComponent)
    {			
      _model = model;
			_currentComponent = currentComponent;
		}
		public BusinessComponentGeneratedTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
		public SelectComponentCommandGeneratedTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
Esempio n. 40
0
		public static string BuildSelectList(TableComponent component, ModelRoot model)
		{
			int index = 0;
			StringBuilder output = new StringBuilder();
			List<Column> columnList = new List<Column>();
			foreach (Reference r in component.Columns)
				columnList.Add((Column)r.Object);

			foreach (Column dc in columnList)
			{
				Table parentTable = (Table)dc.ParentTableRef.Object;
				output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, parentTable), dc.DatabaseName.ToLower());
				if ((index < columnList.Count - 1) || (component.Parent.AllowCreateAudit) || (component.Parent.AllowModifiedAudit) || (component.Parent.AllowTimestamp))
					output.Append(",");
				output.AppendLine();
				index++;
			}

			if (component.Parent.AllowCreateAudit)
			{
				output.AppendFormat("	[{0}].[{1}],", GetTableDatabaseName(model, component.Parent), model.Database.CreatedByColumnName);
				output.AppendLine();

				output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, component.Parent), model.Database.CreatedDateColumnName);
				if ((component.Parent.AllowModifiedAudit) || (component.Parent.AllowTimestamp))
					output.Append(",");
				output.AppendLine();
			}

			if (component.Parent.AllowModifiedAudit)
			{
				output.AppendFormat("	[{0}].[{1}],", GetTableDatabaseName(model, component.Parent), model.Database.ModifiedByColumnName);
				output.AppendLine();

				output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, component.Parent), model.Database.ModifiedDateColumnName);
				if (component.Parent.AllowTimestamp)
					output.Append(",");
				output.AppendLine();
			}

			if (component.Parent.AllowTimestamp)
			{
				output.AppendFormat("	[{0}].[{1}]", GetTableDatabaseName(model, component.Parent), model.Database.TimestampColumnName);
				output.AppendLine();
			}

			return output.ToString();
		}
		public SQLUpdateComponentTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
		public SelectComponentCommandExtenderTemplate(ModelRoot model, TableComponent currentComponent)
    {
      _model = model;
      _currentComponent = currentComponent;
		}