本文整理汇总了C#中Row.AddCell方法的典型用法代码示例。如果您正苦于以下问题:C# Row.AddCell方法的具体用法?C# Row.AddCell怎么用?C# Row.AddCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.AddCell方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSavedGame
private void AddSavedGame(FileInfo fileInfo)
{
// Create row
var row = new Row(fileInfo);
// Add single cell
row.AddCell(new Cell(
text: m_loadedWorldsByFilePaths[fileInfo.DirectoryName].SessionName,
userData: fileInfo,
icon: FileCellIconTexture,
iconOriginAlign: FileCellIconAlign
));
// Add creation time
row.AddCell(new Cell(
text: fileInfo.CreationTime.ToString()
));
Add(row);
}
示例2: Join
/// <summary>
/// Get a Join on TWO tables.
/// </summary>
/// <param name="tables"></param>
/// <param name="c"></param>
/// <param name="g"></param>
/// <param name="o"></param>
/// <returns></returns>
public Result Join(Joinable[] tables, Condition[] c, GroupBy g, OrderBy[] o)
{
string sql = "SELECT ";
List<string> fields = new List<string>();
foreach (Joinable j in tables)
{
sql += String.Join(",", j.GetFields(true)) + ", ";
foreach (string item in j.GetFields(true))
{
fields.Add(item);
}
}
sql = sql.Remove(sql.Length - 2);
sql += " FROM ";
foreach (Joinable j in tables)
{
sql += j.GetTableName() + ", ";
}
sql = sql.Remove(sql.Length - 2);
sql += " WHERE (";
sql += tables[0].GetJoinOn(tables[1]) + "=" + tables[1].GetJoinOn(tables[0]); //TODO: make this work for more tables...
sql += ") ";
if (c != null)
{
sql += " AND (";
foreach (Condition item in c)
{
sql += item.ToString() + " AND ";
}
sql = sql.Remove(sql.Length - 5);
sql += ") ";
}
if (g != null)
{
sql += g.ToString();
}
if (o != null)
{
sql += " ORDER BY ";
foreach (OrderBy item in o)
{
sql += item.ToShortString() + ", ";
}
sql = sql.Remove(sql.Length - 2);
}
this.cmd.CommandText = sql;
Result r = new Result(this.cmd.CommandText);
if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open();
SQLiteDataReader re = this.cmd.ExecuteReader();
while (re.Read())
{
Row row = new Row(re.StepCount);
foreach (string f in fields)
{
row.AddCell(f, re[f].ToString());
}
r.AddRow(row);
}
re.Close();
return r;
}
示例3: Select
public Result Select(string sql)
{
List<string> fields = new List<string>();
string fieldset = sql.Split(new string[] { "FROM" }, StringSplitOptions.None)[0].Replace("SELECT", "");
string[] sf = fieldset.Split(',');
foreach (string item in sf)
{
string adder = "";
if (item.ToLower().Contains(" as "))
{
adder = item.ToLower().Split(new string[] { " as " }, StringSplitOptions.None)[1].Trim();
}
else
{
adder = item.Trim();
}
if (adder.Contains('.'))
{
adder = adder.Split('.')[1];
}
fields.Add(adder);
}
this.cmd.CommandText = sql;
Result r = new Result(this.cmd.CommandText);
if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open();
SQLiteDataReader re = this.cmd.ExecuteReader();
while (re.Read())
{
Row row = new Row(re.StepCount);
foreach (string f in fields)
{
row.AddCell(f, re[f].ToString());
}
r.AddRow(row);
}
re.Close();
return r;
}
示例4: getRow
public Result getRow(Joinable j, string[] fields, Condition[] c = null, GroupBy g = null, OrderBy[] o = null, int limit = 0)
{
this.cmd.CommandText = "SELECT " + String.Join(",", fields) + " FROM " + j.GetTableName();
if (c != null)
{
this.cmd.CommandText += " WHERE (";
foreach (Condition item in c)
{
this.cmd.CommandText += item.ToString() + " AND ";
}
this.cmd.CommandText = this.cmd.CommandText.Remove(this.cmd.CommandText.Length - 5);
this.cmd.CommandText += ") ";
}
if (g != null)
{
this.cmd.CommandText += g.ToString();
}
if (o != null)
{
this.cmd.CommandText += " ORDER BY ";
foreach (OrderBy item in o)
{
this.cmd.CommandText += item.ToShortString() + ", ";
}
this.cmd.CommandText = this.cmd.CommandText.Remove(this.cmd.CommandText.Length - 2);
}
if (limit != 0)
{
this.cmd.CommandText += " LIMIT " + limit.ToString();
}
Result r = new Result(this.cmd.CommandText);
if (this.connection.State != System.Data.ConnectionState.Open) this.connection.Open();
SQLiteDataReader re = this.cmd.ExecuteReader();
while (re.Read())
{
Row row = new Row(re.StepCount);
foreach (string f in fields)
{
row.AddCell(f, re[f].ToString());
}
r.AddRow(row);
}
re.Close();
return r;
}
示例5: AddBackRow
// Adds back entry that allows user to go up a level
protected virtual void AddBackRow()
{
// Init new row
if(m_backRow == null)
{
m_backRow = new Row();
m_backRow.AddCell(new Cell("..", icon: MyGuiConstants.TEXTURE_BLUEPRINTS_ARROW, iconOriginAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
}
Add(m_backRow);
}
示例6: AddFolderRow
// Adds folder entry
protected virtual void AddFolderRow(DirectoryInfo dir)
{
// Create row
var row = new Row(dir);
// Add single cell
row.AddCell(new Cell(
text: dir.Name,
userData: dir,
icon: FolderCellIconTexture,
iconOriginAlign: FolderCellIconAlign
));
// add filler - needed for sorting otherwise crashes
row.AddCell(new Cell(String.Empty));
Add(row);
}
示例7: AddFileRow
// Adds file entry
protected virtual void AddFileRow(FileInfo file)
{
// Create row
var row = new Row(file);
// Add single cell
row.AddCell(new Cell(
text: file.Name,
userData: file,
icon: FileCellIconTexture,
iconOriginAlign: FileCellIconAlign
));
// Add creation time
row.AddCell(new Cell(
text: file.CreationTime.ToString()
));
Add(row);
}