These are chat archives for AvaloniaUI/Avalonia

24th
Aug 2016
Andrew
@zezba9000
Aug 24 2016 01:32
@grokys I'm in the process of porting some stuff so will know a little later. Will let you know.
@danwalmsley I don't really agree with MVVM for apps that only use one UI layout, it over abstracts things and gets you nothing for it. MV makes more sense for a GitGUI with desktop as its only target. No need for it to run on a phone etc.
danwalmsley
@danwalmsley
Aug 24 2016 08:16
@zezba9000 fair enough
that sounds like mvvm but your view model is also your model right?
that's a shortcut I use quite a lot when it makes sense
you can use as much or as little as you like
but you will definitely find Avalonia difficult to use
if you don't use INotifyPropertyChanged based properties
and bind to those
danwalmsley
@danwalmsley
Aug 24 2016 09:08
@kekekeks what do we need to do to enable gpu in skia?
just switch it on
or does api completely change?
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 09:35
Matthijs ter Woord
@mterwoord
Aug 24 2016 09:44
@zezba9000 MV you mean skip the VM part and put all logic in your model?
danwalmsley
@danwalmsley
Aug 24 2016 09:55
@mterwoord I think he is doing everything in code behind
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 09:55
MV works great until you want to use command bindings.
danwalmsley
@danwalmsley
Aug 24 2016 09:55
so its just 'V'
I think
Matthijs ter Woord
@mterwoord
Aug 24 2016 09:55
@danwalmsley not really, pretty much always have a model (database, etc)
danwalmsley
@danwalmsley
Aug 24 2016 09:55
@wieslawsoltes is MV where model and Viewmodel are same class?
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 09:55
yes
danwalmsley
@danwalmsley
Aug 24 2016 09:56
ah ok
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 09:56
I found this the hard way
danwalmsley
@danwalmsley
Aug 24 2016 09:56
yeh iv do that quite a lot
putting all your model code in code behind is not MV though
Matthijs ter Woord
@mterwoord
Aug 24 2016 09:56
i use mvvm, not because of switching views, but for separation: then using sourcecontrol, you can easily see if its logic that changes, or presnetation
danwalmsley
@danwalmsley
Aug 24 2016 09:56
its just V
basically the old WinForms way
Matthijs ter Woord
@mterwoord
Aug 24 2016 09:57
y
danwalmsley
@danwalmsley
Aug 24 2016 09:57
that's the problem with MVVM it has a barrier to entry I think
Matthijs ter Woord
@mterwoord
Aug 24 2016 09:57
if i didn't do viewmodels, i'd use winforms...
(or some smilar toolkit
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 09:58
If you only plan to present data than you can get away with MV, but when you want to introduce editing (add, remove action etc.) than I would go with full MVVM
danwalmsley
@danwalmsley
Aug 24 2016 10:24
yeah
in Avalon studio, a lot of time I used MV where it would have just been a long excersise to create a separate model, and implement model to vm comms
but it only works for simple cases
@wieslawsoltes it would be nice if Avalonia had like a basic ViewModel base class you could inherit
that provides, this.SetAndRaiseIfChanged, this.RaisePropertyChanged, etc
do you think that kind of thing could come with Avalonia?
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:03
@danwalmsley They've did the right thing: just exposed opengl-related classes from Skia
So we need to port our old C++ code that deals with opengl context management

@wieslawsoltes

currently OpenGL only

Skia doesn't support DirectX, one needs to provide opengl context from ANGLE, that translates opengl calls to directx

So their example can be used with directx
I should have time to properly implement that, once I sort out my current real-estate-related-pain-in-the-ass issues
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:47
@wieslawsoltes, @kekekeks, @danwalmsley a new set of updates will be out soon. A few fixes and some extra GPU bits... Not DX on this version, but soon. The downside with DX is that i have to switch from OpenGL. I can't have GL and DX on Windows desktop, which is not really a problem I suppose
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:48
@mattleibow are you talking about ANGLE or there is some new DX backend in Skia?
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:48
Basically, instead of calling GL, the calls are routed through ANGLE to DX, so no side-by-side support in the traditional sense
But, there is no reason why we can't have two sets of dolls for Windows...
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:49
Well, if one manually obtains opengl function pointers using LoadLibrary/GetProcAddress
There should be no problem with having them side by side
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:49
Gotcha
I added support for that in this release
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:50
So it's better to not link opengl.dll or angle to the native binary at all
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:50
Also, I tested and got angle to work. So DX is good
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:50
Since it internally uses function pointer approach and doesn't depend on specific native opengl implementation
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:50
Ah... That might be a good thing
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:51
If I remember correctly, angle provides some sort of ELG implementation for attaching to the actual window
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:51
Yes
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:51
And native opengl.dll uses some windows-specific (wgl-prefixed) calls
Matthew Leibowitz
@mattleibow
Aug 24 2016 11:52
MS has their own ANGLE releases on NuGet which might be usable
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:52
There was also some GrContext-related magic to get SkCanvas working with offscreen surfaces
Did you see this one? Is this what you we're thinking?
Nikita Tsukanov
@kekekeks
Aug 24 2016 11:53
Yep, exactly what's needed
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 12:21

@danwalmsley

@wieslawsoltes it would be nice if Avalonia had like a basic ViewModel base class you could inherit

Than you would take dependency on Avalonia in your core libraries. I want my core to be independent as its used in Avalonia and in WPF.

danwalmsley
@danwalmsley
Aug 24 2016 12:22
ah yes you are right
Nikita Tsukanov
@kekekeks
Aug 24 2016 12:22
We could have a separate assembly for that
Wiesław Šoltés
@wieslawsoltes
Aug 24 2016 12:22
Avalonia.MVVM :)
Nikita Tsukanov
@kekekeks
Aug 24 2016 12:22
That doesn't depend on anything at all
danwalmsley
@danwalmsley
Aug 24 2016 12:22
@kekekeks it would be nice to have maybe an Avalonia.MVVM
it was the other day when was trying to show my brother how to use it
when he attempted it on his own
Nikita Tsukanov
@kekekeks
Aug 24 2016 12:22
Well, Avalonia.Base is a good candidate for that
danwalmsley
@danwalmsley
Aug 24 2016 12:22
it wasn't obvious he needed an mvvm framework first
Nikita Tsukanov
@kekekeks
Aug 24 2016 12:23
It contains stuff needed for observable properties and bindings
And doesn't seem to depend on platform-specific stuff or Application
danwalmsley
@danwalmsley
Aug 24 2016 12:24
most of the time I'm using ReactiveUI because I get it for free with Avalonia
Nikita Tsukanov
@kekekeks
Aug 24 2016 12:24
It does contain some platfrom-related types, but they can be safely extracted to another assembly
danwalmsley
@danwalmsley
Aug 24 2016 12:24
so if that provides Reactive UI that would be the one to use (Avalonia.Base)
I mean
Andrey Kunchev
@donandren
Aug 24 2016 12:25
@danwalmsley @wieslawsoltes Actually there is something that can be used as ViewModel base in Avalonia.ReactiveUI - ReactiveObject
Nikita Tsukanov
@kekekeks
Aug 24 2016 12:25
For now Avalonia.Base contains core AvaloniaObject stuff and bindings
And platform/config-related types that are used in other parts of the project
I think that could be separated
danwalmsley
@danwalmsley
Aug 24 2016 12:27
@donandren yeah that's what I'm using...
but with a wrapper like this....
public abstract class ViewModel : ViewModel<object>
    {
        protected ViewModel() : base(null)
        {
        }
    }
and
public abstract class ViewModel<T> : ReactiveObject
    {
        private T _model;

        protected ViewModel(T model)
        {
            _model = model;
        }

        public T Model
        {
            get { return _model; }
            set
            {
                this.RaiseAndSetIfChanged(ref _model, value);
                Invalidate();
            }
        }

        public void Invalidate()
        {
            this.RaisePropertyChanged("");
        }
    }
just gives me a few extras like automatically putting a model property on the viewmodel
and allows you to trigger update of entire model
(which is bad)
that would be my candidate ViewModel for Avlonia.Mvvm
but with wrapper methods around RaisePropertyChanged, etc
so I don't have to do
using System;
using ReactiveUI;
just to get very basics
Jeremy Koritzinsky
@jkoritzinsky
Aug 24 2016 23:00
Hey @grokys I'm working on implementing the extensibility framework proposal that I made, but I'm running into an issue. I need to have the IPclPlatformWrapper implementation registered before I can scan for windowing systems. However, this implementation is registered by the windowing system. Since it's runtime platform specific and not windowing platform specific, do you think there's another place we could move this? Or do you think .Net Core will fix this?