3 |
4 | Welcome to ControlR
5 |
6 |
7 |
8 | Login
9 |
10 |
11 | @if (_isPublicRegistrationEnabled)
12 | {
13 |
14 |
15 | Register
16 |
17 |
18 | }
19 |
20 |
21 | @code {
22 | private bool _isPublicRegistrationEnabled;
23 |
24 | protected override async Task OnInitializedAsync()
25 | {
26 | var settingsResults = await ServerSettingsApi.GetServerSettings();
27 | if (settingsResults.IsSuccess)
28 | {
29 | _isPublicRegistrationEnabled = settingsResults.Value.IsPublicRegistrationEnabled;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/ControlR.Web.Client/DataValidation/EqualToAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace ControlR.Web.Client.DataValidation;
4 |
5 |
6 | public class EqualToAttribute(string comparisonProperty) : ValidationAttribute
7 | {
8 | private readonly string _comparisonProperty = comparisonProperty;
9 |
10 | protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
11 | {
12 | var currentValue = value;
13 | var property = validationContext.ObjectType.GetProperty(_comparisonProperty)
14 | ?? throw new ArgumentException("Property with this name not found.");
15 |
16 | var comparisonValue = property.GetValue(validationContext.ObjectInstance);
17 |
18 | if (!Equals(currentValue, comparisonValue))
19 | {
20 | return new ValidationResult(ErrorMessage ?? $"{validationContext.MemberName} must be equal to {_comparisonProperty}");
21 | }
22 |
23 | return ValidationResult.Success;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ControlR.Web.Client/Enums/ControlMode.cs:
--------------------------------------------------------------------------------
1 | namespace ControlR.Web.Client.Enums;
2 | internal enum ControlMode
3 | {
4 | Mouse,
5 | Touch,
6 | }
7 |
--------------------------------------------------------------------------------
/ControlR.Web.Client/Enums/ViewMode.cs:
--------------------------------------------------------------------------------
1 | namespace ControlR.Web.Client.Enums;
2 | public enum ViewMode
3 | {
4 | Fit,
5 | Stretch,
6 | Original
7 | }
8 |
--------------------------------------------------------------------------------
/ControlR.Web.Client/Enums/WindowState.cs:
--------------------------------------------------------------------------------
1 | namespace ControlR.Web.Client.Enums;
2 | public enum WindowState
3 | {
4 | Restored,
5 | Minimized,
6 | Maximized
7 | }
--------------------------------------------------------------------------------
/ControlR.Web.Client/Extensions/AuthenticationStateProviderExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components.Authorization;
2 |
3 | namespace ControlR.Web.Client.Extensions;
4 |
5 | public static class AuthenticationStateProviderExtensions
6 | {
7 | public static async Task