MCPcopy Create free account
hub / github.com/GPUOpen-Tools/GPU-Reshape / Build

Method Build

Source/UIX/Studio/ViewLocator.cs:37–61  ·  view source on GitHub ↗
(object data)

Source from the content-addressed store, hash-verified

35 public class ViewLocator : IDataTemplate
36 {
37 public Control Build(object data)
38 {
39 var name = data.GetType().FullName?.Replace("ViewModel", "View");
40 if (name is null)
41 {
42 return new TextBlock { Text = "Invalid Data Type" };
43 }
44 var type = Type.GetType(name);
45 if (type is { })
46 {
47 var instance = Activator.CreateInstance(type);
48 if (instance is { })
49 {
50 return (Control)instance;
51 }
52 else
53 {
54 return new TextBlock { Text = "Create Instance Failed: " + type.FullName };
55 }
56 }
57 else
58 {
59 return new TextBlock { Text = "Not Found: " + name };
60 }
61 }
62
63 public bool Match(object data)
64 {

Callers

nothing calls this directly

Calls 2

GetTypeMethod · 0.45
CreateInstanceMethod · 0.45

Tested by

no test coverage detected