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
|
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 ();
this.panel.TargetPlatform = new TargetPlatform {
SupportsCustomExpressions = true,
GroupedTypes = new Dictionary<Type, string> {
{ typeof(CommonBrush), "Brush" }
}
};
this.panel.EditorProvider = new MockEditorProvider ();
this.panel.ResourceProvider = new MockResourceProvider ();
}
private async void Button_Click (object sender, RoutedEventArgs e)
{
var mockedControl = sender as IMockedControl;
object inspectedObject;
if (mockedControl == null || mockedControl.MockedControl == null) {
inspectedObject = sender;
} else {
inspectedObject = mockedControl.MockedControl;
if (mockedControl is MockedSampleControlButton mockedButton) {
IObjectEditor editor = await this.panel.EditorProvider.GetObjectEditorAsync (inspectedObject);
await mockedButton.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB"));
await mockedButton.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)
{
var rb = e.Source as RadioButton;
if (rb != null) {
if (rb.Content.ToString ().Equals ("Dark Theme")) {
PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Dark;
} else {
PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Light;
}
}
}
}
}
|