These are chat archives for AvaloniaUI/Avalonia

17th
Apr 2017
Tomi Valkeinen
@tomba
Apr 17 2017 08:17
are the Linux build instructions up to date for master branch? I've never built Avalonia before, and so far I've had no luck on Ubuntu 16.04.
I've tried both cmdline build and monodevelop, with latest mono and monodevelop
danwalmsley
@danwalmsley
Apr 17 2017 08:37
@tomba where are you getting stuck?
Probably they do need updating
Tomi Valkeinen
@tomba
Apr 17 2017 08:41
@danwalmsley well, monodevelop refuses to open most of the projects. on cmdline, looks like nuget doesn't restore any packages, and xbuild complains also about the project files.
I'm guessing it's related to this change "Switched to .NETStandard (mostly 1.1)"
but, again, first time trying out Avalonia, so just guessing here
Wiesław Šoltés
@wieslawsoltes
Apr 17 2017 08:59
@tomba Avalonia has switched to new csproj system. Not sure if monodevelop can build Avalonia on Linux.
You can try building using command-line with .NET Core tooling https://www.microsoft.com/net/core#linuxubuntu
cd samples/ControlCatalog.NetCore
dotnet restore
dotnet build
dotnet run
This should restore NuGet packages, build Avalonia core libraries and run sample .NET Core app.
Tomi Valkeinen
@tomba
Apr 17 2017 09:08
@wieslawsoltes thanks, that worked
Wiesław Šoltés
@wieslawsoltes
Apr 17 2017 11:30
@grokys @kekekeks I have updated https://github.com/AvaloniaUI/Avalonia/wiki/Build-Avalonia-from-Source wiki page with .NET Core build instructions, the mono instruction will currently not work, but after mono 5 is releases this should change so I have left those instructions.
danwalmsley
@danwalmsley
Apr 17 2017 14:45
guys is there a way in avalonia to schedule a task into the message loop and have it cancelled if needed?
Dispatcher.UIThread, could work, but doesn't provide a way to cancel,
@grokys
danwalmsley
@danwalmsley
Apr 17 2017 14:50
basically I have to hook into a callback like this
protected override void OnScheduleMessagePumpWork(long delayMs)
if the delay is 0, it should be run asap
and if there is a delay specified I need to delay for the specified time, before calling required function
and then if there is already something scheduled it needs canceling
danwalmsley
@danwalmsley
Apr 17 2017 16:22
this more or less did the trick
if (_current != null)
                {
                    _current.Dispose();
                }

                if (delayMs <= 0)
                {
                    delayMs = 10;
                }

                _current = Observable.Interval(TimeSpan.FromMilliseconds(delayMs)).ObserveOn(AvaloniaScheduler.Instance).Subscribe((i) =>
                {
                    CefRuntime.DoMessageLoopWork();

                });
I know its not technically correct, but seems to work
Steven Kirk
@grokys
Apr 17 2017 16:24
@danwalmsley there's nothing that does the "cancel if required" part but there's DispatcherTimer.RunOnce
you could do the "cancel if required" part yourself using the returned IDisposable?
danwalmsley
@danwalmsley
Apr 17 2017 16:26
@grokys awesome sounds like it should work well
thanks
Wiesław Šoltés
@wieslawsoltes
Apr 17 2017 17:06
@grokys @kekekeks Maybe we could integrate this service into Avalonia repo https://www.codefactor.io
danwalmsley
@danwalmsley
Apr 17 2017 17:44
wow that is awesome
setting it up for Avalon studio