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
public class RideTheComet : View | |
{ | |
public record CometRide | |
{ | |
public int Rides { get; init; } = 0; | |
public string CometTrain => "☄️".Repeat(Rides); | |
} | |
CometRide state = new CometRide(); |
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
public class RideTheComet : View | |
{ | |
public record CometRide | |
{ | |
public int Rides { get; init; } = 0; | |
public string CometTrain => "☄️".Repeat(Rides); | |
} | |
State<CometRide> state = new CometRide(); |
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
public class MainPage : View | |
{ | |
readonly State<int> ImageCount = new State<int>(); | |
readonly State<List<(string Path, string Name)>> images = new List<(string Path, string Name)>(); | |
Task<FileResult> currentPickerTask; | |
[Body] | |
View body() | |
=> new VStack { | |
new HStack(Comet.VerticalAlignment.Center){ |
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
using System; | |
using System.Threading.Tasks; | |
using System.Linq; | |
namespace gMusic | |
{ | |
public class ArtistPlayableGroup : PlayableGroup | |
{ | |
ArtistViewModel model; | |
ArtistViewModel Model {get{ return model?? (model = new ArtistViewModel()); }} |
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
public abstract class StatefulView<TMessage,TModel> : View | |
{ | |
public StatefulView() { } | |
public StatefulView(TModel initialModel) | |
{ | |
state = initialModel; | |
} | |
readonly State<TModel> state = new State<TModel>(); | |
public void Dispatch(TMessage message) | |
{ |
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
public class CounterView : View | |
{ | |
readonly State<int> count = 0; | |
readonly State<int> step = 1; | |
readonly State<bool> timerOn = false; | |
void init() | |
{ | |
count.Value = 1; | |
step.Value = 0; | |
timerOn.Value = false; |
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 uses Records to make the code smaller, even though it doesnt come out until C# 9 | |
//IT also uses a new abstract class, that shouldnt count against it's line count: https://gist.github.com/Clancey/1df421c93ee20832d793a96b30fec997 | |
public data class Model | |
{ | |
public int Count { get; set; } | |
public int Step { get; set; } | |
public bool TimerOn { get; set; } | |
} | |
public enum Msg | |
{ |
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
public class Testclass { | |
Action<bool> MyAction { get; set; } | |
Func<Task<bool>> MyAwaitedAction { get; set; } | |
public async Task AsyncTestMethod() | |
{ | |
MyAction += (result) => { | |
Console.WriteLine(result); | |
}; | |
MyAwaitedAction += () => { |
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
<configuration> | |
<packageSources> | |
<clear /> | |
<add key="github" value="https://nuget.pkg.github.com/Clancey/index.json" /> | |
</packageSources> | |
<packageSourceCredentials> | |
<github> | |
<add key="Username" value="GithubNugetAccess" /> | |
<add key="ClearTextPassword" value="a31f402ea9872240db9f947422c210177e2bb017" /> | |
</github> |
NewerOlder