예제 #1
0
        static void Main(string[] args)
        {
#if WINDOWS
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);
            Debug.Assert(oleres == 0);
#endif

            Console.WriteLine("Sciter: " + SciterX.Version);

            // Create the window
            var wnd = new SciterWindow();
            wnd.CreateMainWindow(1500, 800);
            wnd.CenterTopLevelWindow();
            wnd.Title = "Sciter Bootstrap";
#if WINDOWS
            wnd.Icon = Properties.Resources.IconMain;
#endif

            // Prepares SciterHost and then load the page
            var host = new Host();
            host.SetupWindow(wnd);
            host.RegisterBehaviorHandler(typeof(DrawBitmapBehavior), "DrawBitmap");
            host.RegisterBehaviorHandler(typeof(DrawTextBehavior), "DrawText");
            host.RegisterBehaviorHandler(typeof(DrawGeometryBehavior), "DrawGeometry");
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");

            // Show window and Run message loop
            wnd.Show();
            PInvokeUtils.RunMsgLoop();

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
예제 #2
0
        static void Main(string[] args)
        {
            MessageBox.Show(IntPtr.Zero, "ola", "mnundo");

            if (IntPtr.Size == 4)
            {
                Debug.Assert(false, "sciter.dll that comes bundled in TestGTK is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)");
            }

#if WINDOWS
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);
            Debug.Assert(oleres == 0);
#endif
#if GTKMONO
            PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero);
            Mono.Setup();
#endif

            /*
             *      NOTE:
             *      In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH.
             *      Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system.
             */
            // Create the window
            AppWindow = new Window();

            // Prepares SciterHost and then load the page
            AppHost = new Host(AppWindow);

            // Run message loop
            PInvokeUtils.RunMsgLoop();
        }
예제 #3
0
        static void Main(string[] args)
        {
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);

            Debug.Assert(oleres == 0);

            // Create the window
            var wnd = WndGlobal = new Window();

            // Prepares SciterHost and then load the page
            var host = AppHost = new Host();

            host.Setup(wnd);
            host.AttachEvh(new HostEvh());
            host.RegisterBehaviorHandler(typeof(AreaChart));
            host.SetupPage("index.html");
            //host.SetupPage("widgets/dolar.html");

            HookerInstance.SetMessageHook();

            // Show window and Run message loop
            wnd.Show();
            PInvokeUtils.RunMsgLoop();

            HookerInstance.ClearHook();

            FinalizeApp();
        }
예제 #4
0
 public void TestThrowsWin32Exception()
 {
     Assert.Throws <Win32Exception>(delegate
     {
         var result1 = PInvokeUtils.Try(() => JobObjectAPI.CloseHandle(IntPtr.Zero), result => result);
     });
 }
예제 #5
0
        static void Main(string[] args)
        {
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);

            Debug.Assert(oleres == 0);

            // Create the window
            var wnd = WndGlobal = new Window();

            wnd.CreateMainWindow(100, 100, SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_MAIN | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_ALPHA | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_ENABLE_DEBUG);
            wnd.HideTaskbarIcon();
            wnd.Title = Window.WND_TITLE;
            wnd.Icon  = Properties.Resources.IconMain;

            // Prepares SciterHost and then load the page
            var host = new Host();

            host.Setup(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");

            HookerInstance.SetMessageHook();

            // Show window and Run message loop
            wnd.Show();
            PInvokeUtils.RunMsgLoop();

            HookerInstance.ClearHook();

            FinalizeApp();
        }
예제 #6
0
        static void Main(string[] args)
        {
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);

            Debug.Assert(oleres == 0);

            // Create the window
            var wnd = new SciterWindow();

            wnd.CreateMainWindow(1500, 800);
            wnd.CenterTopLevelWindow();
            wnd.Title = "SciterBootstrap";
            wnd.Icon  = Properties.Resources.IconMain;

            // Prepares SciterHost and then load the page
            var host = new Host();

            host.Setup(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");

            // Show window and Run message loop
            wnd.Show();
            PInvokeUtils.RunMsgLoop();
        }
예제 #7
0
        /// <summary>
        ///     Determines if the given <paramref name="process"/> belongs to the specified
        ///     <paramref name="jobObjectHandle"/>.
        /// </summary>
        /// <param name="process">Process to check Job Object membership of.</param>
        /// <param name="jobObjectHandle">Job Object to check for membership.</param>
        /// <returns>
        ///     <c>true</c> if the given <paramref name="process"/> belongs to the specified
        ///     <paramref name="jobObjectHandle"/>; otherwise <c>false</c>.
        /// </returns>
        internal static bool IsProcessInJob(Process process, IntPtr jobObjectHandle)
        {
            var status = false;

            PInvokeUtils.Try(() => JobObjectAPI.IsProcessInJob(process.Handle, jobObjectHandle, out status));
            return(status);
        }
예제 #8
0
        public void UpdateMenu(SystemMenuItem menuItem)
        {
            var mii = new MENUITEMINFO
            {
                fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_FTYPE | MIIM_ID | MIIM_STATE | MIIM_STRING
            };

            mii.cbSize = (uint)Marshal.SizeOf(mii);

            PInvokeUtils.Try(() => GetMenuItemInfo(_hSysMenu, menuItem.Id, false, ref mii));

            if (menuItem.Enabled)
            {
                mii.fState &= (~MFS_DISABLED); // clear "disabled" flag
            }
            else
            {
                mii.fState |= MFS_DISABLED;    // set "disabled" flag
            }
            if (menuItem.Checked)
            {
                mii.fState |= MFS_CHECKED;    // set "checked" flag
            }
            else
            {
                mii.fState &= (~MFS_CHECKED); // clear "checked" flag
            }
            mii.fMask = MIIM_STATE;

            PInvokeUtils.Try(() => SetMenuItemInfo(_hSysMenu, menuItem.Id, false, ref mii));

            // TODO: From my observations, this function always returns false, even though it appears to succeed.
            //       Am I using it incorrectly?
            DrawMenuBar(_hSysMenu);
        }
예제 #9
0
파일: App.cs 프로젝트: zcwfeng/IconDrop
        public static void Run()
        {
            Debug.WriteLine("Sciter: " + SciterX.Version);

            Joiner.Setup();

            double tooktime = (DateTime.Now - Process.GetCurrentProcess().StartTime).TotalSeconds;

            Debug.WriteLine($"{tooktime}ms to start");

            if (true)
            {
                CreateApp();
            }
            else
            {
                CreateUnittest();
            }

            //AppHost.DebugInspect();

#if !OSX
            PInvokeUtils.RunMsgLoop();
#endif
        }
예제 #10
0
        static void Main(string[] args)
        {
                #if WINDOWS
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);
            Debug.Assert(oleres == 0);
                #endif
                #if GTKMONO
            PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero);
            Mono.Setup();
                #endif

            /*
             *      NOTE:
             *      In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH.
             *      Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system.
             */
            // Create the window
            AppWindow = new Window();

            // Prepares SciterHost and then load the page
            AppHost = new Host(AppWindow);

            // Run message loop
            PInvokeUtils.RunMsgLoop();
        }
예제 #11
0
        static void Main(string[] args)
        {
            if (IntPtr.Size == 4)
            {
                Debug.Assert(false, "sciter.dll that comes bundled in Omni is the x64 version, make sure to change it to the x86 version if building for x86 (Windows only)");
            }

                #if WINDOWS
            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);
            Debug.Assert(oleres == 0);
                #endif
                #if GTKMONO
            PInvokeGTK.gtk_init(IntPtr.Zero, IntPtr.Zero);
            Mono.Setup();
                #endif

            /*
             *      NOTE:
             *      In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH.
             *      Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system.
             */
            App.ParseArgs(args);

            if (App.Setup())
            {
                SaveRegistryRunPath();
                PInvokeUtils.RunMsgLoop();

                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
예제 #12
0
        public void KillOnClose()
        {
            var type   = JobObjectInfoClass.ExtendedLimitInformation;
            var limit  = CreateKillOnCloseJobObjectInfo();
            var length = GetKillOnCloseJobObjectInfoLength();

            PInvokeUtils.Try(() => WinAPI.SetInformationJobObject(_jobObjectHandle, type, ref limit, length));
        }
예제 #13
0
        public string CombineURL(string url = "")
        {
            IntPtr buffer = PInvokeUtils.NativeUtf16FromString(url, 2048);
            var    res    = _api.SciterCombineURL(_he, buffer, 2048);
            string s      = PInvokeUtils.StringFromNativeUtf16(buffer);

            PInvokeUtils.NativeUtf16FromString_FreeBuffer(buffer);
            return(s);
        }
예제 #14
0
        /// <summary>
        ///     Gets the total amount of physical memory installed on the system.
        /// </summary>
        /// <returns>
        ///     Total amount of physical memory installed on the system in bytes.
        /// </returns>
        public static ulong GetPhysicalMemory()
        {
            int[] name               = { CTL_HW, HW_MEMSIZE };
            uint  nameLen            = (uint)name.Length;
            long  physicalMemory     = 0;
            uint  physicalMemorySize = sizeof(long);

            PInvokeUtils.Try(() => sysctl(name, nameLen, ref physicalMemory, ref physicalMemorySize, IntPtr.Zero, 0), retVal => retVal == SysctlSuccess);

            return((ulong)physicalMemory);
        }
예제 #15
0
        public static void Run()
        {
            // Create the window
            AppWnd = new Window();

            // Prepares SciterHost and then load the page
            AppHost = new Host(AppWnd);

#if !OSX
            PInvokeUtils.RunMsgLoop();
#endif
        }
예제 #16
0
파일: VolumeAPI.cs 프로젝트: rafntor/bdhero
//        [CanBeNull] // TODO
        public static Volume GetVolumeInformation(DirectoryInfo dir)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(null);
            }

            uint serialNumber   = 0;
            uint maxLength      = 0;
            var  volumeFlags    = FileSystemFlags.NULL;
            var  volumeLabel    = new StringBuilder(256);
            var  fileSystemName = new StringBuilder(256);
            var  invocation     = string.Format("GetVolumeInformation({0})", dir == null ? "null" : string.Format("\"{0}\"", dir.FullName));

            try
            {
                PInvokeUtils.Try(() => GetVolumeInformation(dir.Root.FullName,
                                                            volumeLabel,
                                                            (uint)volumeLabel.Capacity,
                                                            ref serialNumber,
                                                            ref maxLength,
                                                            ref volumeFlags,
                                                            fileSystemName,
                                                            (uint)fileSystemName.Capacity));

                return(new Volume
                {
                    Label = volumeLabel.ToString(),
                    FileSystem = new FileSystem
                    {
                        Name = fileSystemName.ToString(),
                        Flags = volumeFlags
                    },
                    SerialNumber = serialNumber,
                    MaxFileNameLength = maxLength
                });
            }
            catch (Win32Exception e)
            {
                Logger.Error(string.Format("Invocation of native {0} function threw a Win32 exception", invocation), e);
            }
            catch (DllNotFoundException e)
            {
                Logger.Warn("Unable to locate kernel32.dll - OS is probably not Windows", e);
            }
            catch (Exception e)
            {
                Logger.Error(string.Format("{0} threw an exception", invocation), e);
            }

            return(null);
        }
예제 #17
0
        static void Main(string[] args)
        {
            #region Args handling
            bool arg_in_test = false;

            if (args.Length > 0)
            {
                if (args[0].StartsWith("-jumplist:"))
                {
                    MainWindow.SendJumplistCmd(args[0].Substring(10));
                    return;
                }
            }
            #endregion

            //UpdateControl.Setup();

            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);
            Debug.Assert(oleres == 0);
            Debug.WriteLine("Sciter " + SciterX.Version);

            // Create the window
            var wnd = WndMain = new MainWindow();
            wnd.CreateMainWindow(1, 1);
            wnd.CreateTaskbarIcon();
            wnd.CreateJumplists();
            wnd.Title = MainWindow.WND_TITLE;

            // Prepares SciterHost and then load the page
            var host = new BaseHost();
            host.Setup(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");

            //HookerInstance.SetMessageHook();

            if (!arg_in_test && SingleInstance.IsRunningAndAcquire())
            {
                Debug.WriteLine("ALREADY RUNNING!");
                return;
            }

            //MainWindow.SendJumplistCmd("BringToFront");
            //wnd.CreateNote();

            // Run message loop
            PInvokeUtils.RunMsgLoop();

            Exit();
        }
예제 #18
0
        public static void Run()
        {
            // Create the window
            mainWnd = new WndMain();

            // Prepares SciterHost and then load the page
            AppHost = new Host(mainWnd);

            mainWnd.getMsg();
#if !OSX
            PInvokeUtils.RunMsgLoop();
            FinalizeApp();
#endif
        }
예제 #19
0
        public static void Run()
        {
#if X64
            SciterX.Use3264DLLNaming = true;
#endif
            PInvokeWindows.OleInitialize(IntPtr.Zero);
            var window = new SciterWindow();
            window.CreateMainWindow(500, 500);
            window.CenterTopLevelWindow();
            var host = new AppHost(window);
            window.LoadPage("archive://app/acrylic-window/acrylic-window-sketch.htm");
            window.Show();
            PInvokeUtils.RunMsgLoop();
        }
예제 #20
0
        static void Main(string[] args)
        {
            var list = new List <int> {
                123
            };

            var ss = SciterValue.FromObject(new { aa = list });

            Console.WriteLine("Sciter: " + SciterX.Version);
            Console.WriteLine("Bitness: " + IntPtr.Size);

            // Sciter needs this for drag'n'drop support; STAThread is required for OleInitialize succeess
            int oleres = PInvokeWindows.OleInitialize(IntPtr.Zero);

            Debug.Assert(oleres == 0);

            // Create the window
            AppWnd = new SciterWindow();

            var rc = new PInvokeUtils.RECT();

            rc.right  = 800;
            rc.bottom = 600;

            var wnd = AppWnd;

            //wnd.CreateWindow(rc, SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_POPUP | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_MAIN | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_RESIZEABLE);
            wnd.CreateMainWindow(1500, 800);
            wnd.CenterTopLevelWindow();
            wnd.Title = "TestCore";
            wnd.Icon  = Properties.Resources.IconMain;

            // Prepares SciterHost and then load the page
            AppHost = new Host();
            var host = AppHost;

            host.Setup(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");
            //host.DebugInspect();

            //byte[] css_bytes = File.ReadAllBytes(@"D:\ProjetosSciter\AssetsDrop\AssetsDrop\res\css\global.css");
            //SciterX.API.SciterAppendMasterCSS(css_bytes, (uint) css_bytes.Length);
            Debug.Assert(!host.EvalScript("Utils").IsUndefined);

            // Show window and Run message loop
            wnd.Show();
            PInvokeUtils.RunMsgLoop();
        }
예제 #21
0
        public static void Run()
        {
            IsRunning = true;
            AppWindow = new SciterWindow();

            AppWindow.CreateMainWindow(1280, 720);
            AppWindow.CenterTopLevelWindow();
            AppWindow.Title = Reference.NAME;
            Win32.EnableWindowBlur(AppWindow._hwnd);

            AppHost = new Host(AppWindow);

            PInvokeUtils.RunMsgLoop();
            IsRunning = false;
        }
예제 #22
0
 public static void ShowOrFocus()
 {
     if (Instance.WindowState == FormWindowState.Minimized)
     {
         PInvokeUtils.RestoreForm(Instance);
     }
     else if (Instance.Visible)
     {
         Instance.Activate();
     }
     else
     {
         Instance.Show();
     }
 }
예제 #23
0
        /// <summary>
        ///     Gets the amount of available (free) memory on the system.
        /// </summary>
        /// <returns>
        ///     Amount of available (free) memory on the system in bytes.
        /// </returns>
        public static ulong GetAvailableMemory()
        {
            uint hostInfoCount = HOST_VM_INFO_COUNT;
            var  vmstat        = new vm_statistics_data_t();
            uint host_priv     = mach_host_self();

            PInvokeUtils.Try(() => host_statistics(host_priv, HostStatsType.HOST_VM_INFO, ref vmstat, ref hostInfoCount), result => result == KERN_SUCCESS);

            ulong physicalMemory = GetPhysicalMemory();

            double pagesTotal   = vmstat.wire_count + vmstat.active_count + vmstat.inactive_count + vmstat.free_count;
            double pagesFreePct = vmstat.free_count / pagesTotal;
            double bytesFree    = pagesFreePct * physicalMemory;

            return((ulong)bytesFree);
        }
예제 #24
0
        public static void Run()
        {
            Console.WriteLine("Sciter " + SciterX.Version);
            Console.WriteLine("SciterSharp " + LibVersion.AssemblyVersion);

            AppWnd  = new Window();
            AppHost = new Host(AppWnd);
            AppWnd.Show();

            /*#if OSX
             * AppWnd._nsview.Window.StyleMask = AppKit.NSWindowStyle.Borderless | AppKit.NSWindowStyle.Resizable;
             #endif*/
                        #if !OSX
            PInvokeUtils.RunMsgLoop();
#endif
        }
예제 #25
0
        static void Main(string[] args)
        {
            // TODO: think Andrew corrected child window creation
            PInvokeWindows.OleInitialize(IntPtr.Zero);

            // Create the window
            var wnd = new SciterWindow();

            wnd.CreateMainWindow(1500, 800);
            var r = wnd.RootElement;

            wnd.Icon = Properties.Resources.Icon1;
            //wnd.EnableDwmClientArea();


            //wnd.CenterTopLevelWindow();
            //wnd.AfterWindowCreate();
            //wnd.Title = "Sciter Bootstrap";

            // Prepares SciterHost and then load the page
            var host = new Host();

            host.SetupWindow(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");
            //host.DebugInspect();

            // get the page <body>
            var se_body = wnd.RootElement.SelectFirst("body");

            // append a <h1> header to it
            se_body.TransformHTML("<h1>Wow, this header was created natively!</h1>", SciterXDom.SET_ELEMENT_HTML.SIH_INSERT_AT_START);

            // set <h1> color to blue
            se_body[0].SetStyle("color", "#00F");


            /*SciterWindow wnd_popup = new SciterWindow();
             * wnd_popup.CreatePopupAlphaWindow(400, 400, wnd._hwnd);
             * wnd_popup.LoadHtml("<html><body><style>html { background: red; }</style></body></html>");
             * wnd_popup.Show();*/

            // Show window and Run message loop
            wnd.Show();
            PInvokeUtils.RunMsgLoop();
        }
예제 #26
0
        public void TestReturnsResult()
        {
            var jobObjectHandle = IntPtr.Zero;

            try
            {
                jobObjectHandle = PInvokeUtils.Try(() => JobObjectAPI.CreateJobObject(IntPtr.Zero, null), result => result != IntPtr.Zero);

                Assert.AreNotEqual(jobObjectHandle, IntPtr.Zero);
            }
            finally
            {
                if (jobObjectHandle != IntPtr.Zero)
                {
                    JobObjectAPI.CloseHandle(jobObjectHandle);
                }
            }
        }
예제 #27
0
        private static Process CreateProcessInSeparateJob(ProcessStartInfo startInfo)
        {
            var securityAttributes = new SECURITY_ATTRIBUTES
            {
                nLength = Marshal.SizeOf(typeof(SECURITY_ATTRIBUTES)),
                lpSecurityDescriptor = IntPtr.Zero,
                bInheritHandle       = false
            };

            var          environment                 = IntPtr.Zero;
            const bool   inheritHandles              = false;
            const string currentDirectory            = null;
            const ProcessCreationFlags creationFlags = ProcessCreationFlags.CREATE_BREAKAWAY_FROM_JOB;

            var startupInfo = new STARTUPINFO {
                cb = Marshal.SizeOf(typeof(STARTUPINFO))
            };
            var processInformation = new PROCESS_INFORMATION();

            PInvokeUtils.Try(() => JobObjectAPI.CreateProcess(startInfo.FileName,
                                                              startInfo.Arguments,
                                                              ref securityAttributes,
                                                              ref securityAttributes,
                                                              inheritHandles,
                                                              creationFlags,
                                                              environment,
                                                              currentDirectory,
                                                              ref startupInfo,
                                                              out processInformation));

            try
            {
                return(Process.GetProcessById(processInformation.dwProcessId));
            }
            catch (Exception e)
            {
                Logger.Error("Unable to get child process by ID.  " +
                             "Are you running in Visual Studio with Program Compatibility Assistant (PCA) enabled?  " +
                             "See http://stackoverflow.com/a/4232259/3205 for more information.", e);
                return(null);
            }
        }
예제 #28
0
        /// <summary>
        ///     Assigns the given process to this Job Object.
        /// </summary>
        /// <param name="process">Process to assign to this Job Object.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="process"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException">
        ///     Thrown if <paramref name="process"/> already belongs to a Job Object.
        /// </exception>
        /// <exception cref="Win32Exception">
        ///     Thrown if the operating system was unable to assign <paramref name="process"/> to the Job Object.
        /// </exception>
        public void Assign(Process process)
        {
            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            if (AlreadyAssigned(process))
            {
                return;
            }

            if (HasJobObject(process))
            {
                throw new InvalidOperationException(
                          "Requested process already belongs to another job group.  Check http://stackoverflow.com/a/4232259/3205 for help.");
            }

            PInvokeUtils.Try(() => WinAPI.AssignProcessToJobObject(_jobObjectHandle, process.Handle));
        }
예제 #29
0
파일: App.cs 프로젝트: walney/FontLister
        public static void Run()
        {
            AppWnd = new SciterWindow();

            var wnd = AppWnd;

            wnd.CreateMainWindow(800, 600);
            wnd.CenterTopLevelWindow();
            wnd.Title = "FontLister";
#if WINDOWS
            wnd.Icon = Properties.Resources.IconMain;
#endif

            // Prepares SciterHost and then load the page
            AppHost = new Host(AppWnd);

            Data.GAPI.Setup();

#if !OSX
            PInvokeUtils.RunMsgLoop();
#endif
        }
예제 #30
0
        /// <summary>
        ///     Frees managed and unmanaged resources.
        /// </summary>
        /// <param name="freeManagedObjectsAlso">
        ///     Free managed resources.  Should only be set to <c>true</c> when called from <see cref="Dispose"/>.
        /// </param>
        /// <exception cref="Win32Exception">
        ///     Thrown if the handle to the Job Object could not be released.
        /// </exception>
        /// <seealso cref="http://stackoverflow.com/a/538238/467582"/>
        private void Dispose(bool freeManagedObjectsAlso)
        {
            // Free unmanaged resources
            // ...

            // Free managed resources too, but only if I'm being called from Dispose()
            // (If I'm being called from Finalize then the objects might not exist anymore)
            if (freeManagedObjectsAlso)
            {
                if (_disposed)
                {
                    return;
                }
                if (_jobObjectHandle == IntPtr.Zero)
                {
                    return;
                }

                _disposed = true;

                PInvokeUtils.Try(() => WinAPI.CloseHandle(_jobObjectHandle));
            }
        }