private void Form1_Load(object sender, EventArgs e) { ConfluenceContext.SaveCredentials(AppSettingsHelper.GetValue("username"), AppSettingsHelper.GetValue("password")); ConfluenceSpaceTaskExecutor confSpaceService = new ConfluenceSpaceTaskExecutor(this); AllSpaces r = confSpaceService.Execute(); this.MaincomboBox.ValueMember = Strings.KEY; this.MaincomboBox.DisplayMember = Strings.NAME; r.results.Insert(0, new Result() { id = 0, name = "--SELECT--", key = string.Empty, type = string.Empty }); this.MaincomboBox.DataSource = r.results; AllSpaces r2 = confSpaceService.Execute(); this.TargetcomboBox.ValueMember = Strings.KEY; this.TargetcomboBox.DisplayMember = Strings.NAME; r2.results.Insert(0, new Result() { id = 0, name = "--SELECT--", key = string.Empty, type = string.Empty }); this.TargetcomboBox.DataSource = r2.results; }
/// <summary> /// Gets a list of all the spaces for a game board with the specified dimensions. /// </summary> /// <param name="rowCount">The number of rows.</param> /// <param name="columnCount">The number of columns.</param> /// <returns>The list of spaces.</returns> /// <remarks> /// This method creates lists for particular board sizes on demand, then /// reuses the lists as needed. /// </remarks> private static IEnumerable <ISpace> GetAllMoveSpaces(int rowCount, int columnCount) { var boardDimensions = Tuple.Create(rowCount, columnCount); return(AllSpaces.ContainsKey(boardDimensions) ? AllSpaces[boardDimensions] : AllSpaces[boardDimensions] = from row in Enumerable.Range(0, rowCount) from col in Enumerable.Range(0, columnCount) select new Space(row, col)); }