private static void ListCustomer() { Console.WriteLine("List Cusomers"); using (var db = new RentCDb()) { var query = (from c in db.Customers select c).ToArray(); int nrRows = query.Count(); string[] headers = { "CustomerID", "Name", "Birt Date" }; string[][] rows = new string[query.Length][]; int i = 0; foreach (var item in query) { string[] row = new string[3]; row[0] = item.CostumerID.ToString(); row[1] = item.Name.ToString(); row[2] = item.BirthDate.Date.ToString(); rows[i] = row; i++; } DrawTable.DrawMyTable(headers, query.Length, rows); } Console.ReadKey(); SelectOption(); }
public override void OnStartPage(PdfWriter writer, Document document) { base.OnStartPage(writer, document); PdfPTable header = new PdfPTable(new float[] { 2, 8, 2 }); header.WidthPercentage = 100; PdfPTable detalle = new PdfPTable(2); detalle.AddCell(DrawTable.DrawCell("Modulo:", 7, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell("Delegación:", 7, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Titulo, 8, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Bold)); detalle.AddCell(DrawTable.DrawCell(SubTitulo, 8, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Bold)); LogoIzquierda.ScaleToFit(90f, 40f); LogoDerecha.ScaleToFit(90f, 40f); PdfPCell cellImg = new PdfPCell(LogoIzquierda); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); PdfPCell tc = new PdfPCell(detalle); tc.Border = 0; tc.PaddingLeft = 10; tc.PaddingRight = 10; header.AddCell(tc); cellImg = new PdfPCell(LogoDerecha); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); document.Add(header); //document.Add(DrawTable.LineBottom(1, BaseColor.BLACK)); document.Add(new Paragraph("\n")); }
/// <summary> /// Производим смещение координат вершин линии /// </summary> private void MoveFigure() { if (_moveToPoint == default(Point) || _moveFromPoint == default(Point) || _currentPolyline == null) { return; } var deltaX = _moveToPoint.X - _moveFromPoint.X; var deltaY = _moveToPoint.Y - _moveFromPoint.Y; List <Point> tmpListPoint = new List <Point>(); foreach (Point pt in _currentPolyline.Points) { tmpListPoint.Add(new Point(pt.X + deltaX, pt.Y + deltaY)); } _currentPolyline.Points.Clear(); foreach (Point pt in tmpListPoint) { _currentPolyline.Points.Add(new Point(pt.X, pt.Y)); } tmpListPoint = null; _moveToPoint = default(Point); _moveFromPoint = default(Point); ClearPolylineBindings(_currentPolyline); _currentPolyline = null; ClearMarkers(); _viewModel.DrawMode = DrawMode.EditFigure; DrawTable.InvalidateVisual(); }
private void SetupColumnsPropertiesFor16PlayersMustSetupRound1Column() { // Create new DataTable. DrawTable draw = new DrawTable(16); Assert.Equal("Round 1", draw.Columns[0].Name); Assert.Equal("", draw.Columns[1].Name); Assert.Equal("", draw.Columns[2].Name); Assert.Equal("Quarter - Finals", draw.Columns[3].Name); Assert.Equal("", draw.Columns[4].Name); Assert.Equal("", draw.Columns[5].Name); Assert.Equal("Semi - Finals", draw.Columns[6].Name); Assert.Equal("", draw.Columns[7].Name); Assert.Equal("", draw.Columns[8].Name); Assert.Equal("Final", draw.Columns[9].Name); Assert.Equal(DrawColumnType.Match, draw.Columns[0].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[1].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[2].Type); Assert.Equal(DrawColumnType.Match, draw.Columns[3].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[4].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[5].Type); Assert.Equal(DrawColumnType.Match, draw.Columns[6].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[7].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[8].Type); Assert.Equal(DrawColumnType.Match, draw.Columns[9].Type); }
private static void ListAvailableCars() { localhost.WebService1 proxy = new localhost.WebService1(); var jsonAvailableCars = proxy.AvalialbleCars(); Car[] availableCars = JsonConvert.DeserializeObject <List <Car> >(jsonAvailableCars).ToArray(); using (var db = new RentCDb()) { int nrRows = availableCars.Length; string[] headers = { "CarID", "Plate", "Manufacturer", "Model", "PricePerDay", "Location" }; string[][] rows = new string[availableCars.Length][]; int i = 0; foreach (var item in availableCars) { string[] row = new string[5]; row[0] = item.CarID.ToString(); row[1] = item.Plate; row[2] = item.Manufacturer; row[3] = item.Model; row[3] = item.PricePerDay.ToString(); row[3] = db.Locations.Find(item.LocationID).Name; var location = db.Locations.Find(item.LocationID).Name; row[4] = location; rows[i] = row; i++; } DrawTable.DrawMyTable(headers, availableCars.Length, rows); SelectOption(); } }
private static void SetBody(DataTable datos, string descEvento, string jornada, string fecha) { PdfPTable body = new PdfPTable(new float[] { (float)1.5, 6, 6, 5, 5 }); body.WidthPercentage = 100; body.AddCell(DrawTable.DrawCell(descEvento, 14, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(string.Format("{0} , {1:dd MMM yyyy}", jornada, fecha), 12, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Listado de Salidas y Cuartetos", 10, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCellHeader("Salida", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Jugador 1 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Jugador 2 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Jugador 3 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Jugador 4 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold)); body.HeaderRows = 5; foreach (DataRow rows in datos.Rows) { body.AddCell(DrawTable.DrawCell(rows["Grupo"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCell(rows["1"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCell(rows["2"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCell(rows["3"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCell(rows["4"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal)); } documentPdf.Add(body); }
private static void ListRents() { Console.WriteLine("List Rentals"); using (var db = new RentCDb()) { var query = (from r in db.Reservations select r).ToArray(); int nrRows = query.Count(); string[] headers = { "CarPlate", "ClientID", "Start Date", "End Date", "Location" }; string[][] rows = new string[query.Length][]; int i = 0; foreach (var item in query) { string[] row = new string[5]; row[0] = item.Car.Plate; row[1] = item.CostumerID.ToString(); row[2] = item.StartDate.Date.ToString(); row[3] = item.EndDate.ToShortDateString(); var location = db.Locations.Find(item.LocationID).Name; row[4] = location; rows[i] = row; i++; } DrawTable.DrawMyTable(headers, query.Length, rows); } Console.ReadKey(); SelectOption(); }
[Command("queryd", RunMode = RunMode.Async)] // better name xD public async Task SqlD([Remainder] string commandSql) { var userId = Context.Message.Author.Id; if (AllowedToRun(BotPermissionType.EnableType2Commands)) { return; } if (ForbiddenQuery(commandSql, Context.Message.Author.Id)) { return; } if (ActiveSQLCommands.ContainsKey(userId) && ActiveSQLCommands[userId].AddSeconds(15) > DateTime.Now) { await Context.Channel.SendMessageAsync("Are you in such a hurry, that you cant wait out the last query you send out?", false); return; } try { if (ActiveSQLCommands.ContainsKey(userId)) { ActiveSQLCommands[userId] = DateTime.Now; } else { ActiveSQLCommands.Add(userId, DateTime.Now); } var queryResult = await SQLHelper.GetQueryResults(Context, commandSql, true, 50); string additionalString = $"Total row(s) affected: {queryResult.TotalResults.ToString("N0")} QueryTime: {queryResult.Time.ToString("N0")}ms"; var drawTable = new DrawTable(queryResult.Header, queryResult.Data, additionalString); var stream = await drawTable.GetImage(); if (stream == null) { return;// todo some message } await Context.Channel.SendFileAsync(stream, "graph.png", "", false, null, null, false, null, new Discord.MessageReference(Context.Message.Id)); stream.Dispose(); // release the user again as the query finished ActiveSQLCommands[userId] = DateTime.MinValue; } catch (Exception ex) { await Context.Channel.SendMessageAsync("Is this all you got <:kekw:768912035928735775> " + ex.ToString(), false); } }
private static void SetHead(string categoria, string descEvento, string lugarEvento, int eventoid) { float legalMarginWidth = ItextUtils.CentimetersToPoints(33.02F); float legalMarginHeight = ItextUtils.CentimetersToPoints(21.59F); float marginLeft = ItextUtils.CentimetersToPoints(1); float marginRight = ItextUtils.CentimetersToPoints(1); float marginTop = ItextUtils.CentimetersToPoints(1); float marginBottom = ItextUtils.CentimetersToPoints(4); documentPdf = new Document(); documentPdf.SetPageSize(PageSize.LETTER); documentPdf.SetMargins(marginLeft, marginRight, marginTop, marginBottom); PdfWriter writer = PdfWriter.GetInstance(documentPdf, new FileStream(path, FileMode.Create)); HeaderGolf header = new HeaderGolf(); header.Titulo = lugarEvento; header.TituloIdioma = "Casa de campo COCHABAMBA"; header.SubTitulo = descEvento; header.Deporte = "golf"; header.HasLeyenda = true; header.Jornada = "todas"; header.Categoria = categoria; header.User = "";// user.Username; header.NombreReporte = "Resultados Finales."; header.LogoDerecha = Image.GetInstance(string.Format(@"{0}\Golf\{1}", pathImage, "golf.png")); header.LogoIzquierda = Image.GetInstance(string.Format(@"{0}\Golf\{1}", pathImage, "Federacion.png")); header.LogoAbajoDerecha = Image.GetInstance(string.Format(@"{0}\Hammer\{1}", pathImage, "marcaDoble.png")); header.LogoAbajoIzquierda = Image.GetInstance(string.Format(@"{0}\Hammer\{1}", pathImage, "hammerLogoH.png")); header.Fecha = GolfJornada.GetFechasJornadas(eventoid); PdfPTable leyen = new PdfPTable(new float[] { 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1 }); leyen.AddCell(DrawTable.DrawCell("Leyenda", 6, CellBorder.NONE, CellAlignment.Left, 14, CellFontStyle.Bold)); leyen.AddCell(DrawTable.DrawCellHeader("Hoyo en Uno", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.YELLOW)); leyen.AddCell(DrawTable.DrawCellHeader("Albatros", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(192, 119, 160))); leyen.AddCell(DrawTable.DrawCellHeader("Eagle", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(248, 177, 17))); leyen.AddCell(DrawTable.DrawCellHeader("Birdie", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(35, 190, 82))); leyen.AddCell(DrawTable.DrawCellHeader("PAR", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader("Bogey", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(92, 119, 229))); leyen.AddCell(DrawTable.DrawCellHeader("Doble Bogey o más", 5, CellBorder.UNDEFINED, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Buttom, CellFontStyle.Normal, new BaseColor(237, 62, 48))); header.leyendas = leyen; writer.PageEvent = header; documentPdf.Open(); }
private void CreateDataTable() { // Create new DataTable. DrawTable draw = new DrawTable(8); Assert.Equal(8, draw.TotalPlayers); Assert.Equal(7, draw.Columns.Length); Assert.Equal(14, draw.Rows.Length); Assert.Equal(3, draw.TotalRounds); }
private void SetupColumnsPropertiesFor16PlayersMustNotCrash() { // Create new DataTable. DrawTable draw = new DrawTable(16); Assert.Equal(16, draw.TotalPlayers); Assert.Equal(10, draw.Columns.Length); Assert.Equal(30, draw.Rows.Length); Assert.Equal(4, draw.TotalRounds); }
public async Task GetLockInfo() { ulong guildId = Program.BaseGuild; #if DEBUG guildId = 774286694794919986; #endif var guild = Program.Client.GetGuild(guildId); var channels = guild.Channels; var sortedDict = from entry in Program.ChannelPositions orderby entry.Value ascending select entry; List <string> header = new List <string>() { "Order", "Channel Name", "Id" }; List <List <string> > data = new List <List <string> >(); foreach (var item in sortedDict) { var channel = channels.SingleOrDefault(i => i.Id == item.Key); if (channel == null) { continue; } var currentRecord = new List <string>(); currentRecord.Add(item.Value.ToString()); currentRecord.Add(Regex.Replace(channel.Name, @"[^\u0000-\u007F]+", string.Empty)); currentRecord.Add(item.Key.ToString()); data.Add(currentRecord); } var drawTable = new DrawTable(header, data, ""); var stream = await drawTable.GetImage(); if (stream == null) { return;// todo some message } await Context.Channel.SendFileAsync(stream, "graph.png", "", false, null, null, false, null, new Discord.MessageReference(Context.Message.Id)); stream.Dispose(); }
private static void SetBody(DataTable dtresultado, string descEvento) { int nroColumnas = dtresultado.Columns.Count; float [] x = new float[nroColumnas]; x[0] = 2; x[1] = 6; x[2] = 6; for (int i = 3; i < nroColumnas; i++) { x[i] = 2; } PdfPTable body = new PdfPTable(x); body.WidthPercentage = 100; body.AddCell(DrawTable.DrawCell(descEvento, 14, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Resultado Finales", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); foreach (DataColumn dc in dtresultado.Columns) { body.AddCell(DrawTable.DrawCellHeader(dc.ColumnName, 8, CellBorder.BOTTOM, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); foreach (DataRow rows in dtresultado.Rows) { foreach (DataColumn dc in dtresultado.Columns) { if (dc.ColumnName == "Score") { int score = Convert.ToInt32(rows[dc.ColumnName]); if (score > 0) { body.AddCell(DrawTable.DrawCell(string.Format("+{0}", score), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal)); } else { body.AddCell(DrawTable.DrawCell(rows[dc.ColumnName].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal)); } } else { body.AddCell(DrawTable.DrawCell(rows[dc.ColumnName].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal)); } } } body.HeaderRows = 5; documentPdf.Add(body); }
/// <summary> /// Сброс всех переменных, используемых для выделения линии /// </summary> private void ResetAllSelected() { ClearMarkers(); ClearPolylineBindings(_currentPolyline); _currentPolyline = null; _currentPoint = default(Point); _pointIndex = null; _viewModel.DrawMode = DrawMode.None; _marker = null; _viewModel.AddNewLineIsChecked = false; _viewModel.EditLineIsChecked = false; DrawTable.InvalidateVisual(); }
public override void OnStartPage(PdfWriter writer, Document document) { if (DrawHeader) { base.OnStartPage(writer, document); PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 }); header.WidthPercentage = 100; PdfPTable detalle = new PdfPTable(2); detalle.AddCell(DrawTable.DrawCellHeader("Nombre:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Nombre, 10, CellBorder.NONE, CellAlignment.Middle, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCellHeader("Unidad:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Unidad, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCellHeader("Fecha:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Fecha, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCellHeader("Semana:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Semana, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCellHeader("Total Horas:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Totalhoras, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal)); PdfPCell cellImg; LogoIzquierda.ScaleToFit(60f, 60f); cellImg = new PdfPCell(LogoIzquierda); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); PdfPCell tc = new PdfPCell(detalle); tc.Border = 0; header.AddCell(tc); LogoDerecha.ScaleToFit(60f, 60f); cellImg = new PdfPCell(LogoDerecha); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); PdfPTable tp = new PdfPTable(new float[] { 60, 40 }); tp.AddCell(DrawTable.DrawCellHeader(Titulo, 14, CellBorder.NONE, CellAlignment.Right, CellAlignment.Middle, CellFontStyle.Bold)); tp.AddCell(DrawTable.DrawCellHeader(Formulario, 5, CellBorder.NONE, CellAlignment.Left, CellAlignment.Bottom, CellFontStyle.Bold)); document.Add(tp); document.Add(header); document.Add(DrawTable.Line()); document.Add(new Paragraph("\n")); } }
public ActionResult Get() { DrawTable draw = new DrawTable((int)DrawMap.SixtyFour); Tournament tournament = new Tournament("Torneio de Mafra", DateTime.Today); //string webRootPath = _hostingEnvironment.WebRootPath; //string filePath = webRootPath + "\\data\\PlayersAndTeams.txt"; //tournament.LoadPlayersFromTxt(filePath); //tournament.MakeDraw(DrawMap.Sixteen, 4, 3); //draw.Matches = tournament.Matches; return(Json(draw)); }
/// <summary> /// Удаление ломаной линии /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelLine_Click(object sender, RoutedEventArgs e) { if (_viewModel.DrawMode != DrawMode.EditFigure) { return; } if (_currentPolyline == null) { return; } ClearMarkers(); DrawTable.Children.Remove(_currentPolyline); _currentPolyline = null; _pointIndex = null; _marker = null; DrawTable.InvalidateVisual(); }
/// <summary> /// Обработчик кнопки удаления вершины ломаной линии /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelVertex_Click(object sender, RoutedEventArgs e) { //Удаление вершин ломаной линии if (_viewModel.DrawMode != DrawMode.EditFigure) { return; } if (_pointIndex == null || _marker == null || _currentPolyline == null) { return; } _currentPolyline.Points.RemoveAt(_pointIndex.Value); _marker.Height = 0; _marker.Width = 0; _pointIndex = null; _marker = null; DrawTable.InvalidateVisual(); }
private void SetupLayoutMustSetRound3MatchsForATotalOf8Players() { // Create new DataTable. DrawTable draw = new DrawTable(8); Assert.Equal(DrawCellType.None, draw.Rows[0].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[1].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[2].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[3].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[4].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[5].Cells[6].Style); Assert.Equal(DrawCellType.FirstPlayer, draw.Rows[6].Cells[6].Style); Assert.Equal(DrawCellType.SecondPlayer, draw.Rows[7].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[8].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[9].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[10].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[11].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[12].Cells[6].Style); Assert.Equal(DrawCellType.None, draw.Rows[13].Cells[6].Style); }
private void DrawTable_MouseMove(object sender, MouseEventArgs e) { //Отрисовка перемещения вершины ломаной линии при добавлении и при редактировании вершин if ((_viewModel.DrawMode == DrawMode.AddNewFigure || _viewModel.DrawMode == DrawMode.MoveVertex) && _currentPoint != null && _currentPolyline != null && _currentPolyline.Points.Count > 1) { _currentPolyline.Points.RemoveAt(_pointIndex.Value); _currentPoint.X = e.GetPosition(DrawTable).X; _currentPoint.Y = e.GetPosition(DrawTable).Y; _currentPolyline.Points.Insert(_pointIndex.Value, _currentPoint); if (_marker != null) { Canvas.SetLeft(_marker, _currentPoint.X - 5); Canvas.SetTop(_marker, _currentPoint.Y - 5); } DrawTable.InvalidateVisual(); } }
private void SetupColumnsProperties() { // Create new DataTable. DrawTable draw = new DrawTable(8); Assert.Equal("Quarter - Finals", draw.Columns[0].Name); Assert.Equal("", draw.Columns[1].Name); Assert.Equal("", draw.Columns[2].Name); Assert.Equal("Semi - Finals", draw.Columns[3].Name); Assert.Equal("", draw.Columns[4].Name); Assert.Equal("", draw.Columns[5].Name); Assert.Equal("Final", draw.Columns[6].Name); Assert.Equal(DrawColumnType.Match, draw.Columns[0].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[1].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[2].Type); Assert.Equal(DrawColumnType.Match, draw.Columns[3].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[4].Type); Assert.Equal(DrawColumnType.Connector, draw.Columns[5].Type); Assert.Equal(DrawColumnType.Match, draw.Columns[6].Type); }
private void SetupLayoutMustSetConnectionsBetweenRound2AndRound3ForATotalOf8Players() { // Create new DataTable. DrawTable draw = new DrawTable(8); Assert.Equal(DrawCellType.None, draw.Rows[0].Cells[4].Style); Assert.Equal(DrawCellType.None, draw.Rows[1].Cells[4].Style); Assert.Equal(DrawCellType.None, draw.Rows[2].Cells[4].Style); Assert.Equal(DrawCellType.OddCornerConnector, draw.Rows[3].Cells[4].Style); Assert.Equal(DrawCellType.VerticalConnector, draw.Rows[4].Cells[4].Style); Assert.Equal(DrawCellType.VerticalConnector, draw.Rows[5].Cells[4].Style); Assert.Equal(DrawCellType.VerticalConnector, draw.Rows[6].Cells[4].Style); Assert.Equal(DrawCellType.HorizontalConnector, draw.Rows[6].Cells[5].Style); Assert.Equal(DrawCellType.VerticalConnector, draw.Rows[7].Cells[4].Style); Assert.Equal(DrawCellType.VerticalConnector, draw.Rows[8].Cells[4].Style); Assert.Equal(DrawCellType.VerticalConnector, draw.Rows[9].Cells[4].Style); Assert.Equal(DrawCellType.EvenCornerConnector, draw.Rows[10].Cells[4].Style); Assert.Equal(DrawCellType.None, draw.Rows[11].Cells[4].Style); Assert.Equal(DrawCellType.None, draw.Rows[12].Cells[4].Style); Assert.Equal(DrawCellType.None, draw.Rows[13].Cells[4].Style); }
private void BtnLoadFromFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog myDialog = new OpenFileDialog(); myDialog.Filter = "Векторные рисунки(*.XAML)|*.XAML" + "|Все файлы (*.*)|*.* "; myDialog.CheckFileExists = true; myDialog.Multiselect = true; if (myDialog.ShowDialog() == true) { DrawTable.Children.Clear(); _viewModel.CurrentFileName = myDialog.FileName; using (FileStream fs = File.Open(_viewModel.CurrentFileName, FileMode.Open, FileAccess.Read)) { Canvas FromFile = XamlReader.Load(fs) as Canvas; foreach (Polyline pl in FromFile.Children) { if (pl.Points.Count != 0) { if (pl.Stroke != null) { _viewModel.CurrentPickColor = ((SolidColorBrush)(pl.Stroke)).Color; } _viewModel.CurrentThikness = DoubleToThikness(pl.StrokeThickness); AddNewLine(); foreach (Point pt in pl.Points) { _currentPolyline.Points.Add(pt); } } } } DrawTable.InvalidateVisual(); ResetAllSelected(); } }
/// <summary> /// ドロー設定ビューモデルの新しいインスタンスを生成します。 /// </summary> /// <param name="tournamentId">大会 ID。</param> /// <param name="tournamentName">大会名。</param> /// <param name="tennisEventId">種目 ID。</param> /// <param name="tennisEvent">種目。</param> /// <param name="drawTable">ドロー表。</param> public SettingsViewModel( string tournamentId, string tournamentName, string tennisEventId, string tennisEvent, DrawTable drawTable) { this.TournamentId = tournamentId; this.TournamentName = tournamentName; this.TennisEventId = tennisEventId; this.TennisEvent = tennisEvent; this.DrawTable = drawTable; this.TournamentFormat = drawTable.TournamentFormat; this.ShowQualifyingDrawSettings = this.TournamentFormat == TournamentFormat.WithQualifying; this.MainNumberOfDraws = this.CreateNumberOfDraws(ParticipationClassification.Main); this.MainNumberOfEntries = $"{this.GetNumberOfEntries(ParticipationClassification.Main)}"; this.MainTournamentGrades = this.CreateTournamentGrades(ParticipationClassification.Main); this.QualifyingNumberOfDraws = this.CreateNumberOfDraws(ParticipationClassification.Qualifying); this.QualifyingNumberOfEntries = $"{this.GetNumberOfEntries(ParticipationClassification.Qualifying)}"; this.QualifyingTournamentGrades = this.CreateTournamentGrades(ParticipationClassification.Qualifying); this.EnteredQualifyingNumberOfBlocks = this.GetInitialQualifyingNumberOfBlocks(); }
public override void OnStartPage(PdfWriter writer, Document document) { base.OnStartPage(writer, document); PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 }); header.WidthPercentage = 100; PdfPTable detalle = new PdfPTable(2); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Titulo), 10, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Bold)); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Deporte), 12, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Bold)); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(TituloIdioma), 7, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell("Categoria :", 6, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(SubTitulo, 7, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Categoria), 8, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Bold)); detalle.AddCell(DrawTable.DrawCell("Jornada :", 6, CellBorder.NONE, CellAlignment.Right, 2, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Jornada), 8, CellBorder.NONE, CellAlignment.Right, 2, CellFontStyle.Bold)); detalle.AddCell(DrawTable.DrawCell(Fecha, 6, CellBorder.NONE, CellAlignment.Left, 2, CellFontStyle.Normal)); LogoIzquierda.ScaleToFit(60f, 60f); LogoDerecha.ScaleToFit(60f, 60f); PdfPCell cellImg = new PdfPCell(LogoIzquierda); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); PdfPCell tc = new PdfPCell(detalle); tc.Border = 0; tc.PaddingLeft = 10; tc.PaddingRight = 10; header.AddCell(tc); cellImg = new PdfPCell(LogoDerecha); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); document.Add(header); document.Add(DrawTable.LineBottom(1, BaseColor.BLACK)); document.Add(new Paragraph("\n")); }
public static void SetBody(DataTable dtInscritos) { int nroColumnas = dtInscritos.Columns.Count; float[] widthCell = { 1.5f, 3.2f, 3.5f, 3.5f, 5f, 3.2f, 3f }; PdfPTable body = new PdfPTable(nroColumnas); body.SetWidths(widthCell); //body.WidthPercentage = 100; body.AddCell(DrawTable.DrawCell("LISTA DE INSCRITOS", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); //foreach (DataColumn dc in dtInscritos.Columns) //{ // body.AddCell(DrawTable.DrawCellHeader(dc.ColumnName, 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); //} body.AddCell(DrawTable.DrawCellHeader("Nro.", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Doc. Identidad", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Ap. Paterno", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Ap. Materno", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Nombres", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Fecha Nac.", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Género", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold)); foreach (DataRow rows in dtInscritos.Rows) { foreach (DataColumn dc in dtInscritos.Columns) { body.AddCell(DrawTable.DrawCellHeader(rows[dc.ColumnName].ToString(), 7, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Normal)); } } documentPdf.Add(body); }
public override void OnStartPage(PdfWriter writer, Document document) { if (DrawHeader) { base.OnStartPage(writer, document); PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 }); header.WidthPercentage = 100; PdfPTable detalle = new PdfPTable(2); detalle.AddCell(DrawTable.DrawCellHeader("Nombre:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(Nombre, 10, CellBorder.NONE, CellAlignment.Middle, CellFontStyle.Normal)); PdfPTable tp = new PdfPTable(new float[] { 70 }); tp.AddCell(DrawTable.DrawCellHeader(Titulo, 14, CellBorder.NONE, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Bold)); tp.AddCell(DrawTable.DrawCellHeader(Subtitulo1, 7, CellBorder.NONE, CellAlignment.Center, CellAlignment.Top, CellFontStyle.Normal)); tp.AddCell(DrawTable.DrawCellHeader(Subtitulo2, 9, CellBorder.NONE, CellAlignment.Center, CellAlignment.Top, CellFontStyle.Bold)); PdfPCell cellImg; LogoIzquierda.ScaleToFit(60f, 60f); cellImg = new PdfPCell(LogoIzquierda); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); PdfPCell tc = new PdfPCell(tp); tc.Border = 0; header.AddCell(tc); LogoDerecha.ScaleToFit(60f, 60f); cellImg = new PdfPCell(LogoDerecha); cellImg.Border = PdfPCell.NO_BORDER; header.AddCell(cellImg); document.Add(header); document.Add(DrawTable.Line()); document.Add(new Paragraph("\n")); } }
public override void OnEndPage(PdfWriter writer, Document document) { base.OnEndPage(writer, document); int pageN = writer.PageNumber; string text = string.Format("Pág. {0} / ", writer.PageNumber); float len = bf.GetWidthPoint(text, 8); Rectangle pageSize = document.PageSize; float altoPiepagina = document.RightMargin + 40; PdfPTable footer_linea = new PdfPTable(1); if (HasLeyenda) { footer_linea.AddCell(leyendas); altoPiepagina = altoPiepagina + 25; } footer_linea.AddCell(DrawTable.DrawCell("\n", 6, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal)); footer_linea.TotalWidth = pageSize.Width - LimitBorderTop; footer_linea.WidthPercentage = 100; footer_linea.DefaultCell.BorderWidthLeft = 0; footer_linea.DefaultCell.BorderWidthRight = 0; footer_linea.DefaultCell.BorderWidthTop = 1; footer_linea.DefaultCell.BorderWidthBottom = 0; footer_linea.DefaultCell.BorderColor = BaseColor.BLACK; footer_linea.AddCell(""); PdfPTable footer_Logos = new PdfPTable(2); LogoAbajoIzquierda.ScaleToFit(90f, 40f); LogoAbajoDerecha.ScaleToFit(90f, 40f); PdfPCell cellImg = new PdfPCell(LogoAbajoIzquierda); cellImg.Border = PdfPCell.NO_BORDER; cellImg.PaddingTop = 10; footer_Logos.AddCell(cellImg); cellImg = new PdfPCell(LogoAbajoDerecha); cellImg.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; cellImg.Border = PdfPCell.NO_BORDER; cellImg.PaddingTop = 10; footer_Logos.AddCell(cellImg); footer_linea.AddCell(footer_Logos); footer_linea.WriteSelectedRows(0, -1, pageSize.GetLeft(document.LeftMargin), pageSize.GetBottom(altoPiepagina), cb); cb.SetRGBColorFill(100, 100, 100); cb.BeginText(); cb.SetFontAndSize(bf, 8); cb.SetTextMatrix(pageSize.GetRight(LimitBorderBottom), pageSize.GetBottom(LimitMargin + 30)); cb.ShowText(text); cb.EndText(); cb.AddTemplate(template, pageSize.GetRight(LimitBorderBottom) + len, pageSize.GetBottom(LimitMargin + 30)); cb.BeginText(); cb.SetFontAndSize(bf, 8); cb.SetTextMatrix(pageSize.GetLeft(document.LeftMargin), pageSize.GetBottom(LimitMargin + 30)); cb.ShowText("Hammer v1.1"); cb.EndText(); cb.BeginText(); cb.SetFontAndSize(bf, 6); string datosImpresion; datosImpresion = string.Format("{0} - {1:dddd,d MMMM yyyy HH:mm:ss}", User, DateTime.Now); cb.SetTextMatrix(((pageSize.Width / 2) - datosImpresion.Length), pageSize.GetBottom(LimitMargin + 30)); cb.ShowText(datosImpresion); cb.EndText(); }
public void RegisterHandlerDrawTable(DrawTable draw) { this.draw = draw; }
// public DataGridDrawing(DrawTable table) { HighlightCurrentCell = true; }