private void Window_Loaded(object sender, RoutedEventArgs e)
{
tables.ItemsSource = fillGrid();
}
public class Employee
{
public string EmployeePhone { get; set; }
public string EmployeeId { get; set; }
public string EmployeePib { get; set; }
public string EmployeeEmail { get; set; }
public string EmployeeMessage { get; set; }
public string EmployeeIp { get; set; }
public string EmployeeDate { get; set; }
}
public List<Employee> fillGrid() {
MysqlConn Conn = new MysqlConn();
MySqlDataReader reader = Conn.ConnectionDataBase(Con.RetSet("Host"), Con.RetSet("User"), Con.RetSet("DB"), Con.RetSet("Pass"), "SELECT * FROM s");
var _list = new List<Employee>();
while (reader.Read())
{
var tabl = new Employee()
{
EmployeeId = reader["id"].ToString(),
EmployeePib = reader["pib"].ToString(),
EmployeeEmail = reader["email"].ToString(),
EmployeePhone = reader["phone"].ToString(),
EmployeeMessage = reader["message"].ToString(),
EmployeeIp = reader["ip"].ToString(),
EmployeeDate = reader["send"].ToString()
};
_list.Add(tabl);
}
Conn.Cls();
return _list;
}
private int GetNumOfLines(string multiPageString, int wrapWidth, Font fnt)
{
var sfFmt = new StringFormat(StringFormatFlags.LineLimit);
using(var g = Graphics.FromImage(New Bitmap(1, 1)))
{
var iHeight = g.MeasureString(multiPageString, fnt, wrapWidth, sfFmt).Height;
var iOneLineHeight = g.MeasureString("Z", fnt, wrapWidth, sfFmt).Height;
return (int)(iHeight / iOneLineHeight)
}
}