コード例 #1
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();
        }
コード例 #2
0
ファイル: Host.cs プロジェクト: ramon-mendes/StickyNotes
        public SciterValue Host_CreateStickyWindow(SciterValue[] args)
        {
            var wnd = new StickyWindow();

            wnd.CreateMainWindow(320, 320, SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_POPUP | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_ALPHA);
            wnd.CenterTopLevelWindow();
            wnd.HideTaskbarIcon();
            wnd.Icon = Properties.Resources.note;

            var evh = new HostEvh();

            evh._wnd = wnd;

            var host = new BaseHost();

            host.Setup(wnd);
            host.AttachEvh(evh);
            host.SetupPage("stickynote.html");

            var guid = args[0].Get("");

            Debug.Assert(guid.Length > 0);
            Program.Wnds.Add(guid, wnd);

            var view = wnd.CallFunction("View_LoadNote", args[0]);
            var aa   = view.ToJSONString();

            Debug.Assert(!view.IsUndefined);

            wnd.Show();
            bool res = User32.SetForegroundWindow(wnd._hwnd);

            new Win32Hwnd(wnd._hwnd).FocusAndActivate();
            host.InvokePost(() =>
            {
                new Win32Hwnd(wnd._hwnd).FocusAndActivate();
                wnd.Show();
                res = User32.SetForegroundWindow(wnd._hwnd);
            });
            return(view);
        }