public PatchGridViewRow(XenServerPatchAlert alert)
            {
                _alert           = alert;
                _nameCell        = new DataGridViewTextBoxCell();
                _descriptionCell = new DataGridViewTextBoxCell();
                _dateCell        = new DataGridViewTextBoxCell();
                _webPageCell     = new DataGridViewLinkCell();

                Cells.Add(_nameCell);
                Cells.Add(_descriptionCell);
                Cells.Add(_dateCell);
                Cells.Add(_webPageCell);

                _nameCell.Value        = String.Format(alert.Name);
                _descriptionCell.Value = String.Format(alert.Description);
                _dateCell.Value        = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY, true);
                _webPageCell.Value     = Messages.PATCHING_WIZARD_WEBPAGE_CELL;
            }
Ejemplo n.º 2
0
 public void CreateTextOnColumn()
 {
     if (Rows == 1)
     {
         while (oldColumns < Columns)
         {
             var textCell = new TextCellVM()
             {
                 Content             = "123",
                 Height              = Cells[0].Height,
                 Width               = Cells[0].Width,
                 CellRow             = Rows - 1,
                 CellColumn          = oldColumns,
                 HorizontalAlignment = HorizontalAlignment.Stretch,
                 VerticalAlignment   = VerticalAlignment.Center,
                 NameColor           = System.Windows.Media.Colors.White.ToString()
             };
             Width += Cells[0].Width;
             Cells.Add(textCell);
             selectCell = textCell;
             oldColumns++;
         }
     }
     for (; oldColumns < Columns; oldColumns++)
     {
         Width += Cells[0].Width;
         for (var i = 0; i <= Rows - 1; i++)
         {
             var textCell = new TextCellVM()
             {
                 Content             = "123",
                 Height              = Cells[0].Height,
                 Width               = Cells[0].Width,
                 CellRow             = i,
                 CellColumn          = oldColumns,
                 HorizontalAlignment = HorizontalAlignment.Stretch,
                 VerticalAlignment   = VerticalAlignment.Center,
                 NameColor           = System.Windows.Media.Colors.White.ToString()
             };
             Cells.Add(textCell);
             selectCell = textCell;
         }
     }
 }
Ejemplo n.º 3
0
        public GridRow(WebSearchResult webSearchResult, int count) : this()
        {
            HeaderCell.Value = $"{count + 1}";

            Cells.Add(new DataGridViewTextBoxCell());
            Cells[0].Style.BackColor = webSearchResult.IsVIPad ? Color.DarkOrange : Color.White;

            DataGridViewTextBoxCell dateCell = new DataGridViewTextBoxCell()
            {
                Value = webSearchResult.Date.ToString(CultureInfo.CurrentUICulture)
            };

            Cells.Add(dateCell);
            dateCell.Style.BackColor = webSearchResult.IsHighlighted ? Color.Lavender : Color.White;

            if (webSearchResult.ImageBinary == null && webSearchResult.ImageBase64 != null)
            {
                webSearchResult.ImageBinary = ImageUtil.Base64StringToImage(webSearchResult.ImageBase64);
            }
            Cells.Add(new DataGridViewImageCell()
            {
                Value = (Image)webSearchResult.ImageBinary
            });
            DataGridViewLinkCell linkCell = new DataGridViewLinkCell
            {
                Value = webSearchResult.Title.Text,
                Tag   = webSearchResult.Title.Url
            };

            Cells.Add(linkCell);
            Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = $"{webSearchResult.Price:C}"
            });
            Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = webSearchResult.Category
            });
            Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = webSearchResult.Address
            });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="Content">Content of the row</param>
        /// <param name="Delimiter">Delimiter to parse the individual cells</param>
        public Row(string Content, string Delimiter)
        {
            Contract.Requires <ArgumentNullException>(Content != null, "Content");
            Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(Delimiter), "Delimiter");
            this.Cells     = new List <Cell>();
            this.Delimiter = Delimiter;
            var             TempSplitter = new Regex(string.Format(CultureInfo.InvariantCulture, "(?<Value>\"(?:[^\"]|\"\")*\"|[^{0}\r\n]*?)(?<Delimiter>{0}|\r\n|\n|$)", Regex.Escape(Delimiter)));
            MatchCollection Matches      = TempSplitter.Matches(Content);
            bool            Finished     = false;

            foreach (Match Match in Matches)
            {
                if (!Finished)
                {
                    Cells.Add(new Cell(Match.Groups["Value"].Value));
                }
                Finished = string.IsNullOrEmpty(Match.Groups["Delimiter"].Value) || Match.Groups["Delimiter"].Value == "\r\n" || Match.Groups["Delimiter"].Value == "\n";
            }
        }
Ejemplo n.º 5
0
        protected override void InitField()
        {
            for (int i = 0; i < LevelData.Row; ++i)
            {
                for (int j = 0; j < LevelData.Col; ++j)
                {
                    var go = Instantiate(PrefabCell, transform);
                    go.transform.position = new Vector3(i, 0f, j);
                    Cells.Add(go);
                    go.NumberCell = Cells.Count - 1;
                }
            }

            LevelData.Box.ForEach(t => Cells[t].GetComponent <MeshRenderer>().material = _box);

            LevelData.Wall.ForEach(t => Cells[t].GetComponent <MeshRenderer>().material = _wall);

            Cells[LevelData.FinalPoint].GetComponent <MeshRenderer>().material = _point;
        }
Ejemplo n.º 6
0
        public void SetButtonGridUp()
        {
            // If there is a size change.
            if (Cells.Count == 0 || Cells.Count != _model.ActiveTableSize * _model.ActiveTableSize)
            {
                Cells.Clear();
                for (Int32 i = 0; i < _model.ActiveTableSize; ++i)
                {
                    for (Int32 j = 0; j < _model.ActiveTableSize; ++j)
                    {
                        //TODO: Only create the new ones? It seams even harder then in WFA.
                        Cells.Add(new ReversiCell(new DelegateCommand(param => MakePutDown(Convert.ToInt32(param))), i, j, ((i * _model.ActiveTableSize) + j)));
                    }
                }
            }

            _tableSizeOfCells = _model.ActiveTableSize;
            OnPropertyChanged("TableSizeOfCells");
        }
Ejemplo n.º 7
0
 public bool AddWord(CustomCell cell)
 {
     if (Left == 0 && Right == 0)
     {
         Cells.Add(cell);
         Left  = cell.Left;
         Right = cell.Right;
         return(true);
     }
     else if ((cell.Left >= Left && cell.Left <= Right) ||
              (cell.Right <= Right && cell.Right >= Left))
     {
         Cells.Add(cell);
         Left  = Math.Min(Left, cell.Left);
         Right = Math.Max(Right, cell.Right);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 8
0
        public bool AddCell(LevelObject.Cell cell)
        {
            var existingCell = GetCellAt(cell.Location.x, cell.Location.y);

            if (existingCell != null)
            {
                return(false);
            }

            try
            {
                Cells.Add(cell.Location.x, cell.Location.y, cell);
                return(true);
            }
            catch (IndexOutOfRangeException)
            {
                return(false);
            }
        }
Ejemplo n.º 9
0
        public BaseCell this[int x, int y]
        {
            //var cell = Maze[1,2];
            get
            {
                return(Cells.SingleOrDefault(cell => cell.Coordinates.X == x && cell.Coordinates.Y == y));
            }

            //Maze[1,2] = new Wall(1,2);
            set
            {
                var oldCell = this[value.Coordinates.X, value.Coordinates.Y];
                if (oldCell != null)
                {
                    Cells.Remove(oldCell);
                }
                Cells.Add(value);
            }
        }
Ejemplo n.º 10
0
        private void Model_CellChanged(Object sender, CellChangedEventArgs e)
        {
            if (e.CellState == Cell.Dead)
            {
                CellField cellToRemove = Cells.Single(cell => Math.Abs(cell.Row - e.PosX * CellSizeY) < 0.0001 && Math.Abs(cell.Column - e.PosY * CellSizeX) < 0.0001);
                Cells.Remove(cellToRemove);
            }
            else
            {
                Cells.Add(new CellField
                {
                    CellState = (int)Cell.Alive,
                    Row       = e.PosX * CellSizeY,
                    Column    = e.PosY * CellSizeX
                });
            }

            OnPropertyChanged("Generation");
        }
Ejemplo n.º 11
0
 private void InitializeColor()
 {
     for (int i = 0; i < 8; i++)
     {
         for (int j = 0; j < 4; j++)
         {
             if (i % 2 == 0)
             {
                 Cells.Add(new Cell("#d0c6bd"));
                 Cells.Add(new Cell("#2d2d30"));
             }
             else
             {
                 Cells.Add(new Cell("#2d2d30"));
                 Cells.Add(new Cell("#d0c6bd"));
             }
         }
     }
 }
Ejemplo n.º 12
0
        private void SetCells()
        {
            var list = new List <char>();

            foreach (var item in Words)
            {
                list.AddRange(item.GetOneCharacter());
            }

            while (list.Count > 0)
            {
                var randomNumber = RandomNumber(list.Count);
                Cells.Add(new CellEntity()
                {
                    Value = list[randomNumber]
                });
                list.Remove(list[randomNumber]);
            }
        }
Ejemplo n.º 13
0
        private void OmrådekartFraXml(XDocument gridLayerXml)
        {
            var mapElements = NinXmlParser.GetChildElements(gridLayerXml.Root, "kartElementer",
                                                            TillatAntall.EnEllerFlere);

            foreach (var mapElement in mapElements)
            {
                var gridMapElement = NinXmlParser.GetChildElements(mapElement, "OmraadeKartElement",
                                                                   TillatAntall.AkkuratEn);

                var gridLayerCell    = new GridLayerCellCustom();
                var gridLayerItemIds = NinXmlParser.GetChildElements(gridMapElement[0], "id",
                                                                     TillatAntall.AkkuratEn);
                gridLayerCell.CellId = gridLayerItemIds[0].Value;

                var gridLayerCellGeometries = NinXmlParser.GetChildElements(gridMapElement[0], "geometri",
                                                                            TillatAntall.AkkuratEn);
                int epsgCode;
                var geometry = NinXmlParser.ParseGeometry(gridLayerCellGeometries[0], out epsgCode);
                gridLayerCell.CustomCell = SqlGeometry.STGeomFromText(new SqlChars(geometry), epsgCode);

                var gridLayerItemValues = NinXmlParser.GetChildElements(gridMapElement[0], "trinnVerdi",
                                                                        TillatAntall.AkkuratEn);
                gridLayerCell.Value = gridLayerItemValues[0].Value;

                if (Cells.Count == 0)
                {
                    MinValue = gridLayerCell.Value;
                    MaxValue = gridLayerCell.Value;
                }
                else
                {
                    string minValue;
                    string maxValue;
                    AreaLayerImpl.GuessMinAndMaxValues(true, gridLayerCell.Value, MinValue,
                                                       MaxValue, out minValue, out maxValue);
                    MinValue = minValue;
                    MaxValue = maxValue;
                }

                Cells.Add(gridLayerCell);
            }
        }
Ejemplo n.º 14
0
        protected override void CreateControlHierarchy()
        {
            CreateIndentCells();

            if (RenderHelper.AddFilterRowTemplateControl(this, LeafColumns.Count))
            {
                return;
            }

            for (var leafIndex = 0; leafIndex < LeafColumns.Count; ++leafIndex)
            {
                Cells.Add(
                    CreateFilterCell(
                        LeafColumns[leafIndex].Column,
                        RenderHelper.ShouldRemoveRightBorder(leafIndex)
                        )
                    );
            }
        }
Ejemplo n.º 15
0
        // Methods
        internal void Init(IDataReader Reader, int MapVersion)
        {
            if (MapVersion >= 9)
            {
                LayerId = Reader.ReadSByte();
            }
            else
            {
                LayerId = Reader.ReadInt();
            }

            CellsCount = Reader.ReadShort();
            for (int i = 0; i < CellsCount; i++)
            {
                Cell item = new Cell();
                item.Init(Reader, MapVersion);
                Cells.Add(item);
            }
        }
Ejemplo n.º 16
0
 public void AddCells(IEnumerable <SeaCell> cells)
 {
     lock (Cells)
     {
         foreach (var cell in cells)
         {
             if (Cells.Count < Size)
             {
                 Cells.Add(cell);
                 cell.BindShip(this);
                 cell.OnCellStateChanged += Cell_OnCellStateChanged;
             }
             else
             {
                 throw new InvalidOperationException("Ship already has enough cells.");
             }
         }
     }
 }
Ejemplo n.º 17
0
        private void RutenettkartFraXml(XDocument gridLayerXml)
        {
            bool numberCompare             = true;
            Collection <XElement> gridNets = NinXmlParser.GetChildElements(gridLayerXml.Root, "ruteNett",
                                                                           TillatAntall.AkkuratEn);

            Type = TilGridType(gridNets[0].Value);

            var mapElements = NinXmlParser.GetChildElements(gridLayerXml.Root, "kartElementer",
                                                            TillatAntall.EnEllerFlere);

            foreach (var mapElement in mapElements)
            {
                var gridMapElement = NinXmlParser.GetChildElements(mapElement, "RuteNettKartElement",
                                                                   TillatAntall.AkkuratEn);

                var layer            = new GridLayerCell();
                var gridLayerCellIds = NinXmlParser.GetChildElements(gridMapElement[0], "id", TillatAntall.AkkuratEn);
                layer.CellId = gridLayerCellIds[0].Value;

                var gridLayerCellValues = NinXmlParser.GetChildElements(gridMapElement[0], "trinnVerdi",
                                                                        TillatAntall.AkkuratEn);
                layer.Value = gridLayerCellValues[0].Value;

                if (Cells.Count == 0)
                {
                    MinValue = layer.Value;
                    MaxValue = layer.Value;
                }
                else
                {
                    string minValue;
                    string maxValue;
                    numberCompare = AreaLayerImpl.GuessMinAndMaxValues(numberCompare, layer.Value, MinValue,
                                                                       MaxValue, out minValue, out maxValue);
                    MinValue = minValue;
                    MaxValue = maxValue;
                }

                Cells.Add(layer);
            }
        }
Ejemplo n.º 18
0
        public PlayerTableRow(Map map, Player ply)
        {
            _player = ply;
            _map    = map;

            // player is currently visible?
            Cells.Add(VillageTableRow.GetVisibleImageCell(_map, _player));

            Cells.Add(ColumnDisplay.CreatePlayerCell(ply));
            string tribe = ply.HasTribe ? ply.Tribe.Tag : string.Empty;

            if (ply.TribeChange && ply.PreviousPlayerDetails.Tribe != null)
            {
                Cells.Add(ColumnDisplay.CreateDifferenceCell(ply.PreviousPlayerDetails.Tribe.Tag));
            }
            else
            {
                Cells.Add(new Cell());
            }
            Cells.Add(new Cell(tribe)
            {
                ToolTipText = ply.HasTribe ? ply.Tribe.Tooltip : ""
            });
            Cells.Add(new Cell(ply.Points));
            if (ply.PreviousPlayerDetails != null)
            {
                Cells.Add(ColumnDisplay.CreateDifferenceCell(ply.Points - ply.PreviousPlayerDetails.Points));
            }
            else
            {
                Cells.Add(new Cell());
            }
            Cells.Add(new Cell(ply.Villages.Count));
            if (ply.PreviousPlayerDetails != null)
            {
                Cells.Add(new Cell(ply.ConquerString));
            }
            else
            {
                Cells.Add(new Cell());
            }
        }
Ejemplo n.º 19
0
            public VMRestoreRow(VM vm)
            {
                // The image cell, shows the current state of the VM
                DataGridViewImageCell iconCell = new DataGridViewImageCell();

                iconCell.Value = Images.GetImage16For(vm);
                Cells.Add(iconCell);

                // The VM name cell
                DataGridViewTextBoxCell nameCell = new DataGridViewTextBoxCell();

                nameCell.Value = Helpers.GetName(vm);
                Cells.Add(nameCell);

                // The current location cell
                DataGridViewTextBoxCell locationCell = new DataGridViewTextBoxCell();

                locationCell.Value = Helpers.GetName(vm.Connection.Resolve(vm.resident_on));
                Cells.Add(locationCell);
            }
Ejemplo n.º 20
0
 public void CreateCells(DataGridView dataGridView)
 {
     if (dataGridView == null)
     {
         throw new ArgumentNullException("DataGridView is null.");
     }
     if (dataGridView.Rows.Contains(this))
     {
         throw new InvalidOperationException("The row already exists in the DataGridView.");
     }
     Cells.Clear();
     foreach (DataGridViewColumn column in dataGridView.Columns)
     {
         if (column.CellTemplate == null)
         {
             throw new InvalidOperationException("Cell template not set in column: " + column.Index.ToString() + ".");
         }
         Cells.Add((DataGridViewCell)column.CellTemplate.Clone());
     }
 }
Ejemplo n.º 21
0
        private void SetTableCells()
        {
            System.Console.WriteLine(@"Enter cell values");
            for (var rowIndex = 0; rowIndex < RowCount; rowIndex++)
            {
                var values = GetValueFromConsoleByTab();
                ThrowIfIncorrectInputSize(values, ColumnCount);

                for (var columnIndex = 0; columnIndex < values.Length; columnIndex++)
                {
                    ICellProperties cellProperties = new CellProperties(values[columnIndex]);
                    cellProperties.SetupProperties();

                    ICell cell = new Cell(columnIndex, rowIndex, cellProperties);
                    cell.SetupProperties();

                    Cells.Add(cell);
                }
            }
        }
Ejemplo n.º 22
0
        public void Add(HCell cell)
        {
            int   level;
            AABB  aabb = cell.Collider.ComputeAABB();
            float size = 10, width = (float)(aabb.Max.X - aabb.Min.X);

            for (level = 0; size * 1 < width; level++)
            {
                size *= 2;
            }

            Debug.Assert(level >= MAX_LEVEL, "The collider is too big. It cannot be contain in this hgrid");

            if (Cells.TryGetValue(level, out LinkedList <HCell> value))
            {
                value.AddLast(cell);
                Cells.Add(level, value);
                OccupiedLevelMask |= (1 << level);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Create Cells
        /// </summary>
        public bool CreateCells()
        {
            try
            {
                Cells.Clear();
                for (int i = 0; i < CellCount; ++i)
                {
                    Cells.Add(new Cell("Line" + i, new List <TimeFrame>(), 0, 0, new List <TimeFrame>(), 0, new Dictionary <double, int>()));
                }
#if DEBUG
                Debug.Print("Cell size is " + Cells.Count);
#endif
                return(true);
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 24
0
        public void SetCellValue(int i, string newValue)
        {
            while (Cells.Count <= i)
            {
                Cells.Add("");
                Instance.UpdatedFields.Add(ID);
            }

            if (newValue.Length > MAX_CELL_CHARS)
            {
                newValue = newValue.Substring(0, MAX_CELL_CHARS) + "...";
            }

            if (Cells[i] != newValue)
            {
                Instance.UpdatedFields.Add(ID);
            }

            Cells[i] = newValue;
        }
Ejemplo n.º 25
0
    void RemoveWalls(Cell a, Cell b)
    {
        int x = (a.X != b.X) ? (a.X > b.X ? a.X - 1 : a.X + 1) : a.X;
        int y = (a.Y != b.Y) ? (a.Y > b.Y ? a.Y - 1 : a.Y + 1) : a.Y;

        foreach (Cell wall in Walls)
        {
            if (wall.X == x && wall.Y == y)
            {
                CreateVertex(wall);
                Cell cell = CreateCell(wall.X, wall.Y);
                CreateEdge(1, sa.FindVertex(a.X, a.Y), sa.FindVertex(wall.X, wall.Y));
                Cells.Add(cell);
                DisplayCell(cell);
                Walls.Remove(wall);
                break;
            }
        }

        if (a.X - b.X == 2)
        {
            a.walls[(int)Direction.Top]    = false;
            b.walls[(int)Direction.Bottom] = false;
        }
        else if (a.X - b.X == -2)
        {
            a.walls[(int)Direction.Bottom] = false;
            b.walls[(int)Direction.Top]    = false;
        }

        if (a.Y - b.Y == 2)
        {
            a.walls[(int)Direction.Left]  = false;
            b.walls[(int)Direction.Right] = false;
        }
        else if (a.Y - b.Y == -2)
        {
            a.walls[(int)Direction.Right] = false;
            b.walls[(int)Direction.Left]  = false;
        }
    }
Ejemplo n.º 26
0
        private void SetupCells()
        {
            _poolCheckBoxCell = new DataGridViewCheckBoxCell
            {
                ThreeState         = true,
                TrueValue          = CheckState.Checked,
                FalseValue         = CheckState.Unchecked,
                IndeterminateValue = CheckState.Indeterminate,
            };

            _expansionCell = new DataGridViewImageCell();
            _nameCell      = new DataGridViewNameCell();

            Cells.Add(_expansionCell);
            Cells.Add(_poolCheckBoxCell);
            Cells.Add(_nameCell);

            SetupAdditionalDetailsColumns();

            UpdateDetails();
        }
Ejemplo n.º 27
0
        private void InitializeGrid(List <Cell> liveCells = null)
        {
            if (liveCells == null)
            {
                liveCells = RandomizeLiveCells();
            }

            for (int c = 1; c <= Columns; c++)
            {
                for (int r = 1; r <= Rows; r++)
                {
                    var cell = new Cell(c, r);
                    if (liveCells.Contains(cell))
                    {
                        cell.Alive = true;
                    }

                    Cells.Add(cell);
                }
            }
        }
Ejemplo n.º 28
0
 public Labyrinth(int width, int height)
 {
     Width  = width;
     Height = height;
     for (var y = 0; y < Height; y++)
     {
         for (var x = 0; x < Width; x++)
         {
             if (x == 0 || x == Width - 1 || y == 0 || y == Height - 1)
             {
                 var cell = new Cell(x, y, CellType.GreatWall); // border made from greatWall blocks
                 Cells.Add(cell);
             }
             else
             {
                 var cell = new Cell(x, y, CellType.Wall); // all cells are walls
                 Cells.Add(cell);
             }
         }
     }
 }
Ejemplo n.º 29
0
        public static string getAllDataToExcle()
        {
            int    code    = 1;
            string message = "返回数据成功";
            List <StudentsUser> ListUser = new List <StudentsUser>();

            using (StudentsUserBLL bll = new StudentsUserBLL())
            {
                ListUser = bll.getStudentUser();
            }

            XlsDocument xls = new XlsDocument();//建立excle工作表

            if (ListUser.Count != 0)
            {
                xls.FileName = DateTime.Now.ToString("u").Replace(":", "-").Replace("Z", "");
                Worksheet sheet = xls.Workbook.Worksheets.Add("考生数据");
                Cells     cells = sheet.Cells;
                cells.Add(1, 1, "身份证号");
                cells.Add(1, 2, "姓名");
                cells.Add(1, 3, "准考证号");
                cells.Add(1, 4, "手机号");
                for (int i = 1; i <= ListUser.Count; i++)
                {
                    cells.Add(i + 1, 1, ListUser[i - 1].Sfzh);
                    cells.Add(i + 1, 2, ListUser[i - 1].StuName);
                    cells.Add(i + 1, 3, ListUser[i - 1].Zkzh);
                    cells.Add(i + 1, 4, ListUser[i - 1].Mobile);
                }
                xls.Save(HttpContext.Current.Server.MapPath("~/uploads") + "//");
            }
            return(JsonConvert.SerializeObject(new
            {
                code = code,
                message = message,
                filePath = "uploads/" + xls.FileName,
            }));
        }
Ejemplo n.º 30
0
        public void RefreshCells()
        {
            Cells.Clear();

            List <Coordinates> aliveCells = _model.AliveCells;

            foreach (Coordinates coord in aliveCells)
            {
                Cells.Add(new CellField
                {
                    CellState = (int)Cell.Alive,
                    Row       = coord.x * CellSizeY,
                    Column    = coord.y * CellSizeX
                });
            }

            OnPropertyChanged("Generation");
            OnPropertyChanged("Size");
            OnPropertyChanged("Paused");
            OnPropertyChanged("Playing");
        }