Enabled nullable checks and fix nullability warnings.

This commit is contained in:
2023-05-22 03:25:56 +02:00
parent 9050b3796d
commit 2a474aac0a
27 changed files with 160 additions and 117 deletions

View File

@@ -1,4 +1,3 @@
using System;
using VAR.WebFormsCore.Code;
using VAR.WebFormsCore.Controls;
using VAR.WebFormsCore.Pages;
@@ -7,9 +6,9 @@ namespace VAR.WebFormsCore.TestWebApp;
public class FrmDefault: PageCommon
{
private CTextBox _txtText = new CTextBox { ID = "txtText", CssClassExtra = "width150px", AllowEmpty = false };
private Button _btnTest = new Button { ID = "btnTest", };
private Label _lblMessage = new Label { ID = "lblMessage", };
private readonly CTextBox _txtText = new() { ID = "txtText", CssClassExtra = "width150px", AllowEmpty = false };
private readonly Button _btnTest = new() { ID = "btnTest", };
private readonly Label _lblMessage = new() { ID = "lblMessage", };
public FrmDefault()
{
@@ -17,7 +16,7 @@ public class FrmDefault: PageCommon
Init += FrmLogin_Init;
}
private void FrmLogin_Init(object sender, EventArgs e)
private void FrmLogin_Init(object? sender, EventArgs e)
{
InitializeControls();
}

View File

@@ -1,6 +1,3 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace VAR.WebFormsCore.TestWebApp
{
public class Program

View File

@@ -1,7 +1,4 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using VAR.WebFormsCore.Code;
namespace VAR.WebFormsCore.TestWebApp

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String></wpf:ResourceDictionary>

View File

@@ -11,11 +11,11 @@ namespace VAR.WebFormsCore.Code
{
#region Declarations
private readonly Assembly _assembly;
private readonly string _assemblyNamespace;
private List<string> _assemblyFiles;
private readonly string _absolutePath;
private List<string> _absoluteFiles;
private readonly Assembly? _assembly;
private readonly string? _assemblyNamespace;
private List<string>? _assemblyFiles;
private readonly string? _absolutePath;
private List<string>? _absoluteFiles;
#endregion Declarations
@@ -62,7 +62,7 @@ namespace VAR.WebFormsCore.Code
#region Creator
public Bundler(Assembly assembly = null, string assemblyNamespace = null, string absolutePath = null)
public Bundler(Assembly? assembly = null, string? assemblyNamespace = null, string? absolutePath = null)
{
_assembly = assembly;
_assemblyNamespace = assemblyNamespace;
@@ -81,7 +81,7 @@ namespace VAR.WebFormsCore.Code
response.ContentType = contentType;
foreach (string fileName in AssemblyFiles)
{
Stream resourceStream = _assembly.GetManifestResourceStream(fileName);
Stream? resourceStream = _assembly?.GetManifestResourceStream(fileName);
if (resourceStream != null)
{
string fileContent = new StreamReader(resourceStream).ReadToEnd();

View File

@@ -9,7 +9,7 @@ namespace VAR.WebFormsCore.Code
{
#region HttpContext
public static string GetRequestParm(this HttpContext context, string parm)
public static string? GetRequestParm(this HttpContext context, string parm)
{
if (context.Request.Method == "POST")
{

View File

@@ -1,32 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
namespace VAR.WebFormsCore.Code
{
public static class GlobalConfig
{
private static IGlobalConfig _globalConfig;
private static IGlobalConfig? _globalConfig;
public static IGlobalConfig Get()
{
if (_globalConfig != null) { return _globalConfig; }
Type iGlobalConfig = typeof(IGlobalConfig);
Type foundGlobalConfig = AppDomain.CurrentDomain
Type? foundGlobalConfig = AppDomain.CurrentDomain
.GetAssemblies()
.SelectMany(
x =>
x.GetTypes()
)
.SelectMany(x => x.GetTypes())
.FirstOrDefault(
x =>
x.IsAbstract == false &&
x.IsInterface == false &&
x.IsPublic &&
iGlobalConfig.IsAssignableFrom(x)
);
_globalConfig = ObjectActivator.CreateInstance(foundGlobalConfig) as IGlobalConfig;
if(foundGlobalConfig != null)
{
_globalConfig = ObjectActivator.CreateInstance(foundGlobalConfig) as IGlobalConfig;
}
if(_globalConfig == null)
{
_globalConfig = new DefaultGlobalConfig();
}
return _globalConfig;
}
// TODO: Better default global config
private class DefaultGlobalConfig : IGlobalConfig
{
public string Title { get; } = string.Empty;
public string TitleSeparator { get; } = string.Empty;
public string Author { get; } = string.Empty;
public string Copyright { get; } = string.Empty;
public string DefaultHandler { get; } = string.Empty;
public string LoginHandler { get; } = string.Empty;
public List<string> AllowedExtensions { get; } = new List<string>();
public bool IsUserAuthenticated(HttpContext context)
{
return false;
}
public void UserUnauthenticate(HttpContext context)
{
}
}
}
}

View File

@@ -17,7 +17,7 @@ namespace VAR.WebFormsCore.Code
StringBuilder sbOutput = new StringBuilder();
sbOutput.Append("<h2>Internal error</h2>");
Exception exAux = ex;
Exception? exAux = ex;
while (exAux != null)
{
sbOutput.AppendFormat("<p><b>Message:</b> {0}</p>", exAux.Message);

View File

@@ -68,7 +68,7 @@ namespace VAR.WebFormsCore.Code
}
}
IHttpHandler handler = GetHandler(file);
IHttpHandler? handler = GetHandler(file);
if (handler == null)
{
// TODO: FrmNotFound
@@ -81,16 +81,16 @@ namespace VAR.WebFormsCore.Code
private static readonly Dictionary<string, Type> Handlers = new Dictionary<string, Type>();
private static IHttpHandler GetHandler(string typeName)
private static IHttpHandler? GetHandler(string typeName)
{
if (string.IsNullOrEmpty(typeName)) { return null; }
Type type;
Type? type;
lock (Handlers)
{
if (Handlers.TryGetValue(typeName, out type))
{
IHttpHandler handler = ObjectActivator.CreateInstance(type) as IHttpHandler;
IHttpHandler? handler = ObjectActivator.CreateInstance(type) as IHttpHandler;
return handler;
}
}
@@ -129,7 +129,7 @@ namespace VAR.WebFormsCore.Code
// Use found type
if (type != null)
{
IHttpHandler handler = ObjectActivator.CreateInstance(type) as IHttpHandler;
IHttpHandler? handler = ObjectActivator.CreateInstance(type) as IHttpHandler;
if (handler != null)
{
lock (Handlers)

View File

@@ -12,7 +12,7 @@ namespace VAR.WebFormsCore.Code
string privatePath = Path.Combine(currentDir, baseDir);
while (Directory.Exists(privatePath) == false)
{
DirectoryInfo dirInfo = Directory.GetParent(currentDir);
DirectoryInfo? dirInfo = Directory.GetParent(currentDir);
if (dirInfo == null) { break; }
currentDir = dirInfo.FullName;
@@ -22,11 +22,11 @@ namespace VAR.WebFormsCore.Code
return Path.Combine(privatePath, fileName);
}
private static Dictionary<string, Dictionary<string, object>> _literals;
private static Dictionary<string, Dictionary<string, object>?>? _literals;
private static void InitializeLiterals()
{
_literals = new Dictionary<string, Dictionary<string, object>>();
_literals = new Dictionary<string, Dictionary<string, object>?>();
JsonParser jsonParser = new JsonParser();
foreach (string lang in new[] {"en", "es"})
@@ -75,7 +75,7 @@ namespace VAR.WebFormsCore.Code
return DefaultLanguage;
}
public static string GetLiteral(string resource, string culture = null)
public static string GetLiteral(string resource, string? culture = null)
{
if (_literals == null) { InitializeLiterals(); }
@@ -83,7 +83,7 @@ namespace VAR.WebFormsCore.Code
if (_literals == null || _literals.ContainsKey(culture) == false) { return resource; }
Dictionary<string, object> literalCurrentCulture = _literals[culture];
Dictionary<string, object>? literalCurrentCulture = _literals[culture];
if (literalCurrentCulture == null || literalCurrentCulture.ContainsKey(resource) == false)
{

View File

@@ -5,7 +5,7 @@ namespace VAR.WebFormsCore.Code
{
public static class ServerHelpers
{
private static string _contentRoot;
private static string? _contentRoot;
public static void SetContentRoot(string contentRoot) { _contentRoot = contentRoot; }
public static string MapContentPath(string path)

View File

@@ -71,7 +71,7 @@ namespace VAR.WebFormsCore.Code
public static async void ResponseStaticFile(HttpContext context, string filePath)
{
string extension = Path.GetExtension(filePath).ToLower();
MimeTypeByExtension.TryGetValue(extension, out string contentType);
MimeTypeByExtension.TryGetValue(extension, out string? contentType);
if (string.IsNullOrEmpty(contentType) == false) { context.Response.ContentType = contentType; }

View File

@@ -15,11 +15,11 @@ namespace VAR.WebFormsCore.Controls
set => _text = value;
}
public string OnClientClick { get; set; }
public string OnClientClick { get; set; } = string.Empty;
public string CommandArgument { get; set; } = string.Empty;
public event EventHandler Click;
public event EventHandler? Click;
protected override void Render(TextWriter textWriter)
{

View File

@@ -11,7 +11,7 @@ namespace VAR.WebFormsCore.Controls
private readonly TextBox _txtContent = new TextBox();
private HiddenField _hidSize;
private HiddenField? _hidSize;
private const string CssClassBase = "textbox";
private string _cssClassExtra = "";
@@ -22,7 +22,7 @@ namespace VAR.WebFormsCore.Controls
private bool _markedInvalid;
private Control _nextFocusOnEnter;
private Control? _nextFocusOnEnter;
private bool _keepSize;
@@ -54,7 +54,7 @@ namespace VAR.WebFormsCore.Controls
set => _markedInvalid = value;
}
public Control NextFocusOnEnter
public Control? NextFocusOnEnter
{
get => _nextFocusOnEnter;
set => _nextFocusOnEnter = value;
@@ -88,7 +88,7 @@ namespace VAR.WebFormsCore.Controls
PreRender += CTextbox_PreRender;
}
private void CTextBox_Init(object sender, EventArgs e)
private void CTextBox_Init(object? sender, EventArgs e)
{
Controls.Add(_txtContent);
@@ -103,7 +103,7 @@ namespace VAR.WebFormsCore.Controls
string strCfgName = $"{this.ClientID}_cfg";
Dictionary<string, object> cfg = new Dictionary<string, object>
{
{"txtContent", _txtContent.ClientID}, {"hidSize", _hidSize.ClientID}, {"keepSize", _keepSize},
{"txtContent", _txtContent.ClientID}, {"hidSize", _hidSize?.ClientID ?? string.Empty}, {"keepSize", _keepSize},
};
StringBuilder sbCfg = new StringBuilder();
sbCfg.AppendFormat("<script>\n");
@@ -115,7 +115,7 @@ namespace VAR.WebFormsCore.Controls
}
}
private void CTextbox_PreRender(object sender, EventArgs e)
private void CTextbox_PreRender(object? sender, EventArgs e)
{
_txtContent.CssClass = CssClassBase;
if (string.IsNullOrEmpty(_cssClassExtra) == false)
@@ -123,7 +123,7 @@ namespace VAR.WebFormsCore.Controls
_txtContent.CssClass = $"{CssClassBase} {_cssClassExtra}";
}
if (Page.IsPostBack && (_allowEmpty == false && IsEmpty()) || _markedInvalid)
if (Page?.IsPostBack == true && (_allowEmpty == false && IsEmpty()) || _markedInvalid)
{
_txtContent.CssClass += " textboxInvalid";
}
@@ -154,10 +154,10 @@ namespace VAR.WebFormsCore.Controls
public int? GetClientsideHeight()
{
if (string.IsNullOrEmpty(_hidSize.Value)) { return null; }
if (string.IsNullOrEmpty(_hidSize?.Value)) { return null; }
JsonParser jsonParser = new JsonParser();
Dictionary<string, object> sizeObj = jsonParser.Parse(_hidSize.Value) as Dictionary<string, object>;
Dictionary<string, object>? sizeObj = jsonParser.Parse(_hidSize.Value) as Dictionary<string, object>;
if (sizeObj == null) { return null; }
if (sizeObj.ContainsKey("height") == false) { return null; }
@@ -169,22 +169,28 @@ namespace VAR.WebFormsCore.Controls
{
if (height == null)
{
_hidSize.Value = string.Empty;
if (_hidSize != null)
{
_hidSize.Value = string.Empty;
}
return;
}
Dictionary<string, object> sizeObj;
if (string.IsNullOrEmpty(_hidSize.Value) == false)
Dictionary<string, object?>? sizeObj = null;
if (string.IsNullOrEmpty(_hidSize?.Value) == false)
{
JsonParser jsonParser = new JsonParser();
sizeObj = jsonParser.Parse(_hidSize.Value) as Dictionary<string, object>;
sizeObj = jsonParser.Parse(_hidSize.Value) as Dictionary<string, object?>;
}
else
if(sizeObj == null)
{
sizeObj = new Dictionary<string, object> {{"height", height}, {"width", null}, {"scrollTop", null},};
sizeObj = new Dictionary<string, object?> {{"height", height}, {"width", null}, {"scrollTop", null},};
}
_hidSize.Value = JsonWriter.WriteObject(sizeObj);
if (_hidSize != null)
{
_hidSize.Value = JsonWriter.WriteObject(sizeObj);
}
}
#endregion Public methods

View File

@@ -9,7 +9,7 @@ namespace VAR.WebFormsCore.Controls
{
public class Control
{
public event EventHandler PreInit;
public event EventHandler? PreInit;
protected void OnPreInit(EventArgs e)
{
@@ -17,8 +17,7 @@ namespace VAR.WebFormsCore.Controls
foreach (Control control in Controls) { control.OnPreInit(e); }
}
public event EventHandler Init;
public event EventHandler? Init;
protected void OnInit(EventArgs e)
{
@@ -27,7 +26,7 @@ namespace VAR.WebFormsCore.Controls
}
public event EventHandler Load;
public event EventHandler? Load;
protected virtual void Process() { }
@@ -38,7 +37,7 @@ namespace VAR.WebFormsCore.Controls
foreach (Control control in Controls) { control.OnLoad(e); }
}
public event EventHandler PreRender;
public event EventHandler? PreRender;
protected void OnPreRender(EventArgs e)
{
@@ -46,9 +45,9 @@ namespace VAR.WebFormsCore.Controls
foreach (Control control in Controls) { control.OnPreRender(e); }
}
private string _id;
private string? _id;
public string ID
public string? ID
{
get => _id;
set
@@ -58,16 +57,16 @@ namespace VAR.WebFormsCore.Controls
}
}
private string _clientID;
private string? _clientID;
public string ClientID
{
get { return _clientID ??= GenerateClientID(); }
}
private Control _parent;
private Control? _parent;
public Control Parent
public Control? Parent
{
get => _parent;
set
@@ -77,18 +76,18 @@ namespace VAR.WebFormsCore.Controls
}
}
private ControlCollection _controls;
private ControlCollection? _controls;
public string CssClass { get; set; }
public string CssClass { get; set; } = string.Empty;
public ControlCollection Controls
{
get { return _controls ??= new ControlCollection(this); }
}
private Page _page;
private Page? _page;
public Page Page
public Page? Page
{
get => _page;
set
@@ -111,7 +110,7 @@ namespace VAR.WebFormsCore.Controls
sbClientID.Insert(0, currentID);
}
Control parent = Parent;
Control? parent = Parent;
while (parent != null)
{
if (parent is INamingContainer)
@@ -131,9 +130,9 @@ namespace VAR.WebFormsCore.Controls
return sbClientID.ToString();
}
public Dictionary<string, string> Style { get; } = new Dictionary<string, string>();
public Dictionary<string, string> Style { get; } = new();
public Dictionary<string, string> Attributes { get; } = new Dictionary<string, string>();
public Dictionary<string, string> Attributes { get; } = new();
public int Index { get; set; }
@@ -179,13 +178,19 @@ namespace VAR.WebFormsCore.Controls
}
}
protected List<Control> ChildsOfType<T>(List<Control> controls = null)
protected List<Control> ChildsOfType<T>(List<Control>? controls = null)
{
controls ??= new List<Control>();
if (this is T) { controls.Add(this); }
foreach (Control child in _controls) { child.ChildsOfType<T>(controls); }
if (_controls != null)
{
foreach (Control child in _controls)
{
child.ChildsOfType<T>(controls);
}
}
return controls;
}

View File

@@ -14,9 +14,9 @@ namespace VAR.WebFormsCore.Controls
protected override void Process()
{
if (Page.IsPostBack && Page.Context.Request.Form.ContainsKey(ClientID))
if (Page?.IsPostBack == true && Page?.Context?.Request.Form.ContainsKey(ClientID) == true)
{
Value = Page.Context.Request.Form[ClientID];
Value = Page?.Context.Request.Form[ClientID][0] ?? string.Empty;
}
}

View File

@@ -26,16 +26,19 @@ namespace VAR.WebFormsCore.Controls
private string GetAction()
{
StringBuilder sbAction = new();
sbAction.Append(Page.GetType().Name);
sbAction.Append(Page?.GetType().Name);
if (Page.Context.Request.Query.Count <= 0) { return sbAction.ToString(); }
if ((Page?.Context?.Request.Query.Count ?? 0) <= 0) { return sbAction.ToString(); }
sbAction.Append('?');
foreach (KeyValuePair<string, StringValues> queryParam in Page.Context.Request.Query)
if (Page?.Context?.Request.Query != null)
{
string key = ServerHelpers.UrlEncode(queryParam.Key);
string value = ServerHelpers.UrlEncode(queryParam.Value[0]);
sbAction.Append($"&{key}={value}");
foreach (KeyValuePair<string, StringValues> queryParam in Page.Context.Request.Query)
{
string key = ServerHelpers.UrlEncode(queryParam.Key);
string value = ServerHelpers.UrlEncode(queryParam.Value[0] ?? string.Empty);
sbAction.Append($"&{key}={value}");
}
}
return sbAction.ToString();

View File

@@ -4,7 +4,7 @@ namespace VAR.WebFormsCore.Controls
{
public class HtmlHead : Control
{
public string Title { get; set; }
public string Title { get; set; } = string.Empty;
protected override void Render(TextWriter textWriter)
{

View File

@@ -4,9 +4,9 @@ namespace VAR.WebFormsCore.Controls
{
public class HtmlMeta : Control
{
public string Name { get; init; }
public string Content { get; init; }
public string HttpEquiv { get; internal init; }
public string Name { get; init; } = string.Empty;
public string Content { get; init; } = string.Empty;
public string HttpEquiv { get; internal init; } = string.Empty;
protected override void Render(TextWriter textWriter)
{

View File

@@ -4,8 +4,8 @@ namespace VAR.WebFormsCore.Controls
{
public class HyperLink : Control
{
public string NavigateUrl { get; set; }
public string Text { get; init; }
public string NavigateUrl { get; set; } = string.Empty;
public string Text { get; init; } = string.Empty;
protected override void Render(TextWriter textWriter)
{

View File

@@ -4,7 +4,7 @@ namespace VAR.WebFormsCore.Controls
{
public class LiteralControl : Control
{
public string Content { get; set; }
public string Content { get; set; } = string.Empty;
public LiteralControl() { }
public LiteralControl(string content) { Content = content; }

View File

@@ -11,9 +11,9 @@ namespace VAR.WebFormsCore.Controls
protected override void Process()
{
if (Page.IsPostBack && Page.Context.Request.Form.ContainsKey(ClientID))
if (Page?.IsPostBack == true && Page?.Context?.Request.Form.ContainsKey(ClientID) == true)
{
Text = Page.Context.Request.Form[ClientID];
Text = Page?.Context.Request.Form[ClientID][0] ?? string.Empty;
}
}

View File

@@ -4,7 +4,7 @@ namespace VAR.WebFormsCore.Pages
{
public static class FormUtils
{
public static Control CreatePanel(string cssClass, Control ctrl = null)
public static Control CreatePanel(string cssClass, Control? ctrl = null)
{
Panel pnl = new Panel();
if (ctrl != null) { pnl.Controls.Add(ctrl); }

View File

@@ -21,7 +21,7 @@ namespace VAR.WebFormsCore.Pages
Init += FrmError_Init;
}
private void FrmError_Init(object sender, EventArgs e) { InitializeControls(); }
private void FrmError_Init(object? sender, EventArgs e) { InitializeControls(); }
#endregion Page life cycle
@@ -34,7 +34,7 @@ namespace VAR.WebFormsCore.Pages
Label lblErrorTitle = new Label {Text = Title, Tag = "h2"};
Controls.Add(lblErrorTitle);
Exception exAux = _ex;
Exception? exAux = _ex;
//if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; }
while (exAux != null)
{

View File

@@ -10,9 +10,9 @@ namespace VAR.WebFormsCore.Pages
{
public class Page : Control, IHttpHandler
{
protected string Title { get; set; }
protected string Title { get; set; } = string.Empty;
public HttpContext Context { get; private set; }
public HttpContext? Context { get; private set; }
private static readonly Encoding Utf8Encoding = new UTF8Encoding();

View File

@@ -9,12 +9,12 @@ namespace VAR.WebFormsCore.Pages
{
#region Declarations
private HtmlHead _head;
private HtmlBody _body;
private HtmlForm _form;
private readonly Panel _pnlContainer = new Panel();
private readonly Button _btnPostback = new Button();
private readonly Button _btnLogout = new Button();
private readonly HtmlHead _head = new();
private readonly HtmlBody _body = new();
private readonly HtmlForm _form = new() {ID = "formMain"};
private readonly Panel _pnlContainer = new();
private readonly Button _btnPostback = new();
private readonly Button _btnLogout = new();
private bool _isAuthenticated;
@@ -37,20 +37,24 @@ namespace VAR.WebFormsCore.Pages
PreRender += PageCommon_PreRender;
}
private void PageCommon_PreInit(object sender, EventArgs e)
private void PageCommon_PreInit(object? sender, EventArgs e)
{
Context.Response.PrepareUncacheableResponse();
Context?.Response.PrepareUncacheableResponse();
if (Context != null)
{
_isAuthenticated = GlobalConfig.Get().IsUserAuthenticated(Context);
}
_isAuthenticated = GlobalConfig.Get().IsUserAuthenticated(Context);
if (MustBeAuthenticated && _isAuthenticated == false)
{
Context.Response.Redirect(GlobalConfig.Get().LoginHandler);
Context?.Response.Redirect(GlobalConfig.Get().LoginHandler);
}
}
private void PageCommon_Init(object sender, EventArgs e) { CreateControls(); }
private void PageCommon_Init(object? sender, EventArgs e) { CreateControls(); }
private void PageCommon_PreRender(object sender, EventArgs e)
private void PageCommon_PreRender(object? sender, EventArgs e)
{
_head.Title = string.IsNullOrEmpty(Title)
? GlobalConfig.Get().Title
@@ -62,10 +66,13 @@ namespace VAR.WebFormsCore.Pages
#region UI Events
private void btnLogout_Click(object sender, EventArgs e)
private void btnLogout_Click(object? sender, EventArgs e)
{
GlobalConfig.Get().UserUnauthenticate(Context);
if (MustBeAuthenticated) { Context.Response.Redirect(GlobalConfig.Get().LoginHandler); }
if(Context != null)
{
GlobalConfig.Get().UserUnauthenticate(Context);
}
if (MustBeAuthenticated) { Context?.Response.Redirect(GlobalConfig.Get().LoginHandler); }
}
#endregion UI Events
@@ -82,7 +89,6 @@ namespace VAR.WebFormsCore.Pages
var html = new HtmlGenericControl("html");
base.Controls.Add(html);
_head = new HtmlHead();
html.Controls.Add(_head);
_head.Controls.Add(new HtmlMeta {HttpEquiv = "X-UA-Compatible", Content = "IE=Edge"});
@@ -97,7 +103,7 @@ namespace VAR.WebFormsCore.Pages
}
);
string version = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
string? version = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
_head.Controls.Add(
new LiteralControl($"<script type=\"text/javascript\" src=\"ScriptsBundler?v={version}\"></script>\n")
);
@@ -105,9 +111,7 @@ namespace VAR.WebFormsCore.Pages
new LiteralControl($"<link href=\"StylesBundler?v={version}\" type=\"text/css\" rel=\"stylesheet\"/>\n")
);
_body = new HtmlBody();
html.Controls.Add(_body);
_form = new HtmlForm {ID = "formMain"};
_body.Controls.Add(_form);
var pnlHeader = new Panel {CssClass = "divHeader"};

View File

@@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>