Settings improvement

This commit is contained in:
Friend2868
2023-03-22 11:21:14 +01:00
parent 6f96a7ecd9
commit ccedff576b
7 changed files with 208 additions and 202 deletions
@@ -23,18 +23,18 @@
Admin Admin
</BarLink> </BarLink>
</BarItem> </BarItem>
<BarItem>
<BarLink To="/addplug" TextColor="TextColor.White">
<BarIcon Style="color:white" IconName="IconName.Plug" />
Add Plug
</BarLink>
</BarItem>
<BarItem> <BarItem>
<BarLink To="/settings" TextColor="TextColor.White"> <BarLink To="/settings" TextColor="TextColor.White">
<BarIcon Style="color:white" IconName="IconName.Wrench" /> <BarIcon Style="color:white" IconName="IconName.Wrench" />
Settings Settings
</BarLink> </BarLink>
</BarItem> </BarItem>
<BarItem>
<BarLink To="/addplug" TextColor="TextColor.White">
<BarIcon Style="color:white" IconName="IconName.Plug" />
Add Plug
</BarLink>
</BarItem>
</BarStart> </BarStart>
<BarEnd> <BarEnd>
<BarItem> <BarItem>
@@ -9,7 +9,7 @@
@inject IDeviceManagmentService DeviceManagmentService @inject IDeviceManagmentService DeviceManagmentService
@inject IAuthenticationService AuthenticationService @inject IAuthenticationService AuthenticationService
<Row Style="height:50%; width:100%" Padding="Padding.Is3.OnDesktop.Is5.FromStart.OnMobile"> <Row Style="height:50%; width:100%" Padding="Padding.Is3.OnDesktop.Is5.FromStart.OnMobile">
<Row Style="height:90%; width:100%"> <Row Style="height:90%; width:100%">
<Column ColumnSize="ColumnSize.Is4.OnDesktop.Is1"></Column> <Column ColumnSize="ColumnSize.Is4.OnDesktop.Is1"></Column>
<Column ColumnSize="ColumnSize.Is4.OnDesktop.Is12"> <Column ColumnSize="ColumnSize.Is4.OnDesktop.Is12">
@@ -22,7 +22,7 @@
<Column ColumnSize="ColumnSize.Is9"> <Column ColumnSize="ColumnSize.Is9">
Add a plug via wifi Add a plug via wifi
</Column> </Column>
<Column ColumnSize="ColumnSize.Is3.Is1.WithOffset"> <Column ColumnSize="ColumnSize.Is3.Is6.WithOffset">
<LoadingIndicator @bind-Visible="@visible"> <LoadingIndicator @bind-Visible="@visible">
</LoadingIndicator> </LoadingIndicator>
</Column> </Column>
@@ -38,7 +38,7 @@
<ItemTemplate> <ItemTemplate>
<ListGroupItem> <ListGroupItem>
<Row> <Row>
<Column ColumnSize="ColumnSize.Is6"> <Column ColumnSize="ColumnSize.Is8">
<Row> <Row>
</Row> </Row>
<Row Width="Width.Is100"> <Row Width="Width.Is100">
@@ -47,7 +47,7 @@
</Column> </Column>
</Row> </Row>
</Column> </Column>
<Column ColumnSize="ColumnSize.Is4.Is2.WithOffset"> <Column ColumnSize="ColumnSize.Is4">
<Button Position="Position.Absolute.Top.Is50.Start.Is50.Translate.Middle" Color="Color.Dark" Clicked="@(async () => await DeviceManagmentService.RegisterDevice(context.Item,(await AuthenticationService.GetUserAsync()).ValueOrDefault))" Outline> <Button Position="Position.Absolute.Top.Is50.Start.Is50.Translate.Middle" Color="Color.Dark" Clicked="@(async () => await DeviceManagmentService.RegisterDevice(context.Item,(await AuthenticationService.GetUserAsync()).ValueOrDefault))" Outline>
<BarIcon IconName="IconName.Add" /> <BarIcon IconName="IconName.Add" />
</Button> </Button>
@@ -58,7 +58,7 @@
</ListView> </ListView>
</Column> </Column>
</Row> </Row>
</Row> </Row>
<Row Style="height:50%; width:100%; border-top-style:solid; border-top-color:#1a237e" Padding="Padding.Is3.OnDesktop.Is5.FromStart.OnMobile"> <Row Style="height:50%; width:100%; border-top-style:solid; border-top-color:#1a237e" Padding="Padding.Is3.OnDesktop.Is5.FromStart.OnMobile">
<Column ColumnSize="ColumnSize.Is4.OnDesktop.Is1"></Column> <Column ColumnSize="ColumnSize.Is4.OnDesktop.Is1"></Column>
<Column ColumnSize="ColumnSize.Is4.OnDesktop.Is12"> <Column ColumnSize="ColumnSize.Is4.OnDesktop.Is12">
@@ -90,7 +90,7 @@
</Row> </Row>
<Row Style="height:75%; width:100%"></Row> <Row Style="height:75%; width:100%"></Row>
</Column> </Column>
</Row> </Row>
@code { @code {
List<IPAddress> ipAddresses = new List<IPAddress>(); List<IPAddress> ipAddresses = new List<IPAddress>();
@@ -106,7 +106,7 @@
System.Timers.Timer aTimer = new System.Timers.Timer(1000); System.Timers.Timer aTimer = new System.Timers.Timer(1000);
aTimer.Elapsed += (_, _) => { aTimer.Elapsed += (_, _) => {
DateTime dateTime = DateTime.UtcNow; DateTime dateTime = DateTime.UtcNow;
if(dateTime >= time.AddSeconds(5)) if(dateTime >= time.AddSeconds(3))
{ {
visible = false; visible = false;
InvokeAsync(StateHasChanged); InvokeAsync(StateHasChanged);
@@ -3,7 +3,7 @@
@using Elektrifikatsiya.Models; @using Elektrifikatsiya.Models;
@using System.Net @using System.Net
<Div> <Div>
<Row Style="width: 100%; height: 100%"> <Row Style="width: 100%; height: 100%" Margin="Margin.Is3.FromTop.OnMobile" Padding="Padding.Is4.FromStart.OnMobile">
<Div Display="Display.Flex.Row.OnDesktop" Margin=" Margin.Is3.FromBottom" Width="Width.Is100"> <Div Display="Display.Flex.Row.OnDesktop" Margin=" Margin.Is3.FromBottom" Width="Width.Is100">
<Column ColumnSize="ColumnSize.Is5.OnDesktop.Is12.OnMobile"> <Column ColumnSize="ColumnSize.Is5.OnDesktop.Is12.OnMobile">
<Bar Breakpoint="Breakpoint.Desktop" <Bar Breakpoint="Breakpoint.Desktop"
@@ -50,7 +50,7 @@
<br /> <br />
<Row> <Row>
<Column ColumnSize="ColumnSize.Is1.OnDesktop"> <Column ColumnSize="ColumnSize.Is1.OnDesktop">
<Button Position="Position.Absolute.Top.Is50.Start.Is100.Translate.Middle" Color="Color.Dark" Outline> <Button @onclick="Toggle" Position="Position.Absolute.Top.Is50.Start.Is100.Translate.Middle" Color="Color.Dark" Outline>
<BarIcon IconName="IconName.Pen" /> <BarIcon IconName="IconName.Pen" />
</Button> </Button>
</Column> </Column>
@@ -61,7 +61,8 @@
</ItemTemplate> </ItemTemplate>
</ListView> </ListView>
</Column> </Column>
<Column ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile" Margin="Margin.Is3.OnMobile"> <Column ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile" Margin="Margin.Is3.FromTop.OnMobile" Padding="Padding.Is4.FromStart.OnMobile">
<Div hidden="@hideButtonSettings">
<Field> <Field>
<FieldLabel> <FieldLabel>
<h5> <h5>
@@ -88,19 +89,6 @@
</Field> </Field>
<br /> <br />
<br /> <br />
<Field>
<FieldLabel>
<h5>
Electricity Price
</h5>
<Paragraph>
Here you enter your electricity price. This is gonna calculate the overall Price of your System
</Paragraph>
</FieldLabel>
<TextEdit Placeholder="Enter Electricity Price" />
</Field>
<br />
<br />
<Field> <Field>
<FieldLabel> <FieldLabel>
<h5> <h5>
@@ -122,6 +110,20 @@
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</Field> </Field>
</Div>
<Div hidden="@(!hideButtonSettings)">
<Field>
<FieldLabel>
<h5>
Electricity Price
</h5>
<Paragraph>
Here you enter your electricity price. This is gonna calculate the overall Price of your System
</Paragraph>
</FieldLabel>
<TextEdit Placeholder="Enter Electricity Price" />
</Field>
</Div>
<Column ColumnSize="ColumnSize.IsFull" TextAlignment="TextAlignment.End"> <Column ColumnSize="ColumnSize.IsFull" TextAlignment="TextAlignment.End">
<Button Color="Color.Primary">Save</Button> <Button Color="Color.Primary">Save</Button>
</Column> </Column>
@@ -133,8 +135,12 @@
@code { @code {
List<Device> plugs = new List<Device>() { new Device("ffff:ffff:ffff:ffff", "Josne", IPAddress.Broadcast, new User("Joe", "qiowruioewjfopa", Role.Admin), "Raum"), new Device("ffff:ffff:ffff:ffff", "Josne", IPAddress.Broadcast, new User("Joe", "Josne", Role.Admin), "Raum"), new Device("ffff:ffff:ffff:ffff", "Josne", IPAddress.Broadcast, new User("Joe", "qiowruioewjfopa", Role.Admin), "Raum"), }; List<Device> plugs = new List<Device>() { new Device("ffff:ffff:ffff:ffff", "Josne", IPAddress.Broadcast, new User("Joe", "qiowruioewjfopa", Role.Admin), "Raum"), new Device("ffff:ffff:ffff:ffff", "Josne", IPAddress.Broadcast, new User("Joe", "Josne", Role.Admin), "Raum"), new Device("ffff:ffff:ffff:ffff", "Josne", IPAddress.Broadcast, new User("Joe", "qiowruioewjfopa", Role.Admin), "Raum"), };
private bool hideButtonSettings = true;
private void Toggle()
{
hideButtonSettings = !hideButtonSettings;
}
} }