123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
-
- 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();
- }
- }
- }
|