Skip to content

Commit 3c4830f

Browse files
Michal DivišMichal Diviš
authored andcommitted
added BusyOverlay documentation
1 parent ab7a7f0 commit 3c4830f

File tree

3 files changed

+83
-2
lines changed

3 files changed

+83
-2
lines changed

docs/js/AppViewModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function AppViewModel(contentDivId, drawer) {
1616
self.documentationItems = [
1717
new DocumentationItem('appbar', 'App bar', 'https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/MaterialWindow.png', 'snippets/documentation/appbar.html'),
1818
new DocumentationItem('autocomplete', 'Autocomplete', 'https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/Autocomplete.png', 'snippets/documentation/autocomplete.html'),
19-
new DocumentationItem('busyoverlay', 'Busy overlay', null, 'snippets/documentation/busyoverlay.html'),
19+
new DocumentationItem('busyoverlay', 'Busy overlay', 'https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/BusyOverlay.png', 'snippets/documentation/busyoverlay.html'),
2020
new DocumentationItem('filesystemcontrols', 'File system controls', 'https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/OpenFileControl1.png', 'snippets/documentation/filesystemcontrols.html'),
2121
new DocumentationItem('gridlist', 'Grid list', 'https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/GridList.png', 'snippets/documentation/gridlist.html'),
2222
new DocumentationItem('materialwindow', 'Material window', 'https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/MaterialWindow.png', 'snippets/documentation/materialwindow.html'),
Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,85 @@
11
<div>
22
<h1>Busy overlay</h1>
3-
Documentation under construction
3+
<p>
4+
The following predefined styles are available:
5+
<ul>
6+
<li><code>MaterialBusyOverlayCircular</code></li>
7+
<li><code>MaterialBusyOverlayCircularProgress</code></li>
8+
<li><code>MaterialBusyOverlayLinear</code></li>
9+
<li><code>MaterialBusyOverlayLinearProgress</code></li>
10+
</ul>
11+
</p>
12+
13+
<h2>Screenshots</h2>
14+
<img src="https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/master/screenshots/BusyOverlay.png" alt="Busy overlay" />
15+
16+
<h2>Code example</h2>
17+
18+
<p>Busy overlay control</p>
19+
<pre class="language-markup"><code class="language-markup">
20+
&lt;mde:BusyOverlay IsBusy="{Binding Path=IsBusy}"
21+
Progress="{Binding Path=Progress}"
22+
Style="{StaticResource MaterialBusyOverlayCircular}" />
23+
</code></pre>
24+
25+
<p>Busy overlay show and progress bindings</p>
26+
<pre class="language-markup"><code class="language-markup">
27+
public class BusyOverlayViewModel : ViewModel
28+
{
29+
private bool _isBusy;
30+
public bool IsBusy
31+
{
32+
get => _isBusy;
33+
set
34+
{
35+
_isBusy = value;
36+
OnPropertyChanged(nameof(IsBusy));
37+
}
38+
}
39+
40+
private int _progress;
41+
public int Progress
42+
{
43+
get => _progress;
44+
set
45+
{
46+
_progress = value;
47+
OnPropertyChanged(nameof(Progress));
48+
}
49+
}
50+
51+
public BusyOverlayViewModel() : base()
52+
{
53+
_isBusy = false;
54+
_progress = 0;
55+
}
56+
57+
public async Task BeBusyAsync()
58+
{
59+
try
60+
{
61+
Progress = 0;
62+
IsBusy = true;
63+
64+
//Simulate work and update progress
65+
await Task.Run(async () =>
66+
{
67+
int progress = 0;
68+
69+
while (progress < 100)
70+
{
71+
await Task.Delay(250);
72+
73+
progress += 10;
74+
Progress = progress;
75+
}
76+
});
77+
}
78+
finally
79+
{
80+
IsBusy = false;
81+
}
82+
}
83+
}
84+
</code></pre>
485
</div>

screenshots/BusyOverlay.png

5.19 KB
Loading

0 commit comments

Comments
 (0)