├── LICENSE
├── ekUiGen
├── New EmptyKeys UI.zip
├── packages.config
├── App.config
├── SpriteFontTemplate.pdxfnt
├── Properties
│ └── AssemblyInfo.cs
├── SpriteFontTemplate.xkfnt
├── SpriteFontTemplate.xml
├── EmptyKeys.UserInterface.targets
└── ekUiGen.csproj
├── EmptyKeys.UserInterface.Designer
├── Effects
│ ├── FakeShader.ps
│ ├── CompileShader.bat
│ ├── FakeShader.fx
│ ├── CustomEffect.cs
│ └── DirectionalBlurEffect.cs
├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ ├── Settings.Designer.cs
│ └── Resources.Designer.cs
├── Interactions
│ ├── Action.cs
│ ├── Behavior.cs
│ ├── ActionCollection.cs
│ ├── BehaviorCollection.cs
│ ├── PlaySoundAction.cs
│ ├── CallMethodAction.cs
│ └── Interaction.cs
├── SoundSourceCollection.cs
├── GeneratedBindingsMode.cs
├── Charts
│ ├── SeriesPointCollection.cs
│ └── SeriesPoint.cs
├── ScrollViewerAction.cs
├── RoutedEvents.cs
├── ImageBrush.cs
├── EmptyKeys.UserInterface.Designer.csproj
├── SoundType.cs
├── ScrollViewerHelper.cs
├── Input
│ ├── GamepadGesture.cs
│ └── GamepadInput.cs
├── PasswordBox.cs
├── DragDrop.cs
├── DataGrid.cs
├── SoundManager.cs
└── AnimatedImage.cs
├── README.md
├── UIGenerator
├── Properties
│ └── AssemblyInfo.cs
├── Types
│ ├── CheckBoxGeneratorType.cs
│ ├── CustomUserControlGeneratorType.cs
│ ├── Controls
│ │ ├── RadialPanelGeneratorType.cs
│ │ ├── GroupBoxGeneratorType.cs
│ │ ├── TreeViewGeneratorType.cs
│ │ ├── Primitives
│ │ │ └── TabPanelGeneratorType.cs
│ │ ├── CanvasGeneratorType.cs
│ │ ├── DataGridTextColumnGeneratorType.cs
│ │ ├── TreeViewItemGeneratorType.cs
│ │ ├── DataGridCheckBoxColumnGeneratorType.cs
│ │ ├── RadioButtonGeneratorType.cs
│ │ ├── DockPanelGeneratorType.cs
│ │ ├── DataGridTemplateColumnGeneratorType.cs
│ │ ├── WrapPanelGeneratorType.cs
│ │ ├── UniformGridGeneratorType.cs
│ │ ├── HeaderedItemsControlGeneratorType.cs
│ │ └── DataGridBoundColumnGeneratorType.cs
│ ├── ThumbGeneratorType.cs
│ ├── Shapes
│ │ ├── EllipseGeneratorType.cs
│ │ ├── RectangleGeneratorType.cs
│ │ ├── LineGeneratorType.cs
│ │ ├── ShapeGeneratorType.cs
│ │ └── PathGeneratorType.cs
│ ├── UserControlGeneratorType.cs
│ ├── ListBoxGeneratorType.cs
│ ├── PasswordBoxGeneratorType.cs
│ ├── ProgressBarGeneratorType.cs
│ ├── ComboBoxGeneratorType.cs
│ ├── ScrollContentPresenterGeneratorType.cs
│ ├── TabItemGeneratorType.cs
│ ├── ListBoxItemGeneratorType.cs
│ ├── TabControlGeneratorType.cs
│ ├── StackPanelGeneratorType.cs
│ ├── ComboBoxItemGeneratorType.cs
│ ├── RepeatButtonGeneratorType.cs
│ ├── SelectorGeneratorType.cs
│ ├── ExpanderGeneratorType.cs
│ ├── ScrollBarGeneratorType.cs
│ ├── TextBoxGeneratorType.cs
│ ├── SliderGeneratorType.cs
│ ├── ToggleButtonGeneratorType.cs
│ ├── CustomPasswordBoxGeneratorType.cs
│ ├── AnimatedImageGeneratorType.cs
│ ├── ImageGeneratorType.cs
│ ├── RangeBaseGeneratorType.cs
│ ├── ButtonGeneratorType.cs
│ ├── ScrollViewerGeneratorType.cs
│ ├── NumericTextBoxGeneratorType.cs
│ ├── HeaderedContentControlGeneratorType.cs
│ ├── TextBoxBaseGeneratorType.cs
│ ├── PanelGeneratorType.cs
│ └── Charts
│ │ └── LineSeries2DGeneratorType.cs
├── RenderMode.cs
├── IGeneratorValue.cs
├── Values
│ ├── PrimitiveGeneratorValue.cs
│ ├── FontFamilyGeneratorValue.cs
│ ├── BrushGeneratorValue.cs
│ ├── BitmapImageGeneratorValue.cs
│ ├── ResourceExtGeneratorValue.cs
│ ├── ColorGeneratorValue.cs
│ ├── FontWeightGeneratorValue.cs
│ ├── LineGeometryGeneratorValue.cs
│ ├── SoundSourceGeneratorValue.cs
│ ├── Effects
│ │ ├── CustomEffectGeneratorValue.cs
│ │ └── DirectionalBlurEffectGeneratorValue.cs
│ ├── EllipseGeometryGeneratorValue.cs
│ ├── RectangleGeometryGeneratorValue.cs
│ ├── ItemsPanelTemplateGeneratorValue.cs
│ ├── ThicknessAnimationGeneratorValue.cs
│ ├── DoubleAnimationGeneratorValue.cs
│ ├── ThicknessGeneratorValue.cs
│ ├── SolidColorBrushAnimGeneratorValue.cs
│ └── DataTemplateGeneratorValue.cs
├── IGeneratorType.cs
├── EmptyKeys.UserInterface.Generator.csproj
└── EffectAssets.cs
├── GlobalAssemblyInfo.cs
└── EmptyKeys.UserInterface.Generator.sln
/LICENSE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmptyKeys/UI_Generator/HEAD/LICENSE
--------------------------------------------------------------------------------
/ekUiGen/New EmptyKeys UI.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmptyKeys/UI_Generator/HEAD/ekUiGen/New EmptyKeys UI.zip
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Effects/FakeShader.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmptyKeys/UI_Generator/HEAD/EmptyKeys.UserInterface.Designer/Effects/FakeShader.ps
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Effects/CompileShader.bat:
--------------------------------------------------------------------------------
1 | "C:\Program Files (x86)\Windows Kits\10\bin\x64\fxc.exe" /T ps_2_0 /E main /Fo "FakeShader.ps" "FakeShader.fx"
2 |
--------------------------------------------------------------------------------
/ekUiGen/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ekUiGen/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UI_Generator
2 | ============
3 |
4 | User Interface Generator for Empty Keys UI library. Generator takes XAML files and generates .cs files for each. It can generate UIRoot, UserControl or ResourceDictionary XAML files.
5 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Interactions/Action.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | namespace EmptyKeys.UserInterface.Designer.Interactions
9 | {
10 | public class Action : DependencyObject
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Interactions/Behavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | namespace EmptyKeys.UserInterface.Designer.Interactions
9 | {
10 | public class Behavior : DependencyObject
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ekUiGen/SpriteFontTemplate.pdxfnt:
--------------------------------------------------------------------------------
1 | !SpriteFont
2 | Id: {3}
3 | Tags: []
4 | Source:
5 | FontName: {0}
6 | Size: {1}
7 | Style: {2}
8 | IsDynamic: false
9 | DefaultCharacter: '*'
10 | CharacterSet:
11 | CharacterRegions:
12 | - Start: ' '
13 | End: "\x7F"
14 | AntiAlias: ClearType
15 | NoPremultiply: false
16 | Spacing: 0.0
17 | LineSpacing: 0.0
18 | UseKerning: true
19 |
--------------------------------------------------------------------------------
/ekUiGen/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("Empty Keys User Interface Generator Console")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyProduct("ekUiGen")]
8 | [assembly: AssemblyCulture("")]
9 |
10 | [assembly: ComVisible(false)]
11 | [assembly: CLSCompliant(false)]
--------------------------------------------------------------------------------
/UIGenerator/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("Empty Keys User Interface Generator")]
6 | [assembly: AssemblyDescription("Empty Keys User Interface Generator")]
7 | [assembly: AssemblyProduct("UIGenerator")]
8 | [assembly: AssemblyCulture("")]
9 |
10 | [assembly: ComVisible(false)]
11 | [assembly: CLSCompliant(false)]
--------------------------------------------------------------------------------
/ekUiGen/SpriteFontTemplate.xkfnt:
--------------------------------------------------------------------------------
1 | !SpriteFont
2 | Id: {3}
3 | SerializedVersion: {5}
4 | Tags: []
5 | FontSource: !SystemFontProvider
6 | FontName: {0}
7 | Style: {2}
8 | FontType: !OfflineRasterizedSpriteFontType
9 | Size: {1}
10 | CharacterSet:
11 | CharacterRegions:
12 | {4}:
13 | Start: ' '
14 | End: ""
15 | AntiAlias: ClearType
16 | DefaultCharacter: '*'
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Interactions/ActionCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer.Interactions
8 | {
9 | public class ActionCollection : List
10 | {
11 | public ActionCollection()
12 | : base()
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Interactions/BehaviorCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer.Interactions
8 | {
9 | public class BehaviorCollection : List
10 | {
11 | public BehaviorCollection()
12 | : base()
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GlobalAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 |
4 | #if DEBUG
5 | [assembly: AssemblyConfiguration("Debug")]
6 | #else
7 | [assembly: AssemblyConfiguration("Release")]
8 | #endif
9 |
10 | [assembly: AssemblyCompany("Empty Keys")]
11 | [assembly: AssemblyCopyright("Copyright © 2016-2025 Empty Keys, Filip Dušek")]
12 | [assembly: AssemblyTrademark("Empty Keys ™")]
13 |
14 | [assembly: NeutralResourcesLanguage("en")]
15 |
16 | [assembly: AssemblyVersion("4.0.0.0")]
17 | [assembly: AssemblyFileVersion("4.0.0.0")]
18 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/SoundSourceCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer
8 | {
9 | ///
10 | /// Fake implementations for WPF designer
11 | ///
12 | public class SoundSourceCollection : List
13 | {
14 | ///
15 | /// Initializes a new instance of the class.
16 | ///
17 | public SoundSourceCollection()
18 | : base()
19 | {
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/GeneratedBindingsMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer
8 | {
9 | ///
10 | /// Describes modes for binding generator
11 | ///
12 | public enum GeneratedBindingsMode
13 | {
14 | // Bindings are generated
15 | Generated,
16 | // Bindings are ignored and using reflection
17 | Reflection,
18 | // Bindings can use both, reflection and generated
19 | Mixed,
20 | // Bindings with custom type
21 | Manual
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Charts/SeriesPointCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer.Charts
8 | {
9 | ///
10 | /// Implements fake designer collection for SeriesPoints
11 | ///
12 | public class SeriesPointCollection : List
13 | {
14 | ///
15 | /// Initializes a new instance of the class.
16 | ///
17 | public SeriesPointCollection()
18 | : base()
19 | {
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ekUiGen/SpriteFontTemplate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {0}
6 |
7 | {1}
8 | 0
9 | true
10 |
11 |
12 | *
13 |
14 |
15 |
16 | ſ
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/UIGenerator/Types/CheckBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Controls;
7 |
8 | namespace EmptyKeys.UserInterface.Generator.Types
9 | {
10 | ///
11 | /// Implements Check Box control generator
12 | ///
13 | public class CheckBoxGeneratorType : ToggleButtonGeneratorType
14 | {
15 | ///
16 | /// Gets the type of the xaml.
17 | ///
18 | ///
19 | /// The type of the xaml.
20 | ///
21 | public override Type XamlType
22 | {
23 | get
24 | {
25 | return typeof(CheckBox);
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ekUiGen/EmptyKeys.UserInterface.targets:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | $(ProjectDir)UI\Views
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/UIGenerator/RenderMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Generator
8 | {
9 | ///
10 | /// Render modes
11 | ///
12 | public enum RenderMode
13 | {
14 | ///
15 | /// Synapse Gaming Sunburn engine
16 | ///
17 | SunBurn,
18 |
19 | ///
20 | /// MonoGame
21 | ///
22 | MonoGame,
23 |
24 | ///
25 | /// FNA
26 | ///
27 | FNA,
28 |
29 | ///
30 | /// Cocos Sharp
31 | ///
32 | CocosSharp,
33 |
34 | ///
35 | /// Xenko engine
36 | ///
37 | Xenko
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 | using System.Windows;
5 |
6 | [assembly: AssemblyTitle("EmptyKeys.UserInterface.Designer")]
7 | [assembly: AssemblyDescription("Empty Keys UI WPF Designer library")]
8 | [assembly: AssemblyProduct("EmptyKeys.UserInterface.Designer")]
9 | [assembly: AssemblyCulture("")]
10 |
11 | [assembly: ComVisible(false)]
12 | [assembly: CLSCompliant(false)]
13 |
14 | [assembly:ThemeInfo(
15 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
16 | //(used if a resource is not found in the page,
17 | // or application resource dictionaries)
18 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
19 | //(used if a resource is not found in the page,
20 | // app, or any theme specific resource dictionaries)
21 | )]
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Interactions/PlaySoundAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | namespace EmptyKeys.UserInterface.Designer.Interactions
9 | {
10 | public class PlaySoundAction : Action
11 | {
12 | ///
13 | /// The source property
14 | ///
15 | public static readonly DependencyProperty SourceProperty =
16 | DependencyProperty.Register("Source", typeof(SoundSource), typeof(PlaySoundAction),
17 | new FrameworkPropertyMetadata(null));
18 |
19 | ///
20 | /// Gets or sets the source.
21 | ///
22 | ///
23 | /// The source.
24 | ///
25 | public SoundSource Source
26 | {
27 | get { return (SoundSource)GetValue(SourceProperty); }
28 | set { SetValue(SourceProperty, value); }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/ScrollViewerAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer
8 | {
9 | ///
10 | /// Describes actions for Scroll Viewer
11 | ///
12 | public enum ScrollViewerAction
13 | {
14 | ///
15 | /// The none
16 | ///
17 | None,
18 |
19 | ///
20 | /// The scroll to bottom
21 | ///
22 | ScrollToBottom,
23 |
24 | ///
25 | /// The scroll to top
26 | ///
27 | ScrollToTop,
28 |
29 | ///
30 | /// The scroll to left
31 | ///
32 | ScrollToLeft,
33 |
34 | ///
35 | /// The scroll to right
36 | ///
37 | ScrollToRight,
38 |
39 | ///
40 | /// The scroll to point
41 | ///
42 | ScrollToPoint
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Effects/FakeShader.fx:
--------------------------------------------------------------------------------
1 | //--------------------------------------------------------------------------------------
2 | //
3 | // Fake shader
4 | //
5 | //--------------------------------------------------------------------------------------
6 |
7 | //-----------------------------------------------------------------------------------------
8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.)
9 | //-----------------------------------------------------------------------------------------
10 |
11 | //--------------------------------------------------------------------------------------
12 | // Sampler Inputs (Brushes, including ImplicitInput)
13 | //--------------------------------------------------------------------------------------
14 |
15 | sampler2D implicitInputSampler : register(S0);
16 |
17 | //--------------------------------------------------------------------------------------
18 | // Pixel Shader
19 | //--------------------------------------------------------------------------------------
20 |
21 | float4 main(float2 uv : TEXCOORD) : COLOR
22 | {
23 | float4 color = tex2D(implicitInputSampler, uv);
24 | return color;
25 | }
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EmptyKeys.UserInterface.Designer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/RoutedEvents.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | namespace EmptyKeys.UserInterface.Designer
9 | {
10 | public class RoutedEvents : UIElement
11 | {
12 | ///
13 | /// The visible event
14 | ///
15 | public static readonly RoutedEvent VisibleEvent;
16 |
17 | ///
18 | /// The hidden event
19 | ///
20 | public static readonly RoutedEvent HiddenEvent;
21 |
22 | ///
23 | /// The collapsed event
24 | ///
25 | public static readonly RoutedEvent CollapsedEvent;
26 |
27 | static RoutedEvents()
28 | {
29 | VisibleEvent = EventManager.RegisterRoutedEvent("Visible", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(RoutedEvents));
30 | HiddenEvent = EventManager.RegisterRoutedEvent("Hidden", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(RoutedEvents));
31 | CollapsedEvent = EventManager.RegisterRoutedEvent("Collapsed", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(RoutedEvents));
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/UIGenerator/Types/CustomUserControlGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Generator.Types
8 | {
9 | ///
10 | /// Implements fake generator for custom User Controls (in data templates for MVVM support)
11 | ///
12 | public class CustomUserControlGeneratorType : ContentControlGeneratorType
13 | {
14 | ///
15 | /// Gets the type of the xaml.
16 | ///
17 | ///
18 | /// The type of the xaml.
19 | ///
20 | public override Type XamlType
21 | {
22 | get
23 | {
24 | return this.GetType();
25 | }
26 | }
27 |
28 | ///
29 | /// Gets the children.
30 | ///
31 | /// source
32 | ///
33 | public override System.Collections.IEnumerable GetChildren(System.Windows.DependencyObject source)
34 | {
35 | // we don't have to generate children, because custom user control is already generated
36 | return null;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/UIGenerator/IGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace EmptyKeys.UserInterface.Generator
10 | {
11 | ///
12 | /// Describes generator value interface
13 | ///
14 | public interface IGeneratorValue
15 | {
16 | ///
17 | /// Gets the type of the value.
18 | ///
19 | ///
20 | /// The type of the value.
21 | ///
22 | Type ValueType
23 | {
24 | get;
25 | }
26 |
27 | ///
28 | /// Generates code for value
29 | ///
30 | /// The parent class.
31 | /// The method.
32 | /// The value.
33 | /// Name of the base.
34 | /// The dictionary.
35 | ///
36 | CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/ImageBrush.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Media;
8 |
9 | namespace EmptyKeys.UserInterface.Designer
10 | {
11 | ///
12 | /// Implements fake designer class for Image Brush
13 | ///
14 | public static class ImageBrush
15 | {
16 | ///
17 | /// The color overlay property
18 | ///
19 | public static readonly DependencyProperty ColorOverlayProperty =
20 | DependencyProperty.RegisterAttached("ColorOverlay", typeof(Color), typeof(ImageBrush),
21 | new FrameworkPropertyMetadata(Color.FromArgb(255,255,255,255)));
22 |
23 | ///
24 | /// Gets the color overlay.
25 | ///
26 | /// The object.
27 | ///
28 | public static Color GetColorOverlay(DependencyObject obj)
29 | {
30 | return (Color)obj.GetValue(ColorOverlayProperty);
31 | }
32 |
33 | ///
34 | /// Sets the color overlay.
35 | ///
36 | /// The object.
37 | /// The value.
38 | public static void SetColorOverlay(DependencyObject obj, Color value)
39 | {
40 | obj.SetValue(ColorOverlayProperty, value);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/RadialPanelGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using EmptyKeys.UserInterface.Designer;
2 | using System;
3 | using System.CodeDom;
4 | using System.Windows;
5 |
6 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
7 | {
8 | ///
9 | /// Implements generator for Radial Panel
10 | ///
11 | ///
12 | public class RadialPanelGeneratorType : PanelGeneratorType
13 | {
14 | ///
15 | /// Gets the type of the xaml.
16 | ///
17 | ///
18 | /// The type of the xaml.
19 | ///
20 | public override Type XamlType
21 | {
22 | get { return typeof(RadialPanel); }
23 | }
24 |
25 | ///
26 | /// Generates the specified initialize method.
27 | ///
28 | /// The dependency object
29 | /// Type of the class.
30 | /// The initialize method.
31 | /// if set to true [generate field].
32 | ///
33 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
34 | {
35 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
36 |
37 | return fieldReference;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/UIGenerator/Values/PrimitiveGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace EmptyKeys.UserInterface.Generator.Values
10 | {
11 | ///
12 | /// Implements generator for all primitive types
13 | ///
14 | ///
15 | public class PrimitiveGeneratorValue : IGeneratorValue
16 | {
17 | ///
18 | /// Gets the type of the value.
19 | ///
20 | ///
21 | /// The type of the value.
22 | ///
23 | public Type ValueType
24 | {
25 | get
26 | {
27 | return typeof(T);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code for value
33 | ///
34 | /// The parent class.
35 | /// The method.
36 | /// The value.
37 | /// Name of the base.
38 | /// The dictionary.
39 | ///
40 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
41 | {
42 | return new CodePrimitiveExpression(value);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/EmptyKeys.UserInterface.Designer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0-windows
4 | Library
5 | SAK
6 | SAK
7 | SAK
8 | SAK
9 | false
10 | true
11 | true
12 | AppStore;Debug;Release;Testing
13 |
14 |
15 | bin\x64\Debug\
16 | MinimumRecommendedRules.ruleset
17 |
18 |
19 | bin\x64\Release\
20 | MinimumRecommendedRules.ruleset
21 |
22 |
23 |
24 | Properties\GlobalAssemblyInfo.cs
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/GroupBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements Group Box control generator
14 | ///
15 | public class GroupBoxGeneratorType : HeaderedContentControlGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(GroupBox);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | ///
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 | return fieldReference;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ThumbGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls.Primitives;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements UI generator for Thumb WPF control
14 | ///
15 | public class ThumbGeneratorType : ControlGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(Thumb);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates the specified source.
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | /// The method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
42 |
43 | return fieldReference;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/UIGenerator/Values/FontFamilyGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Values
11 | {
12 | ///
13 | /// Implements generator for Font Family value
14 | ///
15 | public class FontFamilyGeneratorValue : IGeneratorValue
16 | {
17 | ///
18 | /// Gets the type of the value.
19 | ///
20 | ///
21 | /// The type of the value.
22 | ///
23 | public Type ValueType
24 | {
25 | get
26 | {
27 | return typeof(FontFamily);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code for value
33 | ///
34 | /// The parent class.
35 | /// The method.
36 | /// The value.
37 | /// Name of the base.
38 | /// The dictionary.
39 | ///
40 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
41 | {
42 | FontFamily fontFamily = value as FontFamily;
43 | return CodeComHelper.GenerateFontFamilyExpression(fontFamily);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Shapes/EllipseGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Shapes;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Shapes
11 | {
12 | ///
13 | /// Implements Ellipse shape type generator
14 | ///
15 | public class EllipseGeneratorType : ShapeGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get { return typeof(Ellipse); }
26 | }
27 |
28 | ///
29 | /// Generates control fields
30 | ///
31 | /// The source.
32 | /// Type of the class.
33 | /// The initialize method.
34 | /// if set to true [generate field].
35 | ///
36 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
37 | {
38 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
39 |
40 | Ellipse ellipse = source as Ellipse;
41 |
42 | return fieldReference;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/TreeViewGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements Tree View control generator
14 | ///
15 | public class TreeViewGeneratorType : ItemsControlGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(TreeView);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | ///
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 | TreeView treeView = source as TreeView;
43 | return fieldReference;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/UIGenerator/Values/BrushGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Values
11 | {
12 | ///
13 | /// Implements generator for all brushes
14 | ///
15 | ///
16 | public class BrushGeneratorValue : IGeneratorValue
17 | {
18 | ///
19 | /// Gets the type of the value.
20 | ///
21 | ///
22 | /// The type of the value.
23 | ///
24 | public Type ValueType
25 | {
26 | get
27 | {
28 | return typeof(T);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates the specified parent class.
34 | ///
35 | /// The parent class.
36 | /// The method.
37 | /// The value.
38 | /// Name of the base.
39 | /// The dictionary.
40 | ///
41 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
42 | {
43 | string brushVarName = baseName + "_b";
44 | return CodeComHelper.GenerateBrushInstance(method, value as Brush, brushVarName);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/Primitives/TabPanelGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls.Primitives;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls.Primitives
11 | {
12 | ///
13 | /// Implements generator for TabPanel
14 | ///
15 | public class TabPanelGeneratorType : PanelGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get { return typeof(TabPanel); }
26 | }
27 |
28 | ///
29 | /// Generates the specified initialize method.
30 | ///
31 | /// The dependency object
32 | /// Type of the class.
33 | /// The initialize method.
34 | /// if set to true [generate field].
35 | ///
36 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
37 | {
38 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
39 |
40 | TabPanel tabPanel = source as TabPanel;
41 |
42 | return fieldReference;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/CanvasGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Media;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
13 | {
14 | ///
15 | /// Implements Canvas control generator
16 | ///
17 | public class CanvasGeneratorType : PanelGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get { return typeof(Canvas); }
28 | }
29 |
30 | ///
31 | /// Generates the specified initialize method.
32 | ///
33 | /// The dependency object
34 | /// Type of the class.
35 | /// The initialize method.
36 | /// if set to true [generate field].
37 | ///
38 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
39 | {
40 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
41 | Canvas canvas = source as Canvas;
42 | return fieldReference;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/SoundType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EmptyKeys.UserInterface.Designer
8 | {
9 | ///
10 | /// Sound Types for UI
11 | ///
12 | public enum SoundType
13 | {
14 | ///
15 | ///
16 | ///
17 | None,
18 |
19 | ///
20 | /// The buttons click
21 | ///
22 | ButtonsClick,
23 |
24 | ///
25 | /// The buttons hover sound
26 | ///
27 | ButtonsHover,
28 |
29 | ///
30 | /// The ListBox move
31 | ///
32 | ListBoxMove,
33 |
34 | ///
35 | /// The ListBox select
36 | ///
37 | ListBoxSelect,
38 |
39 | ///
40 | /// The text box key press
41 | ///
42 | TextBoxKeyPress,
43 |
44 | ///
45 | /// The tab control move
46 | ///
47 | TabControlMove,
48 |
49 | ///
50 | /// The tab control select
51 | ///
52 | TabControlSelect,
53 |
54 | ///
55 | /// The CheckBox hover
56 | ///
57 | CheckBoxHover,
58 |
59 | ///
60 | /// The RadioButton hover
61 | ///
62 | RadioButtonHover,
63 |
64 | ///
65 | /// Sound type when focus is changed
66 | ///
67 | FocusChanged
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/UIGenerator/Values/BitmapImageGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media.Imaging;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Values
11 | {
12 | ///
13 | /// Implements generator for Bitmap Image
14 | ///
15 | public class BitmapImageGeneratorValue : IGeneratorValue
16 | {
17 | ///
18 | /// Gets the type of the value.
19 | ///
20 | ///
21 | /// The type of the value.
22 | ///
23 | public Type ValueType
24 | {
25 | get
26 | {
27 | return typeof(BitmapImage);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code for value
33 | ///
34 | /// The parent class.
35 | /// The method.
36 | /// The value.
37 | /// Name of the base.
38 | /// The dictionary.
39 | ///
40 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
41 | {
42 | string bitmapVarName = baseName + "_bm";
43 |
44 | BitmapImage bitmap = value as BitmapImage;
45 | return CodeComHelper.GenerateBitmapImageValue(method, bitmap.UriSource, bitmapVarName);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/UserControlGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements User Control generator
14 | ///
15 | public class UserControlGeneratorType : ContentControlGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(UserControl);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates control fields
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = new CodeThisReferenceExpression();
42 |
43 | CodeComHelper.GenerateTemplateStyleField(classType, initMethod, fieldReference, source, FrameworkElement.StyleProperty);
44 |
45 | return fieldReference;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/DataGridTextColumnGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements generator for text column
14 | ///
15 | public class DataGridTextColumnGeneratorType : DataGridBoundColumnGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(DataGridTextColumn);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates control fields
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | DataGridTextColumn column = source as DataGridTextColumn;
44 |
45 | return fieldReference;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/TreeViewItemGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements Tree View Item generator
14 | ///
15 | public class TreeViewItemGeneratorType : HeaderedItemsControlGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(TreeViewItem);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | ///
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
42 |
43 | TreeViewItem item = source as TreeViewItem;
44 | CodeComHelper.GenerateField(method, fieldReference, item, TreeViewItem.IsSelectedProperty);
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Values/ResourceExtGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Values
11 | {
12 | ///
13 | /// Implements generator for DynamicResourceExtension
14 | ///
15 | public class ResourceExtGeneratorValue : IGeneratorValue
16 | {
17 | ///
18 | /// Gets the type of the value.
19 | ///
20 | ///
21 | /// The type of the value.
22 | ///
23 | public Type ValueType
24 | {
25 | get
26 | {
27 | return typeof(DynamicResourceExtension);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates the specified parent class.
33 | ///
34 | /// The parent class.
35 | /// The method.
36 | /// The value.
37 | /// Name of the base.
38 | /// The dictionary.
39 | ///
40 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
41 | {
42 | DynamicResourceExtension dynamicResource = value as DynamicResourceExtension;
43 | return new CodeObjectCreateExpression("ResourceReferenceExpression", new CodePrimitiveExpression(dynamicResource.ResourceKey));
44 | }
45 | }
46 | }
47 |
48 |
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/DataGridCheckBoxColumnGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements generator for boolean column with check box
14 | ///
15 | public class DataGridCheckBoxColumnGeneratorType : DataGridBoundColumnGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(DataGridCheckBoxColumn);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates control fields
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | DataGridCheckBoxColumn column = source as DataGridCheckBoxColumn;
44 |
45 | return fieldReference;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ListBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements List Box control generator
15 | ///
16 | public class ListBoxGeneratorType : SelectorGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(ListBox);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates code
34 | ///
35 | /// The dependence object
36 | /// Type of the class.
37 | /// The initialize method.
38 | ///
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | ListBox listBox = source as ListBox;
45 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, source, ListBox.SelectionModeProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/ScrollViewerHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | namespace EmptyKeys.UserInterface.Designer
9 | {
10 | ///
11 | /// Implements Scroll Viewer helper with custom attached property, this is fake designer class
12 | ///
13 | public static class ScrollViewerHelper
14 | {
15 | private static Type typeOfThis = typeof(ScrollViewerHelper);
16 |
17 | ///
18 | /// Gets the action.
19 | ///
20 | /// The object.
21 | ///
22 | public static ScrollViewerAction GetAction(DependencyObject obj)
23 | {
24 | return (ScrollViewerAction)obj.GetValue(ActionProperty);
25 | }
26 |
27 | ///
28 | /// Sets the action.
29 | ///
30 | /// The object.
31 | /// The value.
32 | public static void SetAction(DependencyObject obj, ScrollViewerAction value)
33 | {
34 | obj.SetValue(ActionProperty, value);
35 | }
36 |
37 | ///
38 | /// The action property
39 | ///
40 | public static readonly DependencyProperty ActionProperty =
41 | DependencyProperty.RegisterAttached("Action", typeof(ScrollViewerAction), typeOfThis,
42 | new FrameworkPropertyMetadata(ScrollViewerAction.None, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnActionChanged)));
43 |
44 | private static void OnActionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
45 | {
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/PasswordBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements Password Box control generator
14 | ///
15 | public class PasswordBoxGeneratorType : TextBoxGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(PasswordBox);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | PasswordBox passBox = source as PasswordBox;
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, PasswordBox.PasswordCharProperty);
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ProgressBarGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements Progress Bar control generator
14 | ///
15 | public class ProgressBarGeneratorType : RangeBaseGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(ProgressBar);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates the specified source.
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | ProgressBar bar = source as ProgressBar;
44 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, bar, ProgressBar.OrientationProperty);
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Effects/CustomEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media.Effects;
7 |
8 | namespace EmptyKeys.UserInterface.Designer.Effects
9 | {
10 | ///
11 | /// Implements empty class for custom effect shader - fake class for designer
12 | ///
13 | ///
14 | public class CustomEffect : ShaderEffect
15 | {
16 | ///
17 | /// The effect asset property
18 | ///
19 | public static readonly DependencyProperty EffectAssetProperty =
20 | DependencyProperty.Register("EffectAsset", typeof(string), typeof(CustomEffect),
21 | new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None));
22 |
23 | ///
24 | /// Gets or sets the effect asset.
25 | ///
26 | ///
27 | /// The effect asset.
28 | ///
29 | public string EffectAsset
30 | {
31 | get { return (string)GetValue(EffectAssetProperty); }
32 | set { SetValue(EffectAssetProperty, value); }
33 | }
34 |
35 | ///
36 | /// Initializes a new instance of the class.
37 | ///
38 | public CustomEffect() : base()
39 | {
40 | var pixelShader = new PixelShader();
41 | var fileUri = new Uri("pack://application:,,,/EmptyKeys.UserInterface.Designer;component/Effects/FakeShader.ps", UriKind.RelativeOrAbsolute);
42 | pixelShader.UriSource = fileUri;
43 | PixelShader = pixelShader;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ComboBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements Combo Box control generator
15 | ///
16 | public class ComboBoxGeneratorType : SelectorGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(ComboBox);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates control fields
34 | ///
35 | /// The dependence object
36 | /// Type of the class.
37 | /// The initialize method.
38 | ///
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | ComboBox combo = source as ComboBox;
45 | CodeComHelper.GenerateFieldDoubleToFloat(initMethod, fieldReference, source, ComboBox.MaxDropDownHeightProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ScrollContentPresenterGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements Scroll Content Presenter generator
15 | ///
16 | public class ScrollContentPresenterGeneratorType : ContentPresenterGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(ScrollContentPresenter);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates control fields
34 | ///
35 | /// The source.
36 | /// Type of the class.
37 | /// The initialize method.
38 | /// if set to true [generate field].
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, ScrollViewer.CanContentScrollProperty);
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/TabItemGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Controls.Primitives;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements Tab Item control generator
16 | ///
17 | public class TabItemGeneratorType : HeaderedContentControlGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get
28 | {
29 | return typeof(TabItem);
30 | }
31 | }
32 |
33 | ///
34 | /// Generates code
35 | ///
36 | /// The dependence object
37 | /// Type of the class.
38 | /// The initialize method.
39 | ///
40 | ///
41 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
42 | {
43 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
44 |
45 | TabItem item = source as TabItem;
46 | CodeComHelper.GenerateField(method, fieldReference, source, Selector.IsSelectedProperty);
47 |
48 | return fieldReference;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/RadioButtonGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements Radio Button control generator
14 | ///
15 | public class RadioButtonGeneratorType : ToggleButtonGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(RadioButton);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | RadioButton radio = source as RadioButton;
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, RadioButton.GroupNameProperty);
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/DockPanelGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Media;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
13 | {
14 | ///
15 | /// Implements DockPanel control generator
16 | ///
17 | public class DockPanelGeneratorType : PanelGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get { return typeof(DockPanel); }
28 | }
29 |
30 | ///
31 | /// Generates the specified initialize method.
32 | ///
33 | /// The dependency object
34 | /// Type of the class.
35 | /// The initialize method.
36 | /// if set to true [generate field].
37 | ///
38 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
39 | {
40 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
41 | DockPanel dockPanel = source as DockPanel;
42 | CodeComHelper.GenerateField(initMethod, fieldReference, source, DockPanel.LastChildFillProperty);
43 | return fieldReference;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ListBoxItemGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Controls.Primitives;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements List Box Item control generator
16 | ///
17 | public class ListBoxItemGeneratorType : ContentControlGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get
28 | {
29 | return typeof(ListBoxItem);
30 | }
31 | }
32 |
33 | ///
34 | /// Generates code
35 | ///
36 | /// The dependence object
37 | /// Type of the class.
38 | /// The initialize method.
39 | ///
40 | ///
41 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
42 | {
43 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
44 |
45 | ListBoxItem item = source as ListBoxItem;
46 | CodeComHelper.GenerateField(method, fieldReference, source, Selector.IsSelectedProperty);
47 |
48 | return fieldReference;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIGenerator/Types/TabControlGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements Tab Control generator
15 | ///
16 | public class TabControlGeneratorType : SelectorGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(TabControl);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates code
34 | ///
35 | /// The dependence object
36 | /// Type of the class.
37 | /// The initialize method.
38 | /// if set to true [generate field].
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | TabControl tabControl = source as TabControl;
45 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, source, TabControl.TabStripPlacementProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/Types/StackPanelGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Media;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements Stack Panel control generator
16 | ///
17 | public class StackPanelGeneratorType : PanelGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get { return typeof(StackPanel); }
28 | }
29 |
30 | ///
31 | /// Generates the specified initialize method.
32 | ///
33 | /// The dependency object
34 | /// Type of the class.
35 | /// The initialize method.
36 | /// if set to true [generate field].
37 | ///
38 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
39 | {
40 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
41 |
42 | StackPanel stackPanel = source as StackPanel;
43 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, source, StackPanel.OrientationProperty);
44 |
45 | return fieldReference;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Input/GamepadGesture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Input;
7 |
8 | namespace EmptyKeys.UserInterface.Designer.Input
9 | {
10 | ///
11 | /// Implements fake Gamepad Gesture for XAML designer
12 | ///
13 | public class GamepadGesture : InputGesture
14 | {
15 | ///
16 | /// Gets the game pad input.
17 | ///
18 | ///
19 | /// The game pad input.
20 | ///
21 | public GamepadInput GamepadInput
22 | {
23 | get;
24 | internal set;
25 | }
26 |
27 | ///
28 | /// Initializes a new instance of the class.
29 | ///
30 | /// The game pad input.
31 | public GamepadGesture(GamepadInput gamepadInput)
32 | {
33 | GamepadInput = gamepadInput;
34 | }
35 |
36 | ///
37 | /// When overridden in a derived class, determines whether the specified matches the input associated with the specified object.
38 | ///
39 | /// The target of the command.
40 | /// The input event data to compare this gesture to.
41 | ///
42 | /// true if the gesture matches the input; otherwise, false.
43 | ///
44 | public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
45 | {
46 | return true;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Shapes/RectangleGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Shapes;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Shapes
11 | {
12 | ///
13 | /// Implements Rectangle shape type generator
14 | ///
15 | public class RectangleGeneratorType : ShapeGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get { return typeof(Rectangle); }
26 | }
27 |
28 | ///
29 | /// Generates control fields
30 | ///
31 | /// The source.
32 | /// Type of the class.
33 | /// The initialize method.
34 | /// if set to true [generate field].
35 | ///
36 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
37 | {
38 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
39 |
40 | Rectangle rect = source as Rectangle;
41 |
42 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, Rectangle.RadiusXProperty);
43 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, Rectangle.RadiusYProperty);
44 |
45 | return fieldReference;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ComboBoxItemGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Controls.Primitives;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements Combo Box Item control generator
16 | ///
17 | public class ComboBoxItemGeneratorType : ListBoxItemGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get
28 | {
29 | return typeof(ComboBoxItem);
30 | }
31 | }
32 |
33 | ///
34 | /// Generates control fields
35 | ///
36 | /// The source.
37 | /// Type of the class.
38 | /// The method.
39 | /// if set to true [generate field].
40 | ///
41 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
42 | {
43 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
44 |
45 | ComboBoxItem item = source as ComboBoxItem;
46 | CodeComHelper.GenerateField(method, fieldReference, source, ComboBoxItem.IsHighlightedProperty);
47 |
48 | return fieldReference;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIGenerator/Types/RepeatButtonGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 | using System.Windows.Data;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements Repeat Button control generator
16 | ///
17 | public class RepeatButtonGeneratorType : ButtonGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get
28 | {
29 | return typeof(RepeatButton);
30 | }
31 | }
32 |
33 | ///
34 | /// Generates code
35 | ///
36 | /// The dependence object
37 | /// Type of the class.
38 | /// The initialize method.
39 | ///
40 | ///
41 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
42 | {
43 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, RepeatButton.DelayProperty);
45 | CodeComHelper.GenerateField(initMethod, fieldReference, source, RepeatButton.IntervalProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/Types/SelectorGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements Selector control generator
15 | ///
16 | public class SelectorGeneratorType : ItemsControlGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(Selector);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates code
34 | ///
35 | /// The dependence object
36 | /// Type of the class.
37 | /// The initialize method.
38 | /// if set to true [generate field].
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | Selector selector = source as Selector;
45 | CodeComHelper.GenerateField(initMethod, fieldReference, source, Selector.SelectedIndexProperty);
46 |
47 | // TODO selected item
48 |
49 | return fieldReference;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/DataGridTemplateColumnGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements generator for Data Grid Template Column
14 | ///
15 | public class DataGridTemplateColumnGeneratorType : DataGridColumnGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(DataGridTemplateColumn);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates control fields
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | ///
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
42 | DataGridTemplateColumn column = source as DataGridTemplateColumn;
43 |
44 | CodeComHelper.GenerateTemplateStyleField(classType, method, fieldReference, source, DataGridTemplateColumn.CellTemplateProperty, ColumnName + "_ct");
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ExpanderGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements Expander control generator
15 | ///
16 | public class ExpanderGeneratorType : HeaderedContentControlGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(Expander);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates code
34 | ///
35 | /// The dependence object
36 | /// Type of the class.
37 | /// The initialize method.
38 | ///
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | Expander expander = source as Expander;
45 | CodeComHelper.GenerateField(initMethod, fieldReference, source, Expander.IsExpandedProperty);
46 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, source, Expander.ExpandDirectionProperty);
47 |
48 | return fieldReference;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ScrollBarGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 | using System.Windows.Media;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements Scroll Bar control generator
16 | ///
17 | public class ScrollBarGeneratorType : RangeBaseGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get
28 | {
29 | return typeof(ScrollBar);
30 | }
31 | }
32 |
33 | ///
34 | /// Generates control fields
35 | ///
36 | /// The source.
37 | /// Type of the class.
38 | /// The initialize method.
39 | /// if set to true [generate field].
40 | ///
41 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
42 | {
43 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
44 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, source, ScrollBar.OrientationProperty);
45 | CodeComHelper.GenerateFieldDoubleToFloat(initMethod, fieldReference, source, ScrollBar.ViewportSizeProperty);
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/TextBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types
12 | {
13 | ///
14 | /// Implements Text Box control generator
15 | ///
16 | public class TextBoxGeneratorType : TextBoxBaseGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get
27 | {
28 | return typeof(TextBox);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates code
34 | ///
35 | /// The dependence object
36 | /// Type of the class.
37 | /// The initialize method.
38 | /// if set to true [generate field].
39 | ///
40 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
41 | {
42 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
43 |
44 | TextBox textBox = source as TextBox;
45 | CodeComHelper.GenerateField(initMethod, fieldReference, source, TextBox.TextProperty);
46 | CodeComHelper.GenerateField(initMethod, fieldReference, source, TextBox.MaxLengthProperty);
47 |
48 | return fieldReference;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIGenerator/Types/SliderGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements Slider UI Generator
14 | ///
15 | public class SliderGeneratorType : RangeBaseGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(Slider);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates the specified source.
33 | ///
34 | /// The source.
35 | /// Type of the class.
36 | /// The method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
42 |
43 | CodeComHelper.GenerateEnumField(method, fieldReference, source, Slider.OrientationProperty);
44 | CodeComHelper.GenerateField(method, fieldReference, source, Slider.IsSnapToTickEnabledProperty);
45 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, Slider.TickFrequencyProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/IGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 |
10 | namespace EmptyKeys.UserInterface.Generator
11 | {
12 | ///
13 | /// Describes Generator Type interface
14 | ///
15 | public interface IGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | Type XamlType
24 | {
25 | get;
26 | }
27 |
28 | ///
29 | /// Gets the children.
30 | ///
31 | /// The dependency object
32 | ///
33 | IEnumerable GetChildren(DependencyObject source);
34 |
35 | ///
36 | /// Generates the specified source.
37 | ///
38 | /// The source.
39 | /// Type of the class.
40 | /// The method.
41 | /// if set to true [generate field].
42 | ///
43 | CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField);
44 |
45 | ///
46 | /// Adds the child.
47 | ///
48 | /// The parent.
49 | /// The child.
50 | /// The initialize method.
51 | /// The index.
52 | void AddChild(CodeExpression parent, CodeExpression child, CodeMemberMethod method, int index);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ToggleButtonGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls.Primitives;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements Toggle Button control generator
14 | ///
15 | public class ToggleButtonGeneratorType : ButtonGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(ToggleButton);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | ToggleButton toggle = source as ToggleButton;
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, ToggleButton.IsCheckedProperty);
45 | CodeComHelper.GenerateField(initMethod, fieldReference, source, ToggleButton.IsThreeStateProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/Values/ColorGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Values
11 | {
12 | ///
13 | /// Implements value generator for Color type
14 | ///
15 | public class ColorGeneratorValue : IGeneratorValue
16 | {
17 | ///
18 | /// Gets the type of the value.
19 | ///
20 | ///
21 | /// The type of the value.
22 | ///
23 | public Type ValueType
24 | {
25 | get
26 | {
27 | return typeof(Color);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code for value
33 | ///
34 | /// The parent class.
35 | /// The method.
36 | /// The value.
37 | /// Name of the base.
38 | /// The dictionary.
39 | ///
40 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
41 | {
42 | Color color = (Color)value;
43 | CodeObjectCreateExpression colorExpr = new CodeObjectCreateExpression(
44 | "ColorW",
45 | new CodePrimitiveExpression(color.R),
46 | new CodePrimitiveExpression(color.G),
47 | new CodePrimitiveExpression(color.B),
48 | new CodePrimitiveExpression(color.A));
49 |
50 | return colorExpr;
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/UIGenerator/Types/CustomPasswordBoxGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using EmptyKeys.UserInterface.Designer;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types
11 | {
12 | ///
13 | /// Implements Custom Password Box control generator with binding support for Password property
14 | ///
15 | public class CustomPasswordBoxGeneratorType : TextBoxGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get
26 | {
27 | return typeof(PasswordBox);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code
33 | ///
34 | /// The dependence object
35 | /// Type of the class.
36 | /// The initialize method.
37 | /// if set to true [generate field].
38 | ///
39 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
40 | {
41 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
42 |
43 | PasswordBox passBox = source as PasswordBox;
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, PasswordBox.PasswordCharProperty);
45 | CodeComHelper.GenerateField(initMethod, fieldReference, source, PasswordBox.PasswordProperty);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Shapes/LineGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Shapes;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Shapes
11 | {
12 | ///
13 | /// Implements Type Generator for Line shape
14 | ///
15 | public class LineGeneratorType : ShapeGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get { return typeof(Line); }
26 | }
27 |
28 | ///
29 | /// Generates control fields
30 | ///
31 | /// The source.
32 | /// Type of the class.
33 | /// The initialize method.
34 | /// if set to true [generate field].
35 | ///
36 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
37 | {
38 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
39 |
40 | Line line = source as Line;
41 |
42 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, line, Line.X1Property);
43 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, line, Line.X2Property);
44 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, line, Line.Y1Property);
45 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, line, Line.Y2Property);
46 |
47 | return fieldReference;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIGenerator/EmptyKeys.UserInterface.Generator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0-windows
4 | Library
5 | SAK
6 | SAK
7 | SAK
8 | SAK
9 | false
10 | true
11 | true
12 | AppStore;Debug;Release;Testing
13 |
14 |
15 | true
16 |
17 |
18 | true
19 |
20 |
21 |
22 | bin\x64\Debug\
23 | MinimumRecommendedRules.ruleset
24 |
25 |
26 | bin\x64\Release\
27 | bin\Release\EmptyKeys.UserInterface.Generator.XML
28 | true
29 | MinimumRecommendedRules.ruleset
30 |
31 |
32 |
33 | Properties\GlobalAssemblyInfo.cs
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/WrapPanelGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements generator for WrapPanel control
14 | ///
15 | public class WrapPanelGeneratorType : PanelGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get { return typeof(WrapPanel); }
26 | }
27 |
28 | ///
29 | /// Generates the specified initialize method.
30 | ///
31 | /// The dependency object
32 | /// Type of the class.
33 | /// The initialize method.
34 | /// if set to true [generate field].
35 | ///
36 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
37 | {
38 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
39 |
40 | WrapPanel wrapPanel = source as WrapPanel;
41 | CodeComHelper.GenerateFieldDoubleToFloat(initMethod, fieldReference, source, WrapPanel.ItemHeightProperty);
42 | CodeComHelper.GenerateFieldDoubleToFloat(initMethod, fieldReference, source, WrapPanel.ItemWidthProperty);
43 | CodeComHelper.GenerateEnumField(initMethod, fieldReference, source, WrapPanel.OrientationProperty);
44 |
45 | return fieldReference;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Shapes/ShapeGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 | using System.Windows.Shapes;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Types.Shapes
12 | {
13 | ///
14 | /// Implements Shape type generator
15 | ///
16 | public class ShapeGeneratorType : ElementGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get { return typeof(Shape); }
27 | }
28 |
29 | ///
30 | /// Generates control fields
31 | ///
32 | /// The source.
33 | /// Type of the class.
34 | /// The initialize method.
35 | /// if set to true [generate field].
36 | ///
37 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
38 | {
39 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
40 |
41 | Shape shape = source as Shape;
42 |
43 | CodeComHelper.GenerateEnumField(method, fieldReference, source, Shape.StretchProperty);
44 | CodeComHelper.GenerateBrushField(method, fieldReference, source, Shape.FillProperty);
45 | CodeComHelper.GenerateBrushField(method, fieldReference, source, Shape.StrokeProperty);
46 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, Shape.StrokeThicknessProperty);
47 |
48 | return fieldReference;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Shapes/PathGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Shapes;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Shapes
11 | {
12 | ///
13 | /// Implements Path shape type generator
14 | ///
15 | public class PathGeneratorType : ShapeGeneratorType
16 | {
17 | ///
18 | /// Gets the type of the xaml.
19 | ///
20 | ///
21 | /// The type of the xaml.
22 | ///
23 | public override Type XamlType
24 | {
25 | get { return typeof(Path); }
26 | }
27 |
28 | ///
29 | /// Generates control fields
30 | ///
31 | /// The source.
32 | /// Type of the class.
33 | /// The initialize method.
34 | /// if set to true [generate field].
35 | ///
36 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
37 | {
38 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
39 |
40 | Path path = source as Path;
41 |
42 | if (CodeComHelper.IsValidForFieldGenerator(source.ReadLocalValue(Path.DataProperty)))
43 | {
44 | CodeExpression dataValueExpression = CodeComHelper.GetValueExpression(classType, method, path.Data, path.Name + "_G");
45 | method.Statements.Add(
46 | new CodeAssignStatement(
47 | new CodeFieldReferenceExpression(new CodeVariableReferenceExpression(path.Name), "Data"),
48 | dataValueExpression));
49 | }
50 |
51 | return fieldReference;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/UIGenerator/Types/Controls/UniformGridGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls.Primitives;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Types.Controls
11 | {
12 | ///
13 | /// Implements generator for Uniform Grid control
14 | ///
15 | ///
16 | public class UniformGridGeneratorType : PanelGeneratorType
17 | {
18 | ///
19 | /// Gets the type of the xaml.
20 | ///
21 | ///
22 | /// The type of the xaml.
23 | ///
24 | public override Type XamlType
25 | {
26 | get { return typeof(UniformGrid); }
27 | }
28 |
29 | ///
30 | /// Generates the specified initialize method.
31 | ///
32 | /// The dependency object
33 | /// Type of the class.
34 | /// The initialize method.
35 | /// if set to true [generate field].
36 | ///
37 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
38 | {
39 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
40 |
41 | UniformGrid uniGrid = source as UniformGrid;
42 | CodeComHelper.GenerateField(initMethod, fieldReference, source, UniformGrid.FirstColumnProperty);
43 | CodeComHelper.GenerateField(initMethod, fieldReference, source, UniformGrid.RowsProperty);
44 | CodeComHelper.GenerateField(initMethod, fieldReference, source, UniformGrid.ColumnsProperty);
45 |
46 | return fieldReference;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UIGenerator/Types/AnimatedImageGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Controls;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using EmptyKeys.UserInterface.Designer;
14 |
15 | namespace EmptyKeys.UserInterface.Generator.Types
16 | {
17 | ///
18 | /// Implements Image control generator
19 | ///
20 | public class AnimatedImageGeneratorType : ImageGeneratorType
21 | {
22 | ///
23 | /// Gets the type of the xaml.
24 | ///
25 | ///
26 | /// The type of the xaml.
27 | ///
28 | public override Type XamlType
29 | {
30 | get
31 | {
32 | return typeof(AnimatedImage);
33 | }
34 | }
35 |
36 | ///
37 | /// Generates control fields
38 | ///
39 | /// The source.
40 | /// Type of the class.
41 | /// The initialize method.
42 | /// if set to true [generate field].
43 | ///
44 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
45 | {
46 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
47 |
48 | CodeComHelper.GenerateField(method, fieldReference, source, AnimatedImage.FrameWidthProperty);
49 | CodeComHelper.GenerateField(method, fieldReference, source, AnimatedImage.FrameHeightProperty);
50 | CodeComHelper.GenerateField(method, fieldReference, source, AnimatedImage.FramesPerSecondProperty);
51 |
52 | return fieldReference;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Input/GamepadInput.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace EmptyKeys.UserInterface.Designer.Input
3 | {
4 | ///
5 | /// Enumeration of all types of game pad input
6 | ///
7 | public enum GamepadInput
8 | {
9 | ///
10 | /// The none
11 | ///
12 | None,
13 |
14 | ///
15 | /// A button
16 | ///
17 | AButton,
18 |
19 | ///
20 | /// The b button
21 | ///
22 | BButton,
23 |
24 | ///
25 | /// The c button
26 | ///
27 | CButton,
28 |
29 | ///
30 | /// The d button
31 | ///
32 | DButton,
33 |
34 | ///
35 | /// The left shoulder button
36 | ///
37 | LeftShoulderButton,
38 |
39 | ///
40 | /// The right shoulder button
41 | ///
42 | RightShoulderButton,
43 |
44 | ///
45 | /// The left stick button
46 | ///
47 | LeftStickButton,
48 |
49 | ///
50 | /// The right stick button
51 | ///
52 | RightStickButton,
53 |
54 | ///
55 | /// The select button
56 | ///
57 | SelectButton,
58 |
59 | ///
60 | /// The start button
61 | ///
62 | StartButton,
63 |
64 | ///
65 | /// The d pad
66 | ///
67 | DPad,
68 |
69 | ///
70 | /// The left thumb stick
71 | ///
72 | LeftThumbStick,
73 |
74 | ///
75 | /// The right thumb stick
76 | ///
77 | RightThumbStick,
78 |
79 | ///
80 | /// The right trigger
81 | ///
82 | RightTrigger,
83 |
84 | ///
85 | /// The left trigger
86 | ///
87 | LeftTrigger
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/UIGenerator/Values/FontWeightGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace EmptyKeys.UserInterface.Generator.Values
10 | {
11 | ///
12 | /// Implements generator for Font Weight value
13 | ///
14 | public class FontWeightGeneratorValue : IGeneratorValue
15 | {
16 | ///
17 | /// Gets the type of the value.
18 | ///
19 | ///
20 | /// The type of the value.
21 | ///
22 | public Type ValueType
23 | {
24 | get
25 | {
26 | return typeof(FontWeight);
27 | }
28 | }
29 |
30 | ///
31 | /// Generates code for value
32 | ///
33 | /// The parent class.
34 | /// The method.
35 | /// The value.
36 | /// Name of the base.
37 | /// The dictionary.
38 | ///
39 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
40 | {
41 | CodeExpression valueExpression = null;
42 | if (value != null)
43 | {
44 | FontWeight fontWeight = (FontWeight)value;
45 | CodeTypeReferenceExpression typeReference = new CodeTypeReferenceExpression("FontStyle");
46 | if (fontWeight == FontWeights.Normal)
47 | {
48 | valueExpression = new CodeFieldReferenceExpression(typeReference, "Regular");
49 | }
50 | else
51 | {
52 | valueExpression = new CodeFieldReferenceExpression(typeReference, fontWeight.ToString());
53 | }
54 | }
55 |
56 | return valueExpression;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ImageGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Controls;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 |
14 | namespace EmptyKeys.UserInterface.Generator.Types
15 | {
16 | ///
17 | /// Implements Image control generator
18 | ///
19 | public class ImageGeneratorType : ElementGeneratorType
20 | {
21 | ///
22 | /// Gets the type of the xaml.
23 | ///
24 | ///
25 | /// The type of the xaml.
26 | ///
27 | public override Type XamlType
28 | {
29 | get
30 | {
31 | return typeof(Image);
32 | }
33 | }
34 |
35 | ///
36 | /// Generates control fields
37 | ///
38 | /// The source.
39 | /// Type of the class.
40 | /// The initialize method.
41 | /// if set to true [generate field].
42 | ///
43 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
44 | {
45 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
46 |
47 | Image image = source as Image;
48 |
49 | BitmapImage bitmap = image.Source as BitmapImage;
50 | if (bitmap != null)
51 | {
52 | CodeComHelper.GenerateBitmapImageField(method, fieldReference, source, bitmap.UriSource, image.Name + "_bm", Image.SourceProperty);
53 | }
54 |
55 | CodeComHelper.GenerateEnumField(method, fieldReference, source, Image.StretchProperty);
56 | return fieldReference;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/UIGenerator/Values/LineGeometryGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media;
9 |
10 | namespace EmptyKeys.UserInterface.Generator.Values
11 | {
12 | ///
13 | /// Implements value generator for Line Geometry
14 | ///
15 | public class LineGeometryGeneratorValue : IGeneratorValue
16 | {
17 | ///
18 | /// Gets the type of the value.
19 | ///
20 | ///
21 | /// The type of the value.
22 | ///
23 | public Type ValueType
24 | {
25 | get
26 | {
27 | return typeof(LineGeometry);
28 | }
29 | }
30 |
31 | ///
32 | /// Generates code for value
33 | ///
34 | /// The parent class.
35 | /// The method.
36 | /// The value.
37 | /// Name of the base.
38 | /// The dictionary.
39 | ///
40 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
41 | {
42 | CodeExpression valueExpression = null;
43 | if (value != null)
44 | {
45 | var geometryVariable = new CodeVariableDeclarationStatement("LineGeometry", baseName, new CodeObjectCreateExpression("LineGeometry"));
46 | method.Statements.Add(geometryVariable);
47 | valueExpression = new CodeVariableReferenceExpression(baseName);
48 |
49 | LineGeometry line = value as LineGeometry;
50 | CodeComHelper.GeneratePointField(method, valueExpression, line, LineGeometry.StartPointProperty);
51 | CodeComHelper.GeneratePointField(method, valueExpression, line, LineGeometry.EndPointProperty);
52 | }
53 |
54 | return valueExpression;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/UIGenerator/Values/SoundSourceGeneratorValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using EmptyKeys.UserInterface.Designer;
10 |
11 | namespace EmptyKeys.UserInterface.Generator.Values
12 | {
13 | ///
14 | /// Implements generator for Sound Source Collection value
15 | ///
16 | public class SoundSourceGeneratorValue : IGeneratorValue
17 | {
18 | ///
19 | /// Gets the type of the value.
20 | ///
21 | ///
22 | /// The type of the value.
23 | ///
24 | public Type ValueType
25 | {
26 | get
27 | {
28 | return typeof(SoundSourceCollection);
29 | }
30 | }
31 |
32 | ///
33 | /// Generates code for value
34 | ///
35 | /// The parent class.
36 | /// The method.
37 | /// The value.
38 | /// Name of the base.
39 | /// The dictionary.
40 | ///
41 | public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
42 | {
43 | return GetSoundSourceCollectionValueExpression(method, value, baseName);
44 | }
45 |
46 | private static CodeExpression GetSoundSourceCollectionValueExpression(CodeMemberMethod method, object value, string baseName)
47 | {
48 | string collVar = baseName + "_sounds";
49 | CodeVariableDeclarationStatement collection =
50 | new CodeVariableDeclarationStatement("var", collVar, new CodeObjectCreateExpression("SoundSourceCollection"));
51 | method.Statements.Add(collection);
52 | CodeComHelper.GenerateSoundSources(method, value as SoundSourceCollection, collVar);
53 | return new CodeVariableReferenceExpression(collVar);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/UIGenerator/Types/RangeBaseGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Controls.Primitives;
10 | using System.Windows.Media;
11 |
12 | namespace EmptyKeys.UserInterface.Generator.Types
13 | {
14 | ///
15 | /// Implements Range Base generator
16 | ///
17 | public class RangeBaseGeneratorType : ControlGeneratorType
18 | {
19 | ///
20 | /// Gets the type of the xaml.
21 | ///
22 | ///
23 | /// The type of the xaml.
24 | ///
25 | public override Type XamlType
26 | {
27 | get
28 | {
29 | return typeof(RangeBase);
30 | }
31 | }
32 |
33 | ///
34 | /// Generates control fields
35 | ///
36 | /// The source.
37 | /// Type of the class.
38 | /// The initialize method.
39 | /// if set to true [generate field].
40 | ///
41 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
42 | {
43 | CodeExpression fieldReference = base.Generate(source, classType, method, generateField);
44 | RangeBase rangeBase = source as RangeBase;
45 |
46 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, RangeBase.MinimumProperty);
47 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, RangeBase.MaximumProperty);
48 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, RangeBase.ValueProperty);
49 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, RangeBase.SmallChangeProperty);
50 | CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, RangeBase.LargeChangeProperty);
51 | return fieldReference;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/Interactions/CallMethodAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | namespace EmptyKeys.UserInterface.Designer.Interactions
9 | {
10 | public class CallMethodAction : Action
11 | {
12 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
13 | public static readonly DependencyProperty MethodNameProperty = DependencyProperty.Register(
14 | "MethodName",
15 | typeof(string),
16 | typeof(CallMethodAction),
17 | new FrameworkPropertyMetadata(null));
18 |
19 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
20 | public static readonly DependencyProperty TargetObjectProperty = DependencyProperty.Register(
21 | "TargetObject",
22 | typeof(object),
23 | typeof(CallMethodAction),
24 | new FrameworkPropertyMetadata(null));
25 |
26 | ///
27 | /// Gets or sets the name of the method to invoke. This is a dependency property.
28 | ///
29 | ///
30 | /// The name of the method.
31 | ///
32 | public string MethodName
33 | {
34 | get
35 | {
36 | return (string)GetValue(CallMethodAction.MethodNameProperty);
37 | }
38 |
39 | set
40 | {
41 | SetValue(CallMethodAction.MethodNameProperty, value);
42 | }
43 | }
44 |
45 | ///
46 | /// Gets or sets the object that exposes the method of interest. This is a dependency property.
47 | ///
48 | ///
49 | /// The target object.
50 | ///
51 | public object TargetObject
52 | {
53 | get
54 | {
55 | return GetValue(CallMethodAction.TargetObjectProperty);
56 | }
57 |
58 | set
59 | {
60 | SetValue(CallMethodAction.TargetObjectProperty, value);
61 | }
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/EmptyKeys.UserInterface.Designer/PasswordBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 |
9 | namespace EmptyKeys.UserInterface.Designer
10 | {
11 | public class PasswordBox : TextBox
12 | {
13 | private static readonly Type typeOfThis = typeof(PasswordBox);
14 |
15 | ///
16 | /// The password character property
17 | ///
18 | public static readonly DependencyProperty PasswordCharProperty =
19 | DependencyProperty.Register("PasswordChar", typeof(char), typeOfThis,
20 | new FrameworkPropertyMetadata('*', FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnPasswordCharChanged)));
21 |
22 | private static void OnPasswordCharChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
23 | {
24 | }
25 |
26 | ///
27 | /// Gets or sets the password character.
28 | ///
29 | ///
30 | /// The password character.
31 | ///
32 | public char PasswordChar
33 | {
34 | get { return (char)GetValue(PasswordCharProperty); }
35 | set { SetValue(PasswordCharProperty, value); }
36 | }
37 |
38 | ///
39 | /// The password property
40 | ///
41 | public static readonly DependencyProperty PasswordProperty =
42 | DependencyProperty.Register("Password", typeof(string), typeOfThis,
43 | new FrameworkPropertyMetadata(string.Empty));
44 |
45 | ///
46 | /// Gets or sets the password.
47 | ///
48 | ///
49 | /// The password.
50 | ///
51 | public string Password
52 | {
53 | get { return (string)GetValue(PasswordProperty); }
54 | set { SetValue(PasswordProperty, value); }
55 | }
56 |
57 | ///
58 | /// Initializes a new instance of the class.
59 | ///
60 | public PasswordBox()
61 | : base()
62 | {
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/UIGenerator/Types/ButtonGeneratorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Controls.Primitives;
6 | using System.Windows.Input;
7 |
8 | namespace EmptyKeys.UserInterface.Generator.Types
9 | {
10 | ///
11 | /// Implements Button control generator
12 | ///
13 | public class ButtonGeneratorType : ContentControlGeneratorType
14 | {
15 | ///
16 | /// Gets the type of the xaml.
17 | ///
18 | ///
19 | /// The type of the xaml.
20 | ///
21 | public override Type XamlType
22 | {
23 | get
24 | {
25 | return typeof(Button);
26 | }
27 | }
28 |
29 | ///
30 | /// Generates control fields
31 | ///
32 | /// The source.
33 | /// Type of the class.
34 | /// The initialize method.
35 | /// if set to true [generate field].
36 | ///
37 | public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
38 | {
39 | CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
40 | ButtonBase buttonBase = source as ButtonBase;
41 |
42 | RoutedCommand command = buttonBase.Command as RoutedCommand;
43 | if (command != null && !string.IsNullOrEmpty(command.Name) && command.OwnerType != null)
44 | {
45 | initMethod.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(fieldReference, "Command"),
46 | new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(command.OwnerType.Name), command.Name + "Command")));
47 | }
48 |
49 | CodeComHelper.GenerateField