Skip to content

Commit 0324f42

Browse files
Update WebForms.cs
1 parent c25d6f4 commit 0324f42

1 file changed

Lines changed: 61 additions & 8 deletions

File tree

class/WebForms.cs

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,24 @@ public void SetWasmEventListener(string InputPlace, string HtmlEventListener, st
248248
public void SetSSEEvent(string InputPlace, string HtmlEvent, string Path, string OutputPlace, bool ShouldReconnect = true, int ReconnectTryTimeout = 3000) => Add("Ee" + InputPlace, HtmlEvent + "|" + Path + "|" + (ShouldReconnect ? "1" : "0") + "|" + ReconnectTryTimeout + "|" + OutputPlace);
249249
public void SetSSEEventListener(string InputPlace, string HtmlEventListener, string Path, bool ShouldReconnect = true, int ReconnectTryTimeout = 3000) => Add("EE" + InputPlace, HtmlEventListener + "|" + Path + "|" + (ShouldReconnect? "1" : "0") + "|" + ReconnectTryTimeout);
250250
public void SetSSEEventListener(string InputPlace, string HtmlEventListener, string Path, string OutputPlace, bool ShouldReconnect = true, int ReconnectTryTimeout = 3000) => Add("EE" + InputPlace, HtmlEventListener + "|" + Path + "|" + (ShouldReconnect ? "1" : "0") + "|" + ReconnectTryTimeout + "|" + OutputPlace);
251+
public void SetFrontEvent(string InputPlace, string HtmlEvent, string ModulePath, string[] Args = null, string OutputPlace = null)
252+
{
253+
string ArgsJoin = "";
254+
255+
if (Args != null)
256+
ArgsJoin = (Args.Length > 0) ? "|" + string.Join("|", Args) : "";
257+
258+
Add("Ej" + InputPlace, HtmlEvent + "|" + ModulePath + "|" + OutputPlace + ArgsJoin);
259+
}
260+
public void SetFrontEventListener(string InputPlace, string HtmlEventListener, string ModulePath, string[] Args = null, string OutputPlace = null)
261+
{
262+
string ArgsJoin = "";
263+
264+
if (Args != null)
265+
ArgsJoin = (Args.Length > 0) ? "|" + string.Join("|", Args) : "";
266+
267+
Add("EJ" + InputPlace, HtmlEventListener + "|" + ModulePath + "|" + OutputPlace + ArgsJoin);
268+
}
251269
public void SetSendEvent(string InputPlace, string HtmlEvent, string Data, string Path = null, string Method = "POST", bool IsMultiPart = false, string ContentType = "text/plain", string OutputPlace = null) => Add("En" + InputPlace, HtmlEvent + "|" + Data.Replace('\n'.ToString(), "$[ln];").Replace("\"", "$[dq];").Replace("'", "$[sq];") + "|" + (!string.IsNullOrEmpty(Path) ? Path : "#") + "|" + Method + "|" + (IsMultiPart ? "1" : "0") + "|" + ContentType + "|" + OutputPlace);
252270
public void SetSendEventListener(string InputPlace, string HtmlEventListener, string Data, string Path = null, string Method = "POST", bool IsMultiPart = false, string ContentType = "text/plain", string OutputPlace = null) => Add("EN" + InputPlace, HtmlEventListener + "|" + Data.Replace('\n'.ToString(), "$[ln];") + "|" + (!string.IsNullOrEmpty(Path) ? Path : "#") + "|" + Method + "|" + (IsMultiPart ? "1" : "0") + "|" + ContentType + "|" + OutputPlace);
253271
public void SetMasterPagesEvent(string InputPlace, string HtmlEvent, string OutputPlace = null) => Add("Eu" + InputPlace, HtmlEvent + "|" + OutputPlace);
@@ -319,6 +337,8 @@ public void SetModuleMethodEventListener(string InputPlace, string HtmlEventList
319337
public void RemoveWebSocketEventListener(string InputPlace, string HtmlEventListener) => Add("RW" + InputPlace, HtmlEventListener);
320338
public void RemoveSSEEvent(string InputPlace, string HtmlEvent) => Add("Re" + InputPlace, HtmlEvent);
321339
public void RemoveSSEEventListener(string InputPlace, string HtmlEventListener) => Add("RE" + InputPlace, HtmlEventListener);
340+
public void RemoveFrontEvent(string InputPlace, string HtmlEvent) => Add("Rj" + InputPlace, HtmlEvent);
341+
public void RemoveFrontEventListener(string InputPlace, string HtmlEventListener) => Add("RJ" + InputPlace, HtmlEventListener);
322342
public void RemoveSendEvent(string InputPlace, string HtmlEvent) => Add("Rn" + InputPlace, HtmlEvent);
323343
public void RemoveSendEventListener(string InputPlace, string HtmlEventListener) => Add("RN" + InputPlace, HtmlEventListener);
324344
public void RemovePreventDefaultEvent(string InputPlace, string HtmlEvent) => Add("Rd" + InputPlace, HtmlEvent);
@@ -353,21 +373,32 @@ public void SetModuleMethodEventListener(string InputPlace, string HtmlEventList
353373
public void AssertEqualByOutputPlace(string InputPlace, string OutputPlace) => Add("Ao" + InputPlace, OutputPlace);
354374

355375
// Service Worker
356-
public void ServiceWorkerRegister() => Add("wR");
376+
// To Use Service Worker, You Need To Add The Elanat Dedicated Module (service-worker.js) On The Client Side
377+
public void ServiceWorkerRegister(string Path = null, string ScobePath = null) => Add("wR", Path + "|" + ScobePath);
357378
public void ServiceWorkerPreCacheStatic(string[] PathList) => Add("wp",string.Join("|", PathList));
358379
public void ServiceWorkerDynamicCache(string Path, int Seconds = 0) => Add("wc", Path + (Seconds > 0 ? "|" + Seconds : ""));
359380
public void ServiceWorkerDeleteDynamicCache() => Add("wd");
360381
public void ServiceWorkerDeleteDynamicCache(string Path) => Add("wd", Path);
361382
public void ServiceWorkerDynamicCacheTTLUpdate(string Path, int Seconds = 0) => Add("wt", Path + (Seconds > 0 ? "|" + Seconds : ""));
362383
// Path: Support Wildcard Automatically And Also Support Regex If Use "re:" Before Pattern
363384
// Type: Type Is Cache Strategy. cachefirst, networkfirst, cacheonly, networkonly, stalerevalidate (Fast From Cache, Updates Simultaneously From The Network)
364-
// CacheDynamic: If True, Any Successful Network Response For That Route Will Be Stored In The Dynamic Cache.
385+
// CacheDynamic: If True, Any Successful Network Response For That Route Will Be Stored In The Dynamic Cache
365386
public void ServiceWorkerRouteSet(string Path, string Type, bool CacheDynamic = false) => Add("wr", Path + "|" + Type + (CacheDynamic? "|1" : ""));
366387
public void ServiceWorkerRouteAlias(string Path, string To) => Add("wa", Path + "|" + To);
388+
public void ServiceWorkerDeleteRouteAlias(string Path = null) => Add("wC", Path);
367389
// Delete All Route And Alias
368390
public void ServiceWorkerDeleteRoute() => Add("wD");
369391
public void ServiceWorkerDeleteRoute(string Path) => Add("wD", Path);
370392

393+
// SSE
394+
public void DisconnectSSE(string Path) => Add("Ds", Path);
395+
public void DisconnectAllSSE() => Add("Ds");
396+
397+
// State
398+
public void AddState(string Path = null, string Title = null) => Add("AS", Path + "|" + Title);
399+
public void DeleteState(string Path = null) => Add("DS", Path);
400+
public void DeleteAllState() => Add("DS", "*");
401+
371402
// Cookie
372403
public void SetCookie(string Key, string Value, int Seconds, string Path = null) => Add("sC", Key + "|" + Value + "|" + Seconds + (!string.IsNullOrEmpty(Path) ? "|" + Path : ""));
373404

@@ -466,6 +497,15 @@ public void CallWasmBack(string WasmLanguage, string WasmUrl, string MethodName,
466497
}
467498
public void CallWebSocketBack(string Path, bool UseCurrentEvent = true) => Add("Lw", (UseCurrentEvent? "1": "0") + "|" + Path);
468499
public void CallSSEBack(string Path, string OutputPlace = null, bool UseCurrentEvent = true, bool ShouldReconnect = true, int ReconnectTryTimeout = 3000) => Add("Ls", (UseCurrentEvent? "1": "0") + "|" + Path + "|" + (ShouldReconnect ? "1" : "0") + "|" + ReconnectTryTimeout + (!string.IsNullOrEmpty(OutputPlace) ? "|" + OutputPlace : ""));
500+
public void CallFront(string ModulePath, string[] Args = null, string OutputPlace = null, bool UseCurrentEvent = true)
501+
{
502+
string ArgsJoin = "";
503+
504+
if (Args != null)
505+
ArgsJoin = (Args.Length > 0) ? "|" + string.Join("|", Args) : "";
506+
507+
Add("Lj", (UseCurrentEvent ? "1" : "0") + "|" + ModulePath + "|" + OutputPlace + ArgsJoin);
508+
}
469509
public void CallGetBack(string Path, string OutputPlace = null, bool UseCurrentEvent = true) => Add("Lg", (UseCurrentEvent ? "1" : "0") + "|" + Path + (!string.IsNullOrEmpty(OutputPlace) ? "|" + OutputPlace : ""));
470510
public void CallPutBack(string Path, string OutputPlace = null, bool UseCurrentEvent = true) => Add("Lu", (UseCurrentEvent ? "1" : "0") + "|" + Path + (!string.IsNullOrEmpty(OutputPlace) ? "|" + OutputPlace : ""));
471511
public void CallPatchBack(string Path, string OutputPlace = null, bool UseCurrentEvent = true) => Add("LP", (UseCurrentEvent ? "1" : "0") + "|" + Path + (!string.IsNullOrEmpty(OutputPlace) ? "|" + OutputPlace : ""));
@@ -554,20 +594,20 @@ public void AssignDelayChange(int MiliSecond, int Index = -1)
554594
UpdateLineByIndex(Index, newName, newValue);
555595
}
556596

557-
public void AssignInterval(int MiliSecond, int Index = -1)
597+
public void AssignInterval(int MiliSecond, string Id = null, int Index = -1)
558598
{
559599
string currentLine = GetLineByIndex(Index);
560600
if (string.IsNullOrEmpty(currentLine))
561601
return;
562602

563603
string[] parts = currentLine.Split('=', 2);
564-
string newName = "(" + MiliSecond + ")" + parts[0];
604+
string newName = "(" + MiliSecond + (!string.IsNullOrEmpty(Id) ? "|" + Id : "") + ")" + parts[0];
565605
string newValue = parts.Length > 1 ? parts[1] : "";
566606

567607
UpdateLineByIndex(Index, newName, newValue);
568608
}
569609

570-
public void AssignIntervalChange(float MiliSecond, int Index = -1)
610+
public void AssignIntervalChange(float MiliSecond, string Id = null, int Index = -1)
571611
{
572612
string currentLine = GetLineByIndex(Index);
573613
if (string.IsNullOrEmpty(currentLine))
@@ -582,12 +622,14 @@ public void AssignIntervalChange(float MiliSecond, int Index = -1)
582622
currentName = currentName.Substring(closingBracket + 1);
583623
}
584624

585-
string newName = "(" + MiliSecond + ")" + currentName;
625+
string newName = "(" + MiliSecond + (!string.IsNullOrEmpty(Id) ? "|" + Id : "") + ")" + currentName;
586626
string newValue = parts.Length > 1 ? parts[1] : "";
587627

588628
UpdateLineByIndex(Index, newName, newValue);
589629
}
590630

631+
public void DeleteInterval(string Id) => Add("Di", Id);
632+
591633
public void AssignRepeat(int Count, int Index = -1)
592634
{
593635
string currentLine = GetLineByIndex(Index);
@@ -642,11 +684,14 @@ public void AssignRepeatChange(int Count, int Index = -1)
642684
public void ConsoleMessageAssert(string Text, string Condition) => Add("ma", Text.Replace('\n'.ToString(), "$[ln];") + "|" + Condition);
643685

644686
// Enable
687+
//Calling The EnableWebSocket Or EnableWebSocketOnce Or AddWebSocket Methods Will Cause Any Subsequent Requests (Under WebForms Core Technology) To Operate Under The WebSocket Protocol.
645688
public void EnableWebSocket(bool Enable = true) => Add("ew", Enable ? "1" : "0");
646-
public void EnableWebSocketOnce() => Add("ew", "@");
689+
public void EnableWebSocketOnce() => Add("ew", "$");
690+
public void AddWebSocket(string Path) => Add("aw" + Path);
647691

648692
// Use
649-
public void UseWebSocket(string Path) => Add("uw", Path);
693+
// InputPlace Using Only For form Element
694+
public void UseWebSocket(string InputPlace) => Add("uw" + InputPlace);
650695
public void UseOnlyChangeUpdate(string InputPlace) => Add("uo" + InputPlace);
651696

652697
// Condition
@@ -1005,6 +1050,14 @@ public static string Math(string MethodName, string[] Args = null)
10051050
public const string TabIsActive = "@da";
10061051

10071052
// Window
1053+
public const string Href = "@wf";
1054+
public const string PathName = "@wP";
1055+
public const string Query= "@wq";
1056+
public const string Hash = "@wh";
1057+
public const string Host = "@wH";
1058+
public const string HostName = "@wn";
1059+
public const string Port = "@wT";
1060+
public const string Origin = "@wo";
10081061
public const string GetSelection = "@ws";
10091062
public const string ScrollX = "@wx";
10101063
public const string ScrollY = "@wy";

0 commit comments

Comments
 (0)