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
<Style x:Key="TreeViewStyle1" TargetType="TreeView"> | |
<Setter Property="IsTabStop" Value="False"/> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="TreeView"> | |
<TreeViewList x:Name="ListControl" AllowDrop="False" | |
CanReorderItems="False" | |
CanDragItems="False" | |
ItemContainerStyle="{StaticResource TreeViewItemStyle}" | |
ItemTemplate="{StaticResource CultureItemDataTemplate}"> |
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 CulturesViewModel : INotifyPropertyChanged | |
{ | |
public CulturesViewModel() => SetupCultures(); | |
// ... INotifyPropertyChanged Implementation | |
private void SetupCultures() | |
{ | |
var cultureDataDict = CultureInfo.GetCultures(CultureTypes.AllCultures) | |
.OrderBy(c => c.Name) |
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
private ServiceProvider ConfigureServices() | |
{ | |
var services = new ServiceCollection(); | |
services.AddLogging(builder => | |
{ | |
builder.AddFilter((category, level) => true); | |
builder.AddConsole(options => options.IncludeScopes = true); | |
}); | |
services.AddHttpClient("cni", client => | |
{ |
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
static string M2(Shape shape) | |
=> shape switch | |
{ | |
Shape s when s.Size.height > 100 => $"large shape with size {s.Size} at position {s.Position}", | |
Ellipse e => $"Ellipse with size {e.Size} at position {e.Position}", | |
Rectangle r => $"Rectangle with size {r.Size} at position {r.Position}", | |
_ => "another shape" | |
}; |
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
@page "/books" | |
@using BooksLib | |
@inject HttpClient Http | |
<h1>Books Sample</h1> | |
<p>This component demonstrates fetching data from Azure Functions.</p> | |
<p>Status: @message</p> |
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 static class BooksFunction | |
{ | |
[FunctionName("BooksFunction")] | |
public static IActionResult Run( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequest req, TraceWriter log) | |
{ | |
log.Info("C# HTTP trigger function processed a request."); | |
return new OkObjectResult(GetBooks()); | |
} |
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 Book | |
{ | |
public Book() { } | |
public Book(int bookId, string title, string publisher) | |
=> (BookId, Title, Publisher) = (bookId, title, publisher); | |
public int BookId { get; set; } | |
public string Title { get; set; } | |
public string Publisher { get; set; } |
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
static string M3(Shape shape) | |
=> shape switch | |
{ | |
CombinedShape (var shape1, var (pos, _)) => $"combined shape - shape1: {shape1.Name}, pos of shape2: {pos}", | |
{ Size: (200, 200), Position: var pos } => $"shape with size 200x200 at position {pos.x}:{pos.y}", | |
Ellipse (var pos, var size) => $"Ellipse with size {size} at position {pos}", | |
Rectangle (_, var size) => $"Rectangle with size {size}", | |
_ => "another shape" | |
}; |
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
static void Main() | |
{ | |
var r1 = new Rectangle(position: (200, 200), size: (200, 200)); | |
var e1 = new Ellipse(position: (80, 1400), size: (80, 140)); | |
var shapes = new Shape[] | |
{ | |
r1, | |
e1, | |
new Circle((40, 60), 90), | |
new CombinedShape(r1, e1) |
NewerOlder