Giter Site home page Giter Site logo

ui_generator's People

Contributors

aravol avatar emptykeys avatar lukazoid avatar wasabifan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ui_generator's Issues

ekUIGen Parallel DLL Access

Currently, I have a solution setup that's simplified to something like:

Project A gets an EmptyKeys UI generated for it through its dependent projects.
Project B gets an EmptyKeys UI generated for it through its dependent projects.
Project C depends on both A and B.
A and B have no common dependencies.

Building project A works great, building project B works great. When project C builds, VS parallelizes the builds of projects A and B, which means that ekUiGen attempts to run against two different projects at roughly the same time, which ends up throwing an IOException in the FileInfo.copy method.

The process cannot access the file '<solution path>\packages\EmptyKeysUI_Generator.2.3.0.0\tools\EmptyKeys.UserInterface.Designer.dll' because it is being used by another process.

Granted, the real solution here is for me to organize my projects better.
However, I tested adding a backoff strategy with a low upper limit around IOExceptions in File.copy - worked great, but pretty hacky.

Feel free to close if this is the wrong forum for this.

Binding ElementName not working

It seems that using ElementName in a binding should either generate an error, or it should generate different code. Currently, it seems to be ignored.

<ToggleButton x:Name="CheatButton">Cheat</ToggleButton>
<Popup x:Name="CheatPopup" StaysOpen="False" IsOpen="{Binding ElementName=CheatButton, Path=IsChecked}">
    <TextBlock>FooBarBaz</TextBlock>
</Popup>

The above generates the same code as the following (with ElementName=CheatButton removed):

<ToggleButton x:Name="CheatButton">Cheat</ToggleButton>
<Popup x:Name="CheatPopup" StaysOpen="False" IsOpen="{Binding Path=IsChecked}">
    <TextBlock>FooBarBaz</TextBlock>
</Popup>

The code that these both generate is:

this.CheatPopup = new Popup();
this.e_6.Children.Add(this.CheatPopup);
this.CheatPopup.Name = "CheatPopup";
Binding binding_CheatPopup_IsOpen = new Binding("IsChecked");
this.CheatPopup.SetBinding(Popup.IsOpenProperty, binding_CheatPopup_IsOpen);

which doesn't seem to be using the ElementName property.
At runtime, this generates the following error (I assume because IsChecked is a property of the CheatButton, not of the current DataContext)

An unhandled exception of type 'System.ArgumentException' occurred in EmptyKeys.UserInterface.dll

Additional information: Binding error: Property Path - Property not found

FWIW, it also would be useful to include the property path being looked for in the error, if possible. E.g., Additional information: Binding error: Property Path="IsChecked" - Property not found

EKUIGen copying working dir

When using the UI generator, dlls from the Working Directory are copied into the directory of EkUiGen, and left there after compilation takes place.

This is a problem when using a forked version, since these extra files are potentially seen by source control.

Failed to create type

When attempting to compile the following

<ResourceDictionary x:Class="MyGame.UI.Xaml.Resources"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    xmlns:local="clr-namespace:MyGame.UI.Xaml"
                    xmlns:vm="clr-namespace:MyGame.UI.ViewModels"
                    mc:Ignorable="d" >
    <DataTemplate DataType="{x:Type vm:SampleViewModel}"/>
</ResourceDictionary>

I receive the following error in the resultant file

error 'Failed to create a 'Type' from the text 'vm:SampleViewModel'.' Line number '1' and line position '422'.

With a stack trace shown in the EmptyKeys command line (attached as a file due to formatting issues)

The ViewModel namespace exists in the same assembly as the one being targeted for user interface generation. Using or omitting assembly in the vm namespace has no effect on the error

Input method problems

Hello I have encountered a problem. I can't use my input method to type in the input box. can you help me?

OS X / Xamarin Studio compatibility

Will the Generator support building on the Mac? Or is the intention to build on Windows and then use the output artifacts in Mac projects?

ScrollViewerAction.ScrollToBottom doesn't always scroll to bottom

First off, I'm not sure if this is the best place to post this because I know the scrolling functionality isn't implemented here. But I tried registering on the forum site and couldn't. No matter what I entered for the User Name it said that what I entered was invalid. For example, "abcdefg123" is invalid, according to the registration page.

Anyway, I'm wrapping a ListBox in a ScrollViewer, and added a scroll action in xaml like this...

<ScrollViewer ek:ScrollViewer.Action="{Binding ScrollAction}">
    <ItemsControl ItemsSource="{Binding LogMessages}">

And then added an event to my LogMessages ObservableCollection to set the scroll action when the collection changes, like this...

void LogMessagesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
    ScrollAction = ScrollViewerAction.None;
    ScrollAction = ScrollViewerAction.ScrollToBottom;
}

It works fine as long as I don't use the scroll bar while it's running. But if I manually scroll back up the list and leave it there, the next time the collection changes, it only scrolls down part way to the bottom, not all the way. If I manually scroll down to the bottom again, it continues to work as expected.

setting Popup's "Opened" property causes tool to fail

I'm trying to run code when a popup is opened, as follows:

<Popup Opened="PopupOpened">
    <TextBlock>FooBarBaz</TextBlock>
</Popup>

The above causes the generator to fail, exiting with code -2.

The full error follows:


System.Windows.Markup.XamlParseException: 'Failed to create a 'Opened' from the text 'PopupOpened'.' Line number '18' and line position '461'. ---> System.Argum
entException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
   at System.Delegate.CreateDelegate(Type type, Object target, String method, Boolean ignoreCase, Boolean throwOnBindFailure)
   at System.Delegate.CreateDelegate(Type type, Object target, String method)
   at System.Xaml.Schema.SafeReflectionInvoker.CreateDelegateCritical(Type delegateType, Object target, String methodName)
   at System.Xaml.Schema.SafeReflectionInvoker.CreateDelegate(Type delegateType, Object target, String methodName)
   at System.Xaml.EventConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value, XamlMember propert
y)
   at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String
targetName, IAddLineInfo lineInfo)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject
, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri)
   at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)
   at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)
   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
   at EmptyKeys.UserInterface.Generator.UserInterfaceGenerator.GenerateCode(String inputFileName, String inputFileContent, RenderMode renderMode, String desired
Namespace) in e:\!Prog\TFS\LogicMarbles\UIGenerator\UIGenerator\UserInterfaceGenerator.cs:line 55
System.Windows.Markup.XamlParseException: 'Failed to create a 'Opened' from the text 'PopupOpened'.' Line number '18' and line position '461'. ---> System.Argum
entException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
   at System.Delegate.CreateDelegate(Type type, Object target, String method, Boolean ignoreCase, Boolean throwOnBindFailure)
   at System.Delegate.CreateDelegate(Type type, Object target, String method)
   at System.Xaml.Schema.SafeReflectionInvoker.CreateDelegateCritical(Type delegateType, Object target, String methodName)
   at System.Xaml.Schema.SafeReflectionInvoker.CreateDelegate(Type delegateType, Object target, String methodName)
   at System.Xaml.EventConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value, XamlMember propert
y)
   at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String
targetName, IAddLineInfo lineInfo)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject
, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri)
   at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)
   at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)
   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
   at EmptyKeys.UserInterface.Generator.UserInterfaceGenerator.GenerateCode(String inputFileName, String inputFileContent, RenderMode renderMode, String desired
Namespace) in e:\!Prog\TFS\LogicMarbles\UIGenerator\UIGenerator\UserInterfaceGenerator.cs:line 61
   at ekUiGen.Program.Generate(String xamlFile, String outputFile, RenderMode renderMode, String desiredNamespace) in e:\!Prog\TFS\LogicMarbles\UIGenerator\ekUi
Gen\Program.cs:line 170
   at ekUiGen.Program.Main(String[] args) in e:\!Prog\TFS\LogicMarbles\UIGenerator\ekUiGen\Program.cs:line 126

EmptyKeys.UserInterface not found when using GeneratedBindings

I am trying to use generated bindings but there is no simple sample for it so I cannot figure out why this isn't working.

Using this :

<Grid ek:GeneratedBindings.Mode="Reflection" ek:GeneratedBindings.DataType="{x:Type data:ItemEndGameUI}">

I get this error :
1>------ Rebuild All started: Project: GameData, Configuration: Debug Any CPU ------ 1> GameData -> C:\Desktop\2.0 Projects\Games\Hazzah Engine\WPF UI\GameData\bin\Debug\GameData.dll 2>------ Rebuild All started: Project: ControlLayoutsWPF, Configuration: Debug Any CPU ------ 2> ControlLayoutsWPF -> C:\Desktop\2.0 Projects\Games\Block Games\ControlLayoutsWPF\bin\Debug\ControlLayoutsWPF.dll 2> Empty Keys (c) 2016 User Interface Generator Console v3.0.0.0 2> System.Windows.Markup.XamlParseException: 'Failed to create a 'Type' from the text 'data:ItemEndGameUI'.' Line number '1' and line position '591'. ---> System.Xaml.XamlParseException: Type reference cannot find type named '{clr-namespace:GameData;assembly=GameData}ItemEndGameUI'. 2> at MS.Internal.Xaml.Context.ObjectWriterContext.ServiceProvider_Resolve(String qName) 2> at MS.Internal.Xaml.ServiceProviderContext.System.Windows.Markup.IXamlTypeResolver.Resolve(String qName) 2> at System.Xaml.Replacements.TypeTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) 2> at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter1 ts, Object value)
2> at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter1 ts, Object value, XamlMember property) 2> at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo)
2> --- End of inner exception stack trace ---
2> at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
2> at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri)
2> at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)
2> at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)
2> at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
2> at EmptyKeys.UserInterface.Generator.UserInterfaceGenerator.GenerateCode(String inputFileName, String inputFileContent, RenderMode renderMode, String desiredNamespace, String header) in E:!Prog\TFS\LogicMarbles\UIGenerator\UIGenerator\UserInterfaceGenerator.cs:line 57
2> System.Windows.Markup.XamlParseException: 'Failed to create a 'Type' from the text 'data:ItemEndGameUI'.' Line number '1' and line position '591'. ---> System.Xaml.XamlParseException: Type reference cannot find type named '{clr-namespace:GameData;assembly=GameData}ItemEndGameUI'.
2> at MS.Internal.Xaml.Context.ObjectWriterContext.ServiceProvider_Resolve(String qName)
2> at MS.Internal.Xaml.ServiceProviderContext.System.Windows.Markup.IXamlTypeResolver.Resolve(String qName)
2> at System.Xaml.Replacements.TypeTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
2> at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter1 ts, Object value) 2> at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter1 ts, Object value, XamlMember property)
2> at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo) 2> --- End of inner exception stack trace --- 2> at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) 2> at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri) 2> at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext) 2> at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode) 2> at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext) 2> at EmptyKeys.UserInterface.Generator.UserInterfaceGenerator.GenerateCode(String inputFileName, String inputFileContent, RenderMode renderMode, String desiredNamespace, String header) in E:\!Prog\TFS\LogicMarbles\UIGenerator\UIGenerator\UserInterfaceGenerator.cs:line 63 2> at ekUiGen.Program.Generate(String xamlFile, String outputFile, RenderMode renderMode, String desiredNamespace, String defaultAssembly, String header) in E:\!Prog\TFS\LogicMarbles\UIGenerator\ekUiGen\Program.cs:line 217 2> at ekUiGen.Program.Main(String[] args) in E:\!Prog\TFS\LogicMarbles\UIGenerator\ekUiGen\Program.cs:line 152 2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5074,5): error MSB3073: The command "CD "C:\Desktop\2.0 Projects\Games\Block Games\packages\EmptyKeysUI_Generator*\tools" 2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5074,5): error MSB3073: ekUIGen.exe -i="C:\Desktop\2.0 Projects\Games\Block Games\ControlLayoutsWPF\\" -o="C:\Desktop\2.0 Projects\Games\Block Games\ControlLayoutsWPF\..\Craft World\Source\WPF UI" -oa="C:\Desktop\2.0 Projects\Games\Block Games\ControlLayoutsWPF\..\Craft World\Source Content\WPF Content" -rm=MonoGame /generate-bindings" exited with code -2. ========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

DataTemplates aren't being styled using default styles

The following snippet, inside of a ResourceDictionary doesn't seem to be working as expected:

<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
    <Setter Property="FontFamily" Value="Kootenay"/>
    <Setter Property="FontSize" Value="12"/>
</Style>
<DataTemplate DataType="{x:Type data:CustomWindow}">
    <Border Background="Blue">
        <StackPanel>
            <TextBlock Text="{Binding TextData}" />
        </StackPanel>
    </Border>
</DataTemplate>

The style block is setting the default font for TextBlocks, but the generator isn't taking it into consideration. When it generates code, it includes both the specified font, as well as the old default font:

FontManager.Instance.AddFont("Tahoma", 11F, FontStyle.Regular, "Tahoma_8.25_Regular");
FontManager.Instance.AddFont("Kootenay", 12F, FontStyle.Regular, "Kootenay_9_Regular");

However, changing defaults work elsewhere in EK.

If instead of trying to set the default, I specify a specific style:

<Style x:Key="NotDefault" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
    <Setter Property="FontFamily" Value="Kootenay"/>
    <Setter Property="FontSize" Value="12"/>
</Style>
<DataTemplate DataType="{x:Type data:CustomWindow}">
    <Border Background="Blue">
        <StackPanel>
            <TextBlock Style="{StaticResource NotDefault}" Text="{Binding TextData}" />
        </StackPanel>
    </Border>
</DataTemplate>

the generated code is correct, and only includes a reference to Kootenay.

I think we can enhance the textBox

Game.TextChanged can be captured on monogame's desktopgl to get the characters entered by the user, not just the normal 26 characters. I tested it can receive multiple bytes.

image

#error This type is not supported - POCO Object

Hello,

I am attempting to create a Xaml serialization of a POCO object:

namespace GameData
{
    public class Testing
    {

        public string PropertyName { get; set; }
    }
}

And Xaml:

<gameData:Testing
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:gameData="clr-namespace:GameData;assembly=GameData"
    mc:Ignorable="d" 
    PropertyName="Hello World" />

Upon generation, I get the following message/error:
2> Generating C:\Users...\Testing.xaml
2> #error This type is not supported - GameData.Testing

Is definition/serialization of POCO's supported? They should be. ๐Ÿ˜„ I can see myself defining all sorts of objects in my application using this mechanism, not just UI-centric items. To be sure, System.Xaml was made into its own assembly so that other non-UI-related applications (Workflow Foundation, for example) can utilize it. It would be great to see this project take the same approach.

StyleCop for generated files

It would be helpful if generated code files had the following comment at top, so that there aren't thrown hundreds of warnings for those who use common style checkers like Stylecop.

// <auto-generated />

Roslyn?

Cool project. :)

Looks like the code generation is based on the older CodeCom model. Are there plans to leverage/utilize the new Roslyn engine in VS2015?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.