1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.Tests;
namespace Xamarin.PropertyEditing.Windows.Standalone
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow ()
{
InitializeComponent ();
var resources = new MockResourceProvider();
this.panel.TargetPlatform = new TargetPlatform (new MockEditorProvider (resources), resources, new MockBindingProvider()) {
SupportsCustomExpressions = true,
SupportsMaterialDesign = true,
SupportsBrushOpacity = false,
GroupedTypes = new Dictionary<Type, string> {
{ typeof(CommonBrush), "Brush" }
},
AutoExpandGroups = new[] { "ReadWrite" }
};
#if USE_VS_ICONS
this.panel.Resources.MergedDictionaries.Add (new ResourceDictionary {
Source = new Uri ("pack://application:,,,/ProppyIcons.xaml", UriKind.RelativeOrAbsolute)
});
#endif
}
private async void Button_Click (object sender, RoutedEventArgs e)
{
object inspectedObject;
if (!(sender is IMockedControl mockedControl) || mockedControl.MockedControl == null) {
inspectedObject = sender;
} else {
inspectedObject = mockedControl.MockedControl;
if (mockedControl is MockedSampleControlButton mockedButton) {
IObjectEditor editor = await this.panel.TargetPlatform.EditorProvider.GetObjectEditorAsync (inspectedObject);
await mockedButton.MockedControl.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB"));
await mockedButton.MockedControl.SetMaterialDesignBrushInitialValueAsync (editor, new CommonSolidBrush (0x65, 0x1F, 0xFF, 200));
await mockedButton.MockedControl.SetReadOnlyBrushInitialValueAsync (editor, new CommonSolidBrush (240, 220, 15, 190));
}
}
if (this.panel.SelectedItems.Contains (inspectedObject))
this.panel.SelectedItems.Remove (inspectedObject);
else
this.panel.SelectedItems.Add (inspectedObject);
}
private void Theme_Click (object sender, RoutedEventArgs e)
{
if (e.Source is RadioButton rb) {
switch (rb.Content.ToString()) {
case "Dark Theme":
PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Dark;
break;
case "Light Theme":
PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Light;
break;
default:
PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.None;
break;
}
}
}
}
}
|