Init PlatformFeatures, ProcCommandLineArgs b4 ShowAsSystemWindow

This commit is contained in:
John Lewin 2018-08-02 17:56:59 -07:00
parent ca9380bd3f
commit 82a28479cf
2 changed files with 5 additions and 7 deletions

View file

@ -2399,8 +2399,6 @@ namespace MatterHackers.MatterControl
private static string lastSection = "";
private static Stopwatch timer;
public static string PlatformFeaturesProvider { get; set; } = "MatterHackers.MatterControl.WindowsPlatformsFeatures, MatterControl";
public static SystemWindow LoadRootWindow(int width, int height)
{
timer = Stopwatch.StartNew();
@ -2780,8 +2778,6 @@ namespace MatterHackers.MatterControl
public static async Task<GuiWidget> Initialize(SystemWindow systemWindow, Action<double, string> reporter)
{
AppContext.Platform = AggContext.CreateInstanceFrom<INativePlatformFeatures>(PlatformFeaturesProvider);
reporter?.Invoke(0.01, "PlatformInit");
AppContext.Platform.PlatformInit((status) =>
{
@ -2808,9 +2804,6 @@ namespace MatterHackers.MatterControl
reporter?.Invoke(0.8, "Plugins");
AppContext.Platform.FindAndInstantiatePlugins(systemWindow);
reporter?.Invoke(0.9, "Process Commandline");
AppContext.Platform.ProcessCommandline();
reporter?.Invoke(0.91, "OnLoadActions");
applicationController.OnLoadActions();

View file

@ -70,6 +70,11 @@ namespace MatterHackers.MatterControl
};
}
// Init platformFeaturesProvider before ShowAsSystemWindow
string platformFeaturesProvider = "MatterHackers.MatterControl.WindowsPlatformsFeatures, MatterControl";
AppContext.Platform = AggContext.CreateInstanceFrom<INativePlatformFeatures>(platformFeaturesProvider);
AppContext.Platform.ProcessCommandline();
// Get startup bounds from MatterControl and construct system window
//var systemWindow = new DesktopMainWindow(400, 200)
var (width, height) = RootSystemWindow.GetStartupBounds();