Ejemplo n.º 1
0
 public Application()
 {
     loop          = new DispatcherEventLoop();
     icon          = LoadIcon();
     windowFactory = WindowFactory.Create(hIcon: icon.Handle);
     windows       = new HashSet <WindowCore>();
 }
Ejemplo n.º 2
0
 private void lstProcessWindows_DoubleClick(object sender, EventArgs e)
 {
     if (lstProcessWindows.SelectedItem != null)
     {
         WindowFactory.Create(((IWindow)lstProcessWindows.SelectedItem).Handle).SetPosition(0, 0);
     }
 }
        /// <summary>
        /// The Test.
        /// </summary>
        /// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
        protected override void Test(Window testWindow)
        {
            var globalBrowserData = new GlobalBrowserData();
            var viewModel         = new WebBrowserTabControlViewModel(globalBrowserData);
            var cefWindowData     = viewModel.CefWindowData;
            var view = new WebBrowserTabControlView {
                DataContext = viewModel
            };
            var window = WindowFactory.Create(view, testWindow);

            viewModel.TabItems.Add(new WebBrowserHeaderedItemViewModel(globalBrowserData, cefWindowData, null));
            cefWindowData.MainWindow = window;;
            window.ShowDialog();
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
 static int Main(string[] args)
 {
     ApplicationHelpers.SetupDefaultExceptionHandlers();
     try
     {
         var factory = WindowFactory.Create();
         using (var win = factory.CreateWindow(() => new MainWindow(),
                                               "Hello", constructionParams: new FrameWindowConstructionParams()))
         {
             win.Show();
             return(new EventLoop().Run(win));
         }
     }
     catch (Exception ex) {
         ApplicationHelpers.ShowCriticalError(ex);
     }
     return(0);
 }
Ejemplo n.º 6
0
        static int Main(string[] args)
        {
            ApplicationHelpers.SetupDefaultExceptionHandlers();

            try
            {
                var factory = WindowFactory.Create();
                using (var win = Window.Create <SampleWindow>(factory: factory, text: "Hello"))
                {
                    win.Show();
                    return(new EventLoop().Run(win));
                }
            }
            catch (Exception ex) {
                ApplicationHelpers.ShowCriticalError(ex);
            }
            return(0);
        }
Ejemplo n.º 7
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);
     }
 }
Ejemplo n.º 8
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);
     }
 }
        public WinUsbConnectionService()
        {
            currentContext = SynchronizationContext.Current;
            add($"vid_{TreehopperUsb.Settings.Vid:x}&pid_{TreehopperUsb.Settings.Pid:x}");
            var wf = WindowFactory.Create();

            // We can only hear WM_DEVICECHANGE messages if we're an STA thread that's properly pumping windows messages.
            // There's no easy way to tell if the calling thread is pumping messages, so just check the apartment state, and assume people
            // aren't creating STA threads without a message pump.

            devNotifyThread = new Thread(() =>
            {
                mNotifyWindow = wf.CreateWindowEx(() => new UsbNotifyWindow(this), null);
                mNotifyWindow.Show();
                loop = new RealtimeEventLoop();
                loop.Run(mNotifyWindow);
            })
            {
                Name = "DevNotifyNativeWindow Thread"
            };
            devNotifyThread.Start();
        }
Ejemplo n.º 10
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);
     }
 }