Exemple #1
0
        static int Main(string[] args)
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

            {
                //new System.Drawing.android.android();

                var path = Assembly.GetExecutingAssembly().CodeBase?.ToString();
                var dir  = Path.GetDirectoryName(path).Replace("file:\\", "");
                Assembly.LoadFile(dir +
                                  Path.DirectorySeparatorChar +
                                  "System.Drawing.dll");
                Assembly.LoadFile(dir +
                                  Path.DirectorySeparatorChar +
                                  "System.Drawing.Common.dll");

                var file       = File.ReadAllText("SkiaTest.deps.json");
                var fileobject = JsonConvert.DeserializeObject(file) as JObject;
                var baditem    = ((JObject)fileobject["targets"][".NETCoreApp,Version=v3.1"]).Property("System.Drawing.Common/4.7.0");
                if (baditem != null)
                {
                    baditem.Remove();
                }
                File.WriteAllText("SkiaTest.deps.json", fileobject.ToString());
            }

            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

            try
            {
                ApplicationHelpers.SetupDefaultExceptionHandlers();
                var factory = WindowFactory.Create(hBgBrush: IntPtr.Zero);
                using (var win = factory.CreateWindow(() => new SkiaWindow(), "Hello",
                                                      constructionParams: new FrameWindowConstructionParams()))
                {
                    win.SetSize(900, 540 + 30);
                    win.Show();
                    return(new EventLoop().Run(win));
                }
            }
            catch (Exception ex)
            {
                MessageBoxHelpers.ShowError(ex);
                return(1);
            }
        }
Exemple #2
0
 static int Main(string[] args)
 {
     try
     {
         ApplicationHelpers.SetupDefaultExceptionHandlers();
         Gl.Initialize();
         var factory = WindowFactory.Create(hBgBrush: Gdi32Helpers.GetStockObject(StockObject.BLACK_BRUSH));
         using (var win = Window.Create <AppWindow>(factory: factory, text: "Hello"))
         {
             win.Show();
             return(new EventLoop().Run(win));
         }
     }
     catch (Exception ex)
     {
         MessageBoxHelpers.ShowError(ex);
         return(1);
     }
 }
Exemple #3
0
 static int Main(string[] args)
 {
     try
     {
         ApplicationHelpers.SetupDefaultExceptionHandlers();
         // Using it without a dependency on WinApi.Windows.Controls
         var factory = WindowFactory.Create(hBgBrush: IntPtr.Zero);
         using (var win = factory.CreateWindow(() => new SkiaWindow(), "Hello",
                                               constructionParams: new FrameWindowConstructionParams()))
         {
             win.Show();
             return(new EventLoop().Run(win));
         }
     }
     catch (Exception ex)
     {
         MessageBoxHelpers.ShowError(ex);
         return(1);
     }
 }
Exemple #4
0
 static int Main(string[] args)
 {
     try
     {
         ApplicationHelpers.SetupDefaultExceptionHandlers();
         var factory = WindowFactory.Create(hBgBrush: IntPtr.Zero);
         // Create the window without a dependency on WinApi.Windows.Controls
         using (
             var win = factory.CreateWindow(() => new MainWindow(), "Hello",
                                            constructionParams: new FrameWindowConstructionParams(),
                                            exStyles: WindowExStyles.WS_EX_APPWINDOW | WindowExStyles.WS_EX_NOREDIRECTIONBITMAP))
         {
             win.CenterToScreen();
             win.Show();
             return(new EventLoop().Run(win));
         }
     }
     catch (Exception ex)
     {
         MessageBoxHelpers.ShowError(ex);
         return(1);
     }
 }