Skip to content

Commit dbd379c

Browse files
authored
Merge branch 'dev/split-controls' into test-chop-imageex
2 parents 0ad2fc9 + be2ebd7 commit dbd379c

File tree

1 file changed

+20
-98
lines changed
  • Microsoft.Toolkit.Uwp.SampleApp/Models

1 file changed

+20
-98
lines changed

Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs

Lines changed: 20 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -629,108 +629,30 @@ public async Task PreparePropertyDescriptorAsync()
629629
private static Type LookForTypeByName(string typeName)
630630
{
631631
// First search locally
632-
var result = System.Type.GetType(typeName);
633-
634-
if (result != null)
632+
if (System.Type.GetType(typeName) is Type systemType)
635633
{
636-
return result;
634+
return systemType;
637635
}
638636

639-
// Search in Windows
640-
var proxyType = VerticalAlignment.Center;
641-
var assembly = proxyType.GetType().GetTypeInfo().Assembly;
642-
643-
foreach (var typeInfo in assembly.ExportedTypes)
637+
var targets = new Type[]
644638
{
645-
if (typeInfo.Name == typeName)
646-
{
647-
return typeInfo;
648-
}
649-
}
650-
651-
// Search in Microsoft.Toolkit.Uwp.UI.Controls
652-
var controlsProxyType = GridSplitter.GridResizeDirection.Auto;
653-
assembly = controlsProxyType.GetType().GetTypeInfo().Assembly;
654-
655-
foreach (var typeInfo in assembly.ExportedTypes)
656-
{
657-
if (typeInfo.Name == typeName)
658-
{
659-
return typeInfo;
660-
}
661-
}
662-
663-
// TODO Reintroduce graph controls
664-
//// Search in Microsoft.Toolkit.Graph.Controls
665-
//var graphControlsProxyType = typeof(UserToPersonConverter);
666-
//assembly = graphControlsProxyType.GetTypeInfo().Assembly;
667-
668-
//foreach (var typeInfo in assembly.ExportedTypes)
669-
//{
670-
// if (typeInfo.Name == typeName)
671-
// {
672-
// return typeInfo;
673-
// }
674-
//}
675-
676-
// Search in Microsoft.Toolkit.Uwp.UI.Animations
677-
var animationsProxyType = EasingType.Default;
678-
assembly = animationsProxyType.GetType().GetTypeInfo().Assembly;
679-
foreach (var typeInfo in assembly.ExportedTypes)
680-
{
681-
if (typeInfo.Name == typeName)
682-
{
683-
return typeInfo;
684-
}
685-
}
686-
687-
// Search in Microsoft.Toolkit.Uwp.UI
688-
var uiProxyType = ImageBlendMode.Multiply;
689-
assembly = uiProxyType.GetType().GetTypeInfo().Assembly;
690-
foreach (var typeInfo in assembly.ExportedTypes)
691-
{
692-
if (typeInfo.Name == typeName)
693-
{
694-
return typeInfo;
695-
}
696-
}
697-
698-
// Search in Microsoft.Toolkit.Uwp.Input.GazeInteraction
699-
var gazeType = Interaction.Enabled;
700-
assembly = gazeType.GetType().GetTypeInfo().Assembly;
701-
foreach (var typeInfo in assembly.ExportedTypes)
702-
{
703-
if (typeInfo.Name == typeName)
704-
{
705-
return typeInfo;
706-
}
707-
}
708-
709-
// Search in Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
710-
var dataGridProxyType = DataGridGridLinesVisibility.None;
711-
assembly = dataGridProxyType.GetType().GetTypeInfo().Assembly;
712-
713-
foreach (var typeInfo in assembly.ExportedTypes)
714-
{
715-
if (typeInfo.Name == typeName)
716-
{
717-
return typeInfo;
718-
}
719-
}
720-
721-
// Search in Microsoft.Toolkit.Uwp.UI.Controls.Markdown
722-
var markdownTextBlockType = typeof(MarkdownTextBlock);
723-
assembly = markdownTextBlockType.GetTypeInfo().Assembly;
724-
725-
foreach (var typeInfo in assembly.ExportedTypes)
726-
{
727-
if (typeInfo.Name == typeName)
728-
{
729-
return typeInfo;
730-
}
731-
}
732-
733-
return null;
639+
VerticalAlignment.Center.GetType(), // Windows
640+
StackMode.Replace.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.Core
641+
642+
// TODO Reintroduce graph controls
643+
// typeof(UserToPersonConverter)) // Search in Microsoft.Toolkit.Graph.Controls
644+
EasingType.Default.GetType(), // Microsoft.Toolkit.Uwp.UI.Animations
645+
ImageBlendMode.Multiply.GetType(), // Search in Microsoft.Toolkit.Uwp.UI
646+
Interaction.Enabled.GetType(), // Microsoft.Toolkit.Uwp.Input.GazeInteraction
647+
DataGridGridLinesVisibility.None.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
648+
GridSplitter.GridResizeDirection.Auto.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.Layout
649+
typeof(MarkdownTextBlock), // Microsoft.Toolkit.Uwp.UI.Controls.Markdown
650+
BitmapFileFormat.Bmp.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.Media
651+
StretchChild.Last.GetType() // Microsoft.Toolkit.Uwp.UI.Controls.Primitivs
652+
};
653+
654+
return targets.SelectMany(t => t.Assembly.ExportedTypes)
655+
.FirstOrDefault(t => t.Name == typeName);
734656
}
735657

736658
private static async Task<string> GetDocsSHA()

0 commit comments

Comments
 (0)