commit
494b0bb1f0
|
@ -1,16 +0,0 @@
|
||||||
@namespace Oqtane.Modules.Counter
|
|
||||||
@inherits ModuleBase
|
|
||||||
Current count: @currentCount
|
|
||||||
<br />
|
|
||||||
<button type="button" class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private int currentCount = 0;
|
|
||||||
|
|
||||||
private void IncrementCount()
|
|
||||||
{
|
|
||||||
currentCount++;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
using Oqtane.Models;
|
|
||||||
|
|
||||||
namespace Oqtane.Modules.Counter
|
|
||||||
{
|
|
||||||
public class ModuleInfo : IModule
|
|
||||||
{
|
|
||||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
|
||||||
{
|
|
||||||
Name = "Counter",
|
|
||||||
Description = "Increments a counter",
|
|
||||||
Version = "1.0.0"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
@using Oqtane.Modules.Weather.Services
|
|
||||||
@namespace Oqtane.Modules.Weather
|
|
||||||
@inherits ModuleBase
|
|
||||||
|
|
||||||
@if (forecasts == null)
|
|
||||||
{
|
|
||||||
<p><em>Loading...</em></p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Date</th>
|
|
||||||
<th>Temp. (C)</th>
|
|
||||||
<th>Temp. (F)</th>
|
|
||||||
<th>Summary</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var forecast in forecasts)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>@forecast.Date.ToShortDateString()</td>
|
|
||||||
<td>@forecast.TemperatureC</td>
|
|
||||||
<td>@forecast.TemperatureF</td>
|
|
||||||
<td>@forecast.Summary</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private WeatherForecast[] forecasts;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
WeatherForecastService forecastservice = new WeatherForecastService();
|
|
||||||
forecasts = await forecastservice.GetForecastAsync(DateTime.UtcNow);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Oqtane.Modules.Weather
|
|
||||||
{
|
|
||||||
public class WeatherForecast
|
|
||||||
{
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public int TemperatureC { get; set; }
|
|
||||||
public int TemperatureF { get; set; }
|
|
||||||
public string Summary { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
using Oqtane.Models;
|
|
||||||
|
|
||||||
namespace Oqtane.Modules.Weather
|
|
||||||
{
|
|
||||||
public class ModuleInfo : IModule
|
|
||||||
{
|
|
||||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
|
||||||
{
|
|
||||||
Name = "Weather",
|
|
||||||
Description = "Displays random weather using a service",
|
|
||||||
Version = "1.0.0"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Oqtane.Modules.Weather.Services
|
|
||||||
{
|
|
||||||
public interface IWeatherForecastService
|
|
||||||
{
|
|
||||||
Task<WeatherForecast[]> GetForecastAsync(DateTime startDate);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
using Oqtane.Modules;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Oqtane.Modules.Weather.Services
|
|
||||||
{
|
|
||||||
public class WeatherForecastService : IWeatherForecastService
|
|
||||||
{
|
|
||||||
private static string[] Summaries = new[]
|
|
||||||
{
|
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
|
||||||
};
|
|
||||||
|
|
||||||
public Task<WeatherForecast[]> GetForecastAsync(DateTime 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)]
|
|
||||||
}).ToArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user