public MainPageController(MenherachanContext db, IBoardCollection collection, IWebHostEnvironment env) { _db = db; _collection = collection; _env = env; _logDirectory = Path.Combine(_env.WebRootPath, "logs", "main_page_logs.log"); }
private IBoard GetMainBoard() { Task <IBoardCollection> getBoards = this.GetBoards(); getBoards.Wait(); IBoardCollection boards = getBoards.Result; return(boards[0]); }
public ReportController(MenherachanContext db, IBoardCollection collection, IWebHostEnvironment env) { _db = db; _collection = collection; _env = env; _logDirectory = Path.Combine(_env.WebRootPath, "logs", "report_logs.log"); _md5 = new MD5CryptoServiceProvider(); }
protected override bool CanAddControl(IBoardCollection <GameSpace> itemsSource, int row, int column) { if (column >= 3 && column <= 5) { return(true); } if (row >= 3 && row <= 5) { return(true); } return(false); }
public void CreateControls(IBoardCollection <T> itemsSource) // has to be at least this view model { if (itemsSource == null) { throw new BasicBlankException("The list is null. Therefore, can't create controls"); } if (itemsSource.Count() == 0) { throw new Exception("Must have at least one item from the list. Otherwise, it will show nothing. If there are exceptions, then can take out"); } PieceList = itemsSource; LoadGridColumnRows(); //maybe we need this now (?) int x; int y; int z = 0; var loopTo = itemsSource.GetTotalRows(); for (x = 1; x <= loopTo; x++) { var loopTo1 = itemsSource.GetTotalColumns(); for (y = 1; y <= loopTo1; y++) { if (z < itemsSource.Count()) { if (CanAddControl(itemsSource, x, y) == true) { var thisItem = itemsSource[x, y]; var thisControl = GetControl(thisItem, z); // needs to get in the habit of using 0 based //_thisGrid.Children.Add(thisControl); if (_hasHeaders == false) { GridHelper.AddControlToGrid(_thisGrid, thisControl, x - 1, y - 1); } else { GridHelper.AddControlToGrid(_thisGrid, thisControl, x, y); // because of the headers and footers. } z += 1; // 0 based } } } } }
public void UpdateControls(IBoardCollection <T> itemsSource) { _thisGrid.Children.Clear(); CreateControls(itemsSource); //try this. hopefully this simple. }
protected virtual bool CanAddControl(IBoardCollection <T> itemsSource, int row, int column) => true; //defaults to true.