Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Felix Queißner
    @MasterQ32
    there should be some kind of support for TypeConverter or some other conversion facility as in WPF
    but i think that's not news to you
    Curtis Wensley
    @cwensley
    PCL will be eventually replaced with .NET Standard, which does allow greater access to things like TypeConverter, but it's not finished.
    Felix Queißner
    @MasterQ32
    hmm
    my current use case is the following:
    i want to bind a OpenTK.Vector3 to a text box for visualization
    it implements a TypeConverter
    so either i must create a wrapper class or use some other conversion facility
    Curtis Wensley
    @cwensley
    You can use the binding's Convert() extension to do some of this.. and then wrap it in a custom extension so it'd be easy to reuse in your project.
    Felix Queißner
    @MasterQ32
    how does the convert work?
    my current binding looks like this:
    tbPosition.TextBinding.BindDataContext(nameof(Agent.Position));
    Curtis Wensley
    @cwensley
    Binding.Property((MyModel m) => m.MyProperty).Convert(v => v.ToString(), s => MySomething.FromString(s));
    so you'd change it to: tbPosition.TextBinding.BindDataContext(Binding.Property(nameof(Agent.Position)).Convert(...))
    and in the Convert() you can use the type converter to get/set the value
    if you just want to display the value (not edit), then you just have to define the conversion to string.
    Felix Queißner
    @MasterQ32
    okay, i see that i can use an IValueConverter as well?
    Curtis Wensley
    @cwensley
    yup
    Felix Queißner
    @MasterQ32
    tbPosition.TextBinding.BindDataContext(Binding.Property<Vector3>(nameof(Agent.Position)).Convert<string>(new Vector3Converter()));
    System.InvalidCastException: Object must implement IConvertible.
    or did i do something wrong?
    ah wait, my fault
    nevermind
    okay, another question: can i somehow run the application synchronous with another UI "thread"?
    Curtis Wensley
    @cwensley
    as a hint, this: Binding.Property<Vector3>(nameof(Agent.Position)) is sometimes easier to write like this, so the type is inferred: Binding.Property((Agent m) => m.Position)
    Felix Queißner
    @MasterQ32
    yeah, but most probably i will have more than one type bound to the datacontext :P
    Curtis Wensley
    @cwensley
    Not sure what you mean how to run it synchronous with another UI thread.. do you have multiple UI toolkits in use or something?
    Felix Queißner
    @MasterQ32
    similar
    Curtis Wensley
    @cwensley
    btw, might want to move this over to #picoe/Eto
    Felix Queißner
    @MasterQ32
    i have OpenTK and Eto.Forms
    yeah, sure :D
    Felix Queißner
    @MasterQ32
    hey
    Curtis Wensley
    @cwensley
    hi!
    Felix Queißner
    @MasterQ32
    i'm having a problem with eto.parse again
    i'm using this grammar

    I have a problem with two rules:

    generic_type = name '<' expression_list '>';

    and

    binop = … | '<' | '>' ;
    if i change generic_type to not use < and > and use some other symbols instead, it works perfectly fine
    but right now, i can't get generics recognized
    the input to the grammar is this:
    type t = int<1,2>;
    Felix Queißner
    @MasterQ32
    any idea?
    Curtis Wensley
    @cwensley
    probably due to order of the alternatives, if the binop is matched, it will continue to the next rule but not rewind to try any other alternatives
    due to Eto.Parse being recursive descent
    Felix Queißner
    @MasterQ32
    hm, i understand
    how can i fix this? change the order of definition?
    Curtis Wensley
    @cwensley
    so if you can get it to try to match the generic type before the binop, then it should theoretically work
    rewinding is one feature I'd like to add to Eto.Parse so it'd better handle this situation, but that's a very complex task (;
    Felix Queißner
    @MasterQ32
    can you explain how to interpret the output from Match.Errors ?
    Curtis Wensley
    @cwensley
    it gives you a list of rules that are expected at that particular point in the string.
    Felix Queißner
    @MasterQ32
    okay, i have discovered match.ErrorMessage right now
    and i've found the problem: it's the closing >
    as it tries to interpret 2> as an expression instead of a end match