-
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...tion/Blazorise.Docs/Pages/Docs/Components/Progresses/Code/ProgressWithMaxExampleCode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div class="blazorise-codeblock"> | ||
<div class="html"><pre> | ||
<span class="atSign">@</span>using System.Timers | ||
<span class="atSign">@</span>implements IDisposable | ||
|
||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">Progress</span> <span class="htmlAttributeName">Max</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue">42</span><span class="quot">"</span> <span class="htmlAttributeName">Value</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="sharpVariable"><span class="atSign">@</span>Value</span><span class="quot">"</span> <span class="htmlTagDelimiter">/></span> | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">FieldHelp</span><span class="htmlTagDelimiter">></span> | ||
There have been <span class="atSign">@</span>Value files downloaded | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">FieldHelp</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">></span> | ||
</pre></div> | ||
<div class="csharp"><pre> | ||
<span class="atSign">@</span>code { | ||
<span class="keyword">private</span> <span class="keyword">int</span> Value = <span class="number">0</span>; | ||
<span class="keyword">private</span> Timer timer; | ||
|
||
<span class="keyword">private</span> <span class="keyword">const</span> <span class="keyword">int</span> IntervalDelay = <span class="number">100</span>; <span class="comment">// milliseconds</span> | ||
<span class="keyword">private</span> <span class="keyword">const</span> <span class="keyword">int</span> IntervalIncrement = <span class="number">1</span>; | ||
|
||
<span class="keyword">protected</span> <span class="keyword">override</span> <span class="keyword">void</span> OnInitialized() | ||
{ | ||
timer = <span class="keyword">new</span> Timer(IntervalDelay); | ||
timer.Elapsed += OnTimerElapsed; | ||
timer.AutoReset = <span class="keyword">true</span>; | ||
timer.Start(); | ||
} | ||
|
||
<span class="keyword">private</span> <span class="keyword">void</span> OnTimerElapsed(<span class="keyword">object</span> sender, ElapsedEventArgs e) | ||
{ | ||
Value = Value < <span class="number">42</span> ? Value + IntervalIncrement : <span class="number">0</span>; | ||
InvokeAsync(StateHasChanged); | ||
} | ||
|
||
<span class="keyword">public</span> <span class="keyword">void</span> Dispose() | ||
{ | ||
timer?.Stop(); | ||
timer?.Dispose(); | ||
} | ||
} | ||
</pre></div> | ||
</div> |
40 changes: 40 additions & 0 deletions
40
...ion/Blazorise.Docs/Pages/Docs/Components/Progresses/Examples/ProgressWithMaxExample.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@namespace Blazorise.Docs.Docs.Examples | ||
@using System.Timers | ||
@implements IDisposable | ||
|
||
<Field> | ||
<FieldBody> | ||
<Progress Max="42" Value="@Value" /> | ||
</FieldBody> | ||
<FieldHelp> | ||
There have been @Value files downloaded | ||
</FieldHelp> | ||
</Field> | ||
|
||
@code { | ||
private int Value = 0; | ||
private Timer timer; | ||
|
||
private const int IntervalDelay = 100; // milliseconds | ||
private const int IntervalIncrement = 1; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
timer = new Timer(IntervalDelay); | ||
timer.Elapsed += OnTimerElapsed; | ||
timer.AutoReset = true; | ||
timer.Start(); | ||
} | ||
|
||
private void OnTimerElapsed(object sender, ElapsedEventArgs e) | ||
{ | ||
Value = Value < 42 ? Value + IntervalIncrement : 0; | ||
InvokeAsync(StateHasChanged); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
timer?.Stop(); | ||
timer?.Dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters