Fix initial Forms size

This commit is contained in:
Frank A. Krueger 2018-03-12 20:56:43 -07:00
parent 1f5b1fe13a
commit 64e6602e79
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
4 changed files with 18 additions and 6 deletions

9
Ooui.Wasm/Makefile Normal file
View File

@ -0,0 +1,9 @@
all:
msbuild /t:Restore ../Ooui.Forms/Ooui.Forms.csproj
msbuild ../Ooui.Forms/Ooui.Forms.csproj
cp ../Ooui.Forms/bin/Debug/netstandard1.0/Ooui.Forms.dll managed/
cp ../Ooui/bin/Debug/netstandard1.0/Ooui.dll managed/
csc /nostdlib /target:library \
/r:managed/mscorlib.dll /r:managed/System.Runtime.dll /r:managed/Xamarin.Forms.Core.dll /r:managed/Xamarin.Forms.Xaml.dll /r:managed/Ooui.dll /r:managed/Ooui.Forms.dll \
/out:managed/Ooui.Sample.dll ../Samples/ISample.cs ../Samples/XamlPreviewPageSample.cs ooui-sample.cs

View File

@ -16,9 +16,9 @@ public class Program
return e; return e;
} }
static Element GetBoxViewClockElement () static Element GetXamarinFormsElement ()
{ {
var s = new Samples.BoxViewClockSample (); var s = new Samples.XamlPreviewPageSample ();
return s.CreateElement (); return s.CreateElement ();
} }
@ -26,7 +26,7 @@ public class Program
{ {
Xamarin.Forms.Forms.Init (); Xamarin.Forms.Forms.Init ();
try { try {
var e = GetBoxViewClockElement (); var e = GetXamarinFormsElement ();
UI.SetGlobalElement ("main", e); UI.SetGlobalElement ("main", e);
return e.ToString (); return e.ToString ();
} }

View File

@ -21,6 +21,7 @@
"Newtonsoft.Json.dll", "Newtonsoft.Json.dll",
"System.dll", "System.dll",
"System.Collections.dll", "System.Collections.dll",
"System.ComponentModel.dll",
"System.ComponentModel.TypeConverter.dll", "System.ComponentModel.TypeConverter.dll",
"System.Core.dll", "System.Core.dll",
"System.Diagnostics.Debug.dll", "System.Diagnostics.Debug.dll",

View File

@ -596,15 +596,17 @@ namespace Ooui
} }
} }
public static void StartWebAssemblySession (string sessionId, string globalElementId) public static void StartWebAssemblySession (string sessionId, string globalElementId, string initialSize)
{ {
Element element; Element element;
lock (globalElements) { lock (globalElements) {
if (!globalElements.TryGetValue (globalElementId, out element)) if (!globalElements.TryGetValue (globalElementId, out element))
return; return;
} }
var ops = initialSize.Split (' ');
var g = new WebAssemblySession (sessionId, element, 640, 480); var initialWidth = double.Parse (ops[0]);
var initialHeight = double.Parse (ops[1]);
var g = new WebAssemblySession (sessionId, element, initialWidth, initialHeight);
lock (globalElementSessions) { lock (globalElementSessions) {
globalElementSessions[sessionId] = g; globalElementSessions[sessionId] = g;
} }