using System; using System.Collections.Generic; using System.Linq; using System.Text.Encodings.Web; using System.Threading.Tasks; using FastReport.Web.Toolbar; namespace FastReport.Web.Blazor.Components { public partial class Toolbar { float currentZoom; bool isFirstPage; bool isLastPage; bool isSinglePage; static readonly float[] zoomList = new[] { 300f, 200f, 150f, 100f, 90f, 75f, 50f, 25f }; private ToolbarLocalization Localization; private int CurrentPage { get => WebReport.CurrentPageIndex + 1; set => WebReport.CurrentPageIndex = value + 1; } private int InputValue { get => WebReport.TotalPages == 0 ? 0 : CurrentPage; set { if (value != CurrentPage) { // Check bounds if (value > 0 && value < WebReport.TotalPages + 1) { WebReport.GotoPage(value - 1); PageChanged.Invoke(); } } } } public Toolbar() { } private void Reload() { WebReport.OnUpdate(true); } private void Zoom(float value) { WebReport.Zoom = value / 100; WebReport.OnUpdate(); } private enum PrintTypes { HTML, PDF } private void InvokeInputAction(string inputValue, ElementChangeAction action) { action?.OnChangeAction?.Invoke(WebReport, inputValue); } private void InvokeAction(ElementClickAction toolbarAction) { toolbarAction?.OnClickAction?.Invoke(WebReport); WebReport.OnUpdate(true); } private void GotoFirst() { WebReport.FirstPage(); PageChanged.Invoke(); } private void GotoPrevious() { if (CurrentPage - 1 > 0) { WebReport.PrevPage(); PageChanged.Invoke(); } } private void GotoNext() { if (CurrentPage < WebReport.TotalPages) { WebReport.NextPage(); PageChanged.Invoke(); } } private void GotoLast() { WebReport.LastPage(); PageChanged.Invoke(); } } }