Skip to content

Commit

Permalink
Merge pull request #5 from Backiaraj/timepicker
Browse files Browse the repository at this point in the history
Update the project
  • Loading branch information
rajendranr-5483 authored Oct 13, 2023
2 parents dd91c12 + ddaf689 commit 42ccce9
Show file tree
Hide file tree
Showing 31 changed files with 388 additions and 351 deletions.
7 changes: 4 additions & 3 deletions App.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

<Router AppAssembly="@typeof(Program).Assembly">
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
14 changes: 14 additions & 0 deletions CreatingTimePickerSample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Blazor.Calendars" Version="23.1.38" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.38" />
</ItemGroup>

</Project>
16 changes: 8 additions & 8 deletions TimePickerProject.sln → CreatingTimePickerSample.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimePickerProject", "TimePickerProject.csproj", "{8C4E0C25-0ACB-4773-92EB-420836797DC6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreatingTimePickerSample", "CreatingTimePickerSample.csproj", "{23D87206-15A2-4D42-B2A7-8E74827D8C45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8C4E0C25-0ACB-4773-92EB-420836797DC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C4E0C25-0ACB-4773-92EB-420836797DC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C4E0C25-0ACB-4773-92EB-420836797DC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C4E0C25-0ACB-4773-92EB-420836797DC6}.Release|Any CPU.Build.0 = Release|Any CPU
{23D87206-15A2-4D42-B2A7-8E74827D8C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23D87206-15A2-4D42-B2A7-8E74827D8C45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23D87206-15A2-4D42-B2A7-8E74827D8C45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23D87206-15A2-4D42-B2A7-8E74827D8C45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {45098D05-6EBB-43F7-8DB7-B3DF87AA49EE}
SolutionGuid = {B47D10E7-E45E-4710-88A3-CAEAF02A87DA}
EndGlobalSection
EndGlobal
10 changes: 4 additions & 6 deletions Data/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using System;

namespace TimePickerProject.Data
namespace CreatingTimePickerSample.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public DateOnly Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string Summary { get; set; }
public string? Summary { get; set; }
}
}
}
19 changes: 7 additions & 12 deletions Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
using System;
using System.Linq;
using System.Threading.Tasks;

namespace TimePickerProject.Data
namespace CreatingTimePickerSample.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
{
var rng = new Random();
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
}
}
4 changes: 3 additions & 1 deletion Pages/Counter.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@page "/counter"

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p>Current count: @currentCount</p>
<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

Expand Down
42 changes: 42 additions & 0 deletions Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page
@model CreatingTimePickerSample.Pages.ErrorModel

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>

<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>

</html>
27 changes: 27 additions & 0 deletions Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace CreatingTimePickerSample.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
16 changes: 0 additions & 16 deletions Pages/Error.razor

This file was deleted.

9 changes: 5 additions & 4 deletions Pages/FetchData.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@page "/fetchdata"

@using TimePickerProject.Data
@using CreatingTimePickerSample.Data
@inject WeatherForecastService ForecastService

<PageTitle>Weather forecast</PageTitle>

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from a service.</p>
Expand Down Expand Up @@ -37,10 +38,10 @@ else
}

@code {
private WeatherForecast[] forecasts;
private WeatherForecast[]? forecasts;

protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
}
}
4 changes: 2 additions & 2 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Step="60"></SfTimePicker>
</div>

@code{
@code {
public DateTime TimeValue { get; set; } = new DateTime(2020, 03, 25, 05, 00, 00);

public DateTime MinTime { get; set; } = new DateTime(2020, 03, 25, 01, 00, 00);
Expand All @@ -17,7 +17,7 @@
}

<style>
#wrapper{
#wrapper {
max-width: 300px;
margin: 0px auto;
padding-top: 20px;
Expand Down
17 changes: 8 additions & 9 deletions Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
@page "/"
@namespace TimePickerProject.Pages
@using Microsoft.AspNetCore.Components.Web
@namespace CreatingTimePickerSample.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TimePickerProject</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="_content/Syncfusion.Blazor/styles/fabric.css" rel="stylesheet" />
<link href="CreatingTimePickerSample.styles.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
<component type="typeof(App)" render-mode="ServerPrerendered" />

<div id="blazor-error-ui">
<environment include="Staging,Production">
Expand Down
57 changes: 31 additions & 26 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace TimePickerProject
using CreatingTimePickerSample.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Syncfusion.Blazor;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSyncfusionBlazor();
builder.Services.AddSingleton<WeatherForecastService>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
22 changes: 16 additions & 6 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52638",
"sslPort": 44369
"applicationUrl": "http://localhost:30732",
"sslPort": 44306
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5271",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"TimePickerProject": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7275;http://localhost:5271",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
Loading

0 comments on commit 42ccce9

Please sign in to comment.