예제 #1
0
        private AppWindow GetAppWindowForCurrentWindow()
        {
            IntPtr   hWnd  = WindowNative.GetWindowHandle(this);
            WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd);

            return(AppWindow.GetFromWindowId(wndId));
        }
예제 #2
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            await ApplicationDataMigration.Migrate();

            await DatabaseManager.Instance.InitializeDb();

            await SettingsViewModel.Instance.Load();

            await SearchResultsViewModel.Instance.Load();

            if (!Resources.ContainsKey("settings"))
            {
                Resources.Add("settings", Settings.Instance);
            }

            string[] args            = Environment.GetCommandLineArgs();
            string   launchArguments = args.Length >= 2 ? args[1] : null;

            mainWindow = new MainWindow(launchArguments);

            IntPtr    hWnd      = WindowNative.GetWindowHandle(mainWindow);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);

            mainWindow.Activate();

            appWindow.Closing += AppWindow_Closing;
        }
예제 #3
0
    public static void Close(WindowId id)
    {
        if (Opening(id))
        {
            Debug.LogWarning("正在打开的窗口不能关闭,需要停止加载:" + id);
            return;
        }
        if (!Opened(id))
        {
            return;
        }

        // 打开窗口时有隐藏其他窗口,关闭时要恢复其他窗口的显示
        if (_hideWindowList.ContainsKey(id))
        {
            WindowId _hideID = _hideWindowList[id];
            HideWindow(_hideID, false);
            _hideWindowList.Remove(id);
        }

        WindowExtend window = _openedList[id];

        GRoot.inst.HideWindowImmediately(window, true);

        _openedList.Remove(id);
    }
예제 #4
0
    public static void Open(WindowId openId, Action openComplete = null, params object[] values)
    {
        if (Opened(openId) || Opening(openId))
        {
            return;
        }

        if (!_datas.ContainsKey(openId))
        {
            Debug.LogWarning("Window not regist:" + openId);
            return;
        }

        var          data   = _datas[openId];
        WindowExtend window = (WindowExtend)Activator.CreateInstance(data.WindowType, values);

        _openingList[openId] = window;

        window.skinType = data.SkinType;
        window.windowId = data.Id;

        UITool.LoadUIPackage(data.PackageName, () =>
        {
            OpenWindowHandler(data, openId, openComplete);
        });
    }
예제 #5
0
파일: WinTool.cs 프로젝트: tiance7/XianCard
 public Window(WindowId windowId, Type windowType, Type frameType, bool canClose = true)
 {
     this.windowId   = windowId;
     this.windowType = windowType;
     this.frameType  = frameType;
     this.canClose   = canClose;
 }
예제 #6
0
#pragma warning disable CS0246 // The type or namespace name 'WindowLayout' could not be found (are you missing a using directive or an assembly reference?)
        public static void SetWindowLayout(WindowId id, WindowLayout layout)
#pragma warning restore CS0246 // The type or namespace name 'WindowLayout' could not be found (are you missing a using directive or an assembly reference?)
        {
            UserSettings.Data.SavedWinLocationInfo[(int)id] = layout;

            UserSettings.Admin.Write();
        }
예제 #7
0
        private static Window GetWindow(WindowId id)
        {
            var book   = GetBook(id.ProcessId, id.BookName);
            var window = book.Windows[id.WindowIndex];

            Debug.Assert(window != null);
            return(window);
        }
예제 #8
0
        public void SaveSettings()
        {
            PropertiesFile props = new PropertiesFile(AppDomain.CurrentDomain.BaseDirectory + "properties.properties");

            props.set("Host", Host);
            props.set("Port", Port.ToString());
            props.set("WindowId", WindowId.ToString());
            props.Save();
        }
예제 #9
0
        public void GetFromServerWaitClients()
        {
            Message messageToSend = new Message();

            messageToSend.Id   = 0;
            messageToSend.Cmd  = "WindowGetWaitClients";
            messageToSend.Data = WindowId.ToString();
            Send(messageToSend);
        }
예제 #10
0
        public void GetFromServerCountInfo()
        {
            Message messageToSend = new Message();

            messageToSend.Id   = 0;
            messageToSend.Cmd  = "WindowGetCountInfo";
            messageToSend.Data = WindowId.ToString();
            Send(messageToSend);
        }
예제 #11
0
        }         // "Id/,Index/,StatusId/,StatusTime/,IsLive/,PathName/,TurnName/;InfoName/,InfoValue/;InfoName/,..."

        public void SendToServerClientStatus(int StatusId)
        {
            Message messageToSend = new Message();

            messageToSend.Id   = 0;
            messageToSend.Cmd  = "WindowSetClientStatus";
            messageToSend.Data = WindowId.ToString() + "/;" + user.Id.ToString() + "/;" + StatusId.ToString() + "/;";
            Send(messageToSend);
        }
예제 #12
0
        }         // "id/,name/,name_in_window/;id/,..."

        public void GetFromServerClient(bool Show = true)
        {
            Message messageToSend = new Message();

            messageToSend.Id   = 0;
            messageToSend.Cmd  = "WindowGetClient";
            messageToSend.Data = WindowId.ToString() + "/;" + Show.ToString() + "/;";
            Send(messageToSend);
        }
예제 #13
0
    public static void Remove(WindowId id)
    {
        if (Opened(id))
        {
            Close(id);
        }

        _datas.Remove(id);
    }
예제 #14
0
        public OobeWindow(PowerToysModules initialModule)
        {
            this.InitializeComponent();

            // Set window icon
            _hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(this);
            _windowId  = Win32Interop.GetWindowIdFromWindow(_hWnd);
            _appWindow = AppWindow.GetFromWindowId(_windowId);
            _appWindow.SetIcon("icon.ico");

            OverlappedPresenter presenter = _appWindow.Presenter as OverlappedPresenter;

            presenter.IsResizable   = false;
            presenter.IsMinimizable = false;
            presenter.IsMaximizable = false;

            var dpi = NativeMethods.GetDpiForWindow(_hWnd);

            _currentDPI = dpi;
            float scalingFactor = (float)dpi / DefaultDPI;
            int   width         = (int)(ExpectedWidth * scalingFactor);
            int   height        = (int)(ExpectedHeight * scalingFactor);

            SizeInt32 size;

            size.Width  = width;
            size.Height = height;
            _appWindow.Resize(size);

            this.initialModule = initialModule;

            this.SizeChanged += OobeWindow_SizeChanged;

            ResourceLoader loader = ResourceLoader.GetForViewIndependentUse();

            Title = loader.GetString("OobeWindow_Title");

            if (shellPage != null)
            {
                shellPage.NavigateToModule(this.initialModule);
            }

            OobeShellPage.SetRunSharedEventCallback(() =>
            {
                return(Constants.PowerLauncherSharedEvent());
            });

            OobeShellPage.SetColorPickerSharedEventCallback(() =>
            {
                return(Constants.ShowColorPickerSharedEvent());
            });

            OobeShellPage.SetOpenMainWindowCallback((Type type) =>
            {
                App.OpenSettingsWindow(type);
            });
        }
예제 #15
0
        public void SendToServerSetBackWaitClient(int ClientId)
        {
            Message messageToSend = new Message();

            messageToSend.Id   = 0;
            messageToSend.Cmd  = "WindowSetBackWaitClient";
            messageToSend.Data = WindowId.ToString() + "/;" + ClientId.ToString() + "/;";
            Send(messageToSend);
        }
예제 #16
0
        private static void ResizeWindow(Window window, int width, int height)
        {
            IntPtr    hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(window);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);

            var size = new SizeInt32(width, height);

            appWindow.Resize(size);
        }
예제 #17
0
        public static void ActivateWindow(WindowId id)
        {
            var app = GetApp(id.ProcessId);

            app.Activate();

            var win = GetWindow(id);

            win.Activate();
        }
예제 #18
0
            public override void BindWindowRenderTarget(WindowId rtWindowId)
            {
                var data   = _windowData[rtWindowId];
                var result = eglMakeCurrent(_eglDisplay, data.EglSurface, data.EglSurface, _eglContext);

                if (result == EGL_FALSE)
                {
                    throw new Exception("eglMakeCurrent failed.");
                }
            }
예제 #19
0
    // 打开一个窗口,并且隐藏指定窗口,在关闭本窗口时恢复被隐藏窗口的显示
    public static void OpenAndHideOther(WindowId openID, WindowId hideID, Action onComplete = null, params object[] values)
    {
        if (Opened(hideID))
        {
            _hideWindowList.Add(openID, hideID);
            HideWindow(hideID, true);
        }

        Open(openID, onComplete, values);
    }
예제 #20
0
        public static AppWindow GetAppWindowFromWPFWindow(this Window wpfWindow)
        {
            // Get the HWND of the top level WPF window.
            var hwnd = new WindowInteropHelper(wpfWindow).EnsureHandle();

            // Get the WindowId from the HWND.
            WindowId windowId = Win32Interop.GetWindowIdFromWindow(hwnd);

            // Return AppWindow from the WindowId.
            return(AppWindow.GetFromWindowId(windowId));
        }
예제 #21
0
        public static AppWindow GetAppWindowFromWinformsWindow(this IWin32Window winformsWindow)
        {
            // Get the HWND of the top level WinForms window
            IntPtr hwnd = winformsWindow.Handle;

            // Get the WindowId from the HWND.
            WindowId windowId = Win32Interop.GetWindowIdFromWindow(hwnd);

            // Return an AppWindow from the WindowId.
            return(AppWindow.GetFromWindowId(windowId));
        }
예제 #22
0
 public static Window Get(WindowId id)
 {
     if (_openedList.ContainsKey(id))
     {
         return(_openedList[id]);
     }
     if (_openingList.ContainsKey(id))
     {
         return(_openingList[id]);
     }
     return(null);
 }
예제 #23
0
            public override void BindWindowRenderTarget(WindowId rtWindowId)
            {
                var data   = _windowData[rtWindowId];
                var result = eglMakeCurrent(_eglDisplay, data.EglBackbuffer, data.EglBackbuffer, _eglContext);

                if (result == EGL_FALSE)
                {
                    throw new Exception("eglMakeCurrent failed.");
                }

                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                Clyde.CheckGlError();
            }
예제 #24
0
        public Window ShowWindow(WindowId id)
        {
            foreach (WindowMapping windowMapping in windows)
            {
                if (windowMapping.Id == id)
                {
                    windowMapping.Window.ShowWindow();
                    return(windowMapping.Window);
                }
            }

            throw new ArgumentException("Unable to find window for ID " + id);
        }
예제 #25
0
파일: UiMgr.cs 프로젝트: lsunky/RhFrameWork
    public void Open(WindowId windowId, UiBaseData data)
    {
        UiBase window;

        if (!dicWindows.TryGetValue(windowId, out window))
        {
            string     path   = string.Format("Prefab/{0}", dicWindowsName[windowId]);
            GameObject prefab = AssetBundleManager.Instance.LoadAsset <GameObject>(path);
            window = GameObject.Instantiate <GameObject>(prefab, uiRoot).GetComponent <UiBase>();
            window.Init();
        }
        window.Open(data);
    }
예제 #26
0
        private void InitWindow()
        {
            IntPtr    hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(this);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);
            var       size      = new Windows.Graphics.SizeInt32();

            size.Width  = 1280;
            size.Height = 960;
            appWindow.Resize(size);
            appWindow.SetIcon("icon.ico");
            this.Title = "LR(1)语义分析过程表";
        }
예제 #27
0
    private static void OpenWindowHandler(WindowData data, WindowId id, Action onComplete)
    {
        WindowExtend window = _openingList[id];

        window.Show();

        _openedList[id] = window;
        _openingList.Remove(id);

        if (onComplete != null)
        {
            onComplete();
        }
    }
예제 #28
0
        public OobeWindow(PowerToysModules initialModule)
        {
            this.InitializeComponent();

            // Set window icon
            var       hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(this);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);

            appWindow.SetIcon("icon.ico");

            OverlappedPresenter presenter = appWindow.Presenter as OverlappedPresenter;

            presenter.IsResizable   = false;
            presenter.IsMinimizable = false;
            presenter.IsMaximizable = false;

            SizeInt32 size;

            size.Width  = 1650;
            size.Height = 1050;
            appWindow.Resize(size);

            this.initialModule = initialModule;

            ResourceLoader loader = ResourceLoader.GetForViewIndependentUse();

            Title = loader.GetString("OobeWindow_Title");

            if (shellPage != null)
            {
                shellPage.NavigateToModule(this.initialModule);
            }

            OobeShellPage.SetRunSharedEventCallback(() =>
            {
                return(Constants.PowerLauncherSharedEvent());
            });

            OobeShellPage.SetColorPickerSharedEventCallback(() =>
            {
                return(Constants.ShowColorPickerSharedEvent());
            });

            OobeShellPage.SetOpenMainWindowCallback((Type type) =>
            {
                App.OpenSettingsWindow(type);
            });
        }
예제 #29
0
            public override void BindWindowRenderTarget(WindowId rtWindowId)
            {
                var data = _windowData[rtWindowId];

                if (data.Reg.IsMainWindow)
                {
                    GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                    Clyde.CheckGlError();
                }
                else
                {
                    var loaded = Clyde.RtToLoaded(data.RenderTexture !);
                    GL.BindFramebuffer(FramebufferTarget.Framebuffer, loaded.FramebufferHandle.Handle);
                }
            }
예제 #30
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Window = new MainWindow();

            WindowId id = Win32Interop.GetWindowIdFromWindow(WindowNative.GetWindowHandle(Window));

            AppWindow = AppWindow.GetFromWindowId(id);

            AppWindow.TitleBar.ExtendsContentIntoTitleBar = true;

            await Task.Run(AppInitiating);

            Window.Navigate(typeof(Pages.CommonPage));

            Window.Activate();
        }
예제 #31
0
	public static void Main (string[] args)
	{
		if (args.Length != 3) {
			Console.Error.WriteLine ("Usage: testsimple [depth] [root] [visual]");
			return;
		}

		Connection c = new Connection (null, 0);
		//Connection c = new Connection ("localhost", 0);

		Console.WriteLine ("Release: " + c.Setup.ReleaseNumber);
		Console.WriteLine ("Vendor: " + c.Setup.Vendor);
		Console.WriteLine ("VendorLen: " + c.Setup.VendorLen);
		Console.WriteLine ("RootsLen: " + c.Setup.RootsLen);
		Console.WriteLine ("PixmapFormatsLen: " + c.Setup.PixmapFormatsLen);

		/*
			 Screen root;
			 int screen_num = 0;
			 root = Aux.GetScreen (c, screen_num);
			 int depth = 1;
			 Console.WriteLine (root);
			 Console.WriteLine (root.Root);
			 Console.WriteLine (root.WhitePixel);
			 Console.WriteLine (root.WidthInPixels);
			 Console.WriteLine (root.HeightInPixels);
			 */

		XCMisc xcmisc = new XCMisc ();
		xcmisc.Init (c);

		/*
			 XFixes xfixes = new XFixes ();
			 xfixes.Init (c);
			 */

		XidManager xm = new XidManager (xcmisc);

		XProto xp = new XProto ();
		xp.Init (c);

		WindowId wid = (WindowId)xm.Generate ();
		Console.WriteLine ("New xid: " + (uint)wid);

		//use xdpyinfo to find root window id
		WindowId parentId = new WindowId ((uint)Int32.Parse (args[1], System.Globalization.NumberStyles.HexNumber));

		//use xdpyinfo to find a visual
		//uint visualId = 0x23;
		uint visualId = (uint)Int32.Parse (args[2], System.Globalization.NumberStyles.HexNumber);

		//byte depth = 16;
		byte depth = (byte)Int32.Parse (args[0]);

		uint[] flags = new uint[4];

		//Mask
		flags[0] = (uint) (WindowValueMask.BackgroundPixel | WindowValueMask.EventMask | WindowValueMask.DoNotPropagateMask);
		//flags[0] = (uint) (Cw.BackPixel | Cw.EventMask | Cw.DontPropagate);
		//flags[0] = 0x00000100 | 0x00000800 | 0x00001000;

		//BackgroundPixel
		flags[1] = 0xffff0000;

		//EventMask
		//flags[2] = (uint) (EventMask.ButtonReleaseMask | EventMask.ExposureMask);
		flags[2] = 0x00000008 | 0x00008000;
		
		//DoNotPropagateMask
		//flags[3] = (uint) (EventMask.ButtonPressMask);
		flags[3] = 0x00000004;

		xp.CreateWindow (depth, wid, parentId, 10, 10, 100, 100, 0, (ushort)WindowClass.InputOutput, visualId, flags);

		xp.ChangeProperty ((byte)PropertyMode.Replace, wid, AtomType.WM_NAME, AtomType.STRING, 8, 0);

		xp.MapWindow (wid);

		PixmapId pid = (PixmapId)xm.Generate ();
		xp.CreatePixmap (depth, pid, wid, 100, 100);

		Rectangle rect = new Rectangle ();
		rect.X = 0;
		rect.Y = 0;
		rect.Width = 100;
		rect.Height = 100;

		Rectangle[] rects = new Rectangle[1];
		rects[0] = rect;

		//xc.PolyFillRectangle (pid, whitegc, rects);

		xp.ClearArea (false, wid, 10, 10, 20, 20);

		//Sync:
		//xp.GetInputFocus ();

		while (true) {
			c.xrr.ReadMessage ();
		}
	}