-
Notifications
You must be signed in to change notification settings - Fork 81
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
8 changed files
with
67 additions
and
65 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
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
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
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
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
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
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
52 changes: 52 additions & 0 deletions
52
Material.Demo/ViewModels/ProgressIndicatorDemoViewModel.cs
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,52 @@ | ||
using System.Timers; | ||
|
||
namespace Material.Demo.ViewModels; | ||
|
||
public class ProgressIndicatorDemoViewModel : ViewModelBase { | ||
private readonly Timer _timer; | ||
private double _progress; | ||
private int _progressSate; | ||
|
||
public ProgressIndicatorDemoViewModel() { | ||
_timer = new Timer(1000); | ||
_timer.Elapsed += Timer_Elapsed; | ||
} | ||
|
||
public double Progress { | ||
get => _progress; | ||
set { | ||
_progress = value; | ||
OnPropertyChanged(); | ||
} | ||
} | ||
|
||
private void Timer_Elapsed(object? sender, ElapsedEventArgs e) { | ||
Progress = SwitchProgress(); | ||
} | ||
|
||
private double SwitchProgress() { | ||
switch (_progressSate) { | ||
case 0: | ||
_progressSate++; | ||
return 30; | ||
case 1: | ||
_progressSate++; | ||
return 45; | ||
case 2: | ||
_progressSate++; | ||
return 50; | ||
case 3: | ||
_progressSate++; | ||
return 80; | ||
case 4: | ||
_progressSate++; | ||
return 100; | ||
case 5: | ||
_progressSate = 0; | ||
return 0; | ||
default: | ||
_progressSate = 0; | ||
return 0; | ||
} | ||
} | ||
} |