Esempio n. 1
0
        public Text(ILogger logger, IFontProvider fontProvider, ApplicationWindow applicationWindow, ColorTextureVao vao)
        {
            this.logger       = logger;
            this.fontProvider = fontProvider;
            this.vao          = vao;

            vao.Initialize();

            vao.SetTopLeftCorner(new Vector2(0, 0), new Vector2(applicationWindow.Width, applicationWindow.Height));
            vao.SetupColors(new Color4[] { Color4.White, Color4.White, Color4.White, Color4.White });
            vao.SetupTextureCoords(new Vector2[] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0) });

            bitmap   = new Bitmap(applicationWindow.Width, applicationWindow.Height);
            graphics = System.Drawing.Graphics.FromImage(bitmap);
            graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            graphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            graphics.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

            textureId = GL.GenTexture();
            GL.BindTexture(TextureTarget.Texture2D, textureId);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, applicationWindow.Width, applicationWindow.Height, 0,
                          PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
        }
Esempio n. 2
0
        private float _globalRotation = (float)Math.PI; // Causes rocks to rotate around the global origin (where the planet is)

        public InstancingApplication(ApplicationWindow window) : base(window)
        {
            window.Shutdown += () =>
            {
                Console.WriteLine("Shutdown for InstancingApplication was run!");
            };
        }
Esempio n. 3
0
        public EarthApplication(ApplicationWindow window)
        {
            Window          = window;
            Window.Resized += HandleWindowResize;
            Window.GraphicsDeviceCreated   += OnGraphicsDeviceCreated;
            Window.GraphicsDeviceDestroyed += OnDeviceDestroyed;
            Window.Rendering += PreDraw;
            Window.Rendering += Draw;
            //首先创建一个场景对象
            _scene      = new Scene.Scene(window.Width, window.Height);
            globeRender = new RayCastedGlobe(_scene);
            var path = @"E:\swyy\Lib\PongGlobe\PongGlobe\assets\Vector\NaturalEarth\110m-admin-0-countries\110m_admin_0_countries.shp";

            vectorLayerRender = new Renders.VectorLayerRender(path, _scene);
            var shareRender = new ShareRender(_scene);

            renders.Add(shareRender);
            renders.Add(globeRender);
            renders.Add(vectorLayerRender);
            var pat2h       = @"E:\swyy\Lib\PongGlobe\PongGlobe\assets\Vector\NaturalEarth\110m-populated-places-simple\110m_populated_places_simple.shp";
            var vectorPoint = new PointVectorLayerRender(pat2h, _scene);
            //renders.Add(vectorPoint);
            //var drawline = new DrawLineTool(_scene);
            // renders.Add(drawline);
        }
Esempio n. 4
0
 internal Button(ILogger logger, ICursorProvider cursorProvider, ApplicationWindow applicationWindow, Text textElement)
 {
     this.logger            = logger;
     this.cursorProvider    = cursorProvider;
     this.applicationWindow = applicationWindow;
     this.textElement       = textElement;
 }
Esempio n. 5
0
        public string GetCategory(ApplicationWindow window)
        {
            ApplicationInfo applicationInfo = GetTaskApplicationInfo(window);

            if (applicationInfo != null && applicationInfo.Category == null)
            {
                // if app was removed, category is null, so stop using that app
                applicationInfo = null;
            }
            string category = applicationInfo?.Category?.DisplayName;

            if (category == null && window.WinFileName.ToLower().Contains("cairodesktop.exe"))
            {
                category = "Cairo";
            }
            else if (category == null && window.WinFileName.ToLower().Contains("\\windows\\") && !window.IsUWP)
            {
                category = "Windows";
            }
            else if (category == null)
            {
                category = Localization.DisplayString.sAppGrabber_Uncategorized;
            }

            return(category);
        }
Esempio n. 6
0
 private bool TryGetCategoryDisplayNameByTitle(ApplicationWindow window, out string category)
 {
     category = _appGrabber.CategoryList.FlatList
                .FirstOrDefault(ai => window.Title.ToLower().Contains(ai.Name.ToLower()) && ai.Category != null)
                ?.Category.DisplayName;
     return(category != null);
 }
Esempio n. 7
0
 internal Label(ILogger logger, Text text, ApplicationWindow applicationWindow, ICursorProvider cursorProvider)
 {
     this.logger            = logger;
     this.text              = text;
     this.applicationWindow = applicationWindow;
     this.cursorProvider    = cursorProvider;
 }
 private void OnOK(object sender, EventArgs e)
 {
     this.Hide();
     window             = new ApplicationWindow();
     window.FormClosed += OnFormClosed;
     window.Show();
 }
        public void NavigateTo(string path, ApplicationWindow hostWindow)
        {
            if (_supportedNavigatorManagers == null || _primaryNavigatorManager == null)
            {
                throw new InvalidOperationException("Please specify supported navigator managers and primary navigator manager.");
            }

            INavigator navigator = null;

            if (hostWindow != null)
            {
                foreach (INavigatorManager navigatorManager in _supportedNavigatorManagers)
                {
                    if (navigatorManager.IsNavigator(hostWindow))
                    {
                        navigator = navigatorManager.GetNavigator(hostWindow);
                        break;
                    }
                }
            }

            if (navigator == null)
            {
                navigator = _primaryNavigatorManager.CreateNavigator();
            }

            navigator.NavigateTo(path);
        }
Esempio n. 10
0
        private bool IsExpectedWindow(InternetExplorer actualWindow, ApplicationWindow expectedWindow)
        {
            IntPtr actualHandle          = new IntPtr(actualWindow.HWND);
            bool   windowHandleIsCorrect = expectedWindow != null && actualHandle == expectedWindow.Handle;

            return(windowHandleIsCorrect);
        }
Esempio n. 11
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Window = DataContext as ApplicationWindow;

            Window.PropertyChanged += Window_PropertyChanged;

            if (!ListMode)
            {
                setLabelVisibility();
                setIconSize();
                setToolTip();
            }
            else
            {
                // Task list display changes
                btn.Style        = FindResource("CairoTaskListButtonStyle") as Style;
                pbProgress.Style = FindResource("TaskListProgressBar") as Style;
                ToolTipService.SetPlacement(btn, System.Windows.Controls.Primitives.PlacementMode.Right);
                WinTitle.TextAlignment = TextAlignment.Left;
                imgIcon.Margin         = new Thickness(3, 0, 6, 0);
            }

            // drag support - delayed activation using system setting
            dragTimer = new DispatcherTimer {
                Interval = SystemParameters.MouseHoverTime
            };
            dragTimer.Tick += dragTimer_Tick;

            // thumbnails - delayed activation using system setting
            thumbTimer = new DispatcherTimer {
                Interval = SystemParameters.MouseHoverTime
            };
            thumbTimer.Tick += thumbTimer_Tick;
        }
Esempio n. 12
0
 public TotalCommander(ApplicationWindow hostWindow, string totalCommanderPath, bool openNewCommander)
 {
     _totalCommanderFolder   = Path.GetFullPath(Path.GetDirectoryName(totalCommanderPath));
     _totalCommanderFileName = Path.GetFileName(totalCommanderPath);
     _openNewCommander       = openNewCommander;
     _hostWindow             = hostWindow;
 }
Esempio n. 13
0
 private bool TryGetCategoryDisplayNameByAppUserModelId(ApplicationWindow window, out string category)
 {
     category = _appGrabber.CategoryList.FlatList
                .FirstOrDefault(ai =>
                                !string.IsNullOrEmpty(ai.Target) && ai.Target == window.AppUserModelID && ai.Category != null)
                ?.Category.DisplayName;
     return(category != null);
 }
Esempio n. 14
0
        private InternetExplorer GetWindowsExplorer(ApplicationWindow expectedWindow)
        {
            List <InternetExplorer> explorers = GetAllExplorers();

            InternetExplorer correctExplorer = explorers.FirstOrDefault(e => IsExpectedWindow(e, expectedWindow));

            return(correctExplorer);
        }
Esempio n. 15
0
 public void UpdateData(ApplicationWindow windowInformation)
 {
     X      = windowInformation.X;
     Y      = windowInformation.Y;
     Height = windowInformation.Height;
     Width  = windowInformation.Width;
     Handle = windowInformation.Handle;
 }
Esempio n. 16
0
 public ColorTextureVao(ILogger logger, IMathHelper mathHelper,
                        GraphicsProgramProvider graphicsProgramProvider, ApplicationWindow applicationWindow)
 {
     this.logger     = logger;
     this.mathHelper = mathHelper;
     this.graphicsProgramProvider = graphicsProgramProvider;
     this.applicationWindow       = applicationWindow;
 }
Esempio n. 17
0
 public SecondaryTaskBar(TaskBarHandle taskBarHandle, IObservable <bool> alwaysOnTop, IObservable <bool> autoHide)
     : base(taskBarHandle)
 {
     _window = new ApplicationWindow(taskBarHandle);
     _subscriptions.Add(alwaysOnTop.Subscribe(b => this.AlwaysOnTop = b));
     _subscriptions.Add(autoHide.Subscribe(b => this.AutoHide       = b));
     this.Refresh();
 }
Esempio n. 18
0
        private static void activate(Application app, IntPtr user_data)
        {
            var window = (Window)ApplicationWindow.@new(app);

            window.set_title("Window");
            window.set_default_size(200, 200);
            window.show_all();
        }
Esempio n. 19
0
 internal Checkbox(ILogger logger, Image checkedImage, Image uncheckedImage, ApplicationWindow applicationWindow, ICursorProvider cursorProvider)
 {
     this.logger            = logger;
     this.checkedImage      = checkedImage;
     this.uncheckedImage    = uncheckedImage;
     this.applicationWindow = applicationWindow;
     this.cursorProvider    = cursorProvider;
 }
Esempio n. 20
0
        public void Init()
        {
            frameworkFilesProcessor.ProcessFrameworkFiles();

            ApplicationWindow window = ContainerProvider.Scope.Resolve <ApplicationWindow>();

            window.Run();
        }
Esempio n. 21
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var window = new ApplicationWindow();

            Current.MainWindow = window;
            Current.MainWindow.Show();

            base.OnStartup(e);
        }
        public string GetCategory(ApplicationWindow window)
        {
            if (window.IsUWP)
            {
                return(window.AppUserModelID.ToLower());
            }

            return(window.WinFileName.ToLower());
        }
Esempio n. 23
0
 private bool TryGetCategoryDisplayNameByWinFileName(ApplicationWindow window, out string category)
 {
     category = _appGrabber.CategoryList.FlatList
                .FirstOrDefault(ai =>
                                !string.IsNullOrEmpty(ai.Target) &&
                                string.Equals(ai.Target, window.WinFileName, StringComparison.CurrentCultureIgnoreCase))
                ?.Category.DisplayName;
     return(category != null);
 }
Esempio n. 24
0
        private bool TryGetCategoryDisplayNameByProcId(ApplicationWindow window, out string category)
        {
            var applicationWindows = _shellManager.Tasks.GroupedWindows.Cast <ApplicationWindow>();

            category = applicationWindows
                       .FirstOrDefault(ai => ai.ProcId == window.ProcId && ai.Category != null)
                       ?.Category;
            return(category != null);
        }
Esempio n. 25
0
        private void miPin_Click(object sender, RoutedEventArgs e)
        {
            ApplicationWindow toPin = getWindow();

            if (toPin != null)
            {
                ParentTaskbar._appGrabber.QuickLaunchManager.AddToQuickLaunch(toPin.IsUWP, toPin.IsUWP ? toPin.AppUserModelID : toPin.WinFileName);
            }
        }
        private void GlobalKeyCombinationPressed(object sender, EventArgs e)
        {
            lock (_syncObject)
            {
                _hostWindow = _presentationService.GetActiveWindow();

                _view.ShowView();
            }
        }
Esempio n. 27
0
        private void miNewWindow_Click(object sender, RoutedEventArgs e)
        {
            ApplicationWindow toOpen = getWindow();

            if (toOpen != null)
            {
                ShellHelper.StartProcess(toOpen.IsUWP ? "appx:" + toOpen.AppUserModelID : toOpen.WinFileName);
            }
        }
Esempio n. 28
0
        public override void Run()
        {
            base.Run();
            logger.Info("Capturing screen");
            ICaptureAgent      captureAgent = new SimpleCaptureAgent();
            Rectangle          rect         = ApplicationWindow.ToRectangle();
            UnsafeMemoryBitmap bmp          = captureAgent.CaptureViewPort(rect.X, rect.Y, rect.Width, rect.Height);

            Console.ReadLine();
        }
Esempio n. 29
0
 public EarthApplication(ApplicationWindow window)
 {
     Window          = window;
     Window.Resized += HandleWindowResize;
     Window.GraphicsDeviceCreated   += OnGraphicsDeviceCreated;
     Window.GraphicsDeviceDestroyed += OnDeviceDestroyed;
     Window.Rendering  += PreDraw;
     Window.Rendering  += Draw;
     Window.KeyPressed += OnKeyDown;
 }
Esempio n. 30
0
        /// <summary>
        /// Syncs the hidden window location.
        /// </summary>
        public void SyncHiddenWindowLocation()
        {
            HiddenWindow.Width       = ApplicationWindow.Width;
            HiddenWindow.Height      = ApplicationWindow.Height;
            HiddenWindow.Top         = ApplicationWindow.Top;
            HiddenWindow.Left        = ApplicationWindow.Left;
            HiddenWindow.WindowState = ApplicationWindow.WindowState;

            ApplicationWindow.Activate();
        }
 private void connettiButton_Click(object sender, RoutedEventArgs e)
 {
     if (isConnectedToInternet())
     {
         if (serverAggiunti.Count > 0)
         {
             connection.Start();
             ApplicationWindow applicationWindow = new ApplicationWindow(mappaHotKey, connection);
             applicationWindow.Show();
             connection.ServerError -= connection_ServerError;
         }
     }
     else
     {
         ErrorMessage("Connessione Assente!");
     }
 }
Esempio n. 32
0
        public void Initialize()
        {
            try
            {
                Trace.WriteLine("Starting WindowsTasksService");
                _HookWin = new NativeWindowEx();
                _HookWin.CreateHandle(new CreateParams());

                SetTaskmanWindow(_HookWin.Handle);
                //'Register to receive shell-related events
                RegisterShellHookWindow(_HookWin.Handle);

                //'Assume no error occurred
                WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK");
                _HookWin.MessageReceived += ShellWinProc;

                SetMinimizedMetrics();

                int msg = RegisterWindowMessage("TaskbarCreated");
                IntPtr ptr = new IntPtr(0xffff);
                IntPtr hDeskWnd = GetDesktopWindow();
                Shell.SendMessageTimeout(ptr, (uint)msg, IntPtr.Zero, IntPtr.Zero, 2, 200, ref ptr);
                Shell.SendMessageTimeout(hDeskWnd, 0x0400, IntPtr.Zero, IntPtr.Zero, 2, 200, ref hDeskWnd);

                EnumWindows(new CallBackPtr((hwnd, lParam) =>
                {
                    ApplicationWindow win = new ApplicationWindow(hwnd, this);
                    if(win.ShowInTaskbar)
                        this.Windows.Add(win);
                    return true;
                }), 0);

            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
Esempio n. 33
0
        private void AddWindow(IntPtr hand)
        {
            try
            {
                var win = new ApplicationWindow(hand, this);

                if (win.ShowInTaskbar)
                {
                    lock (this._windowsLock)
                    {
                        Windows.Add(win);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception: " + ex.ToString());
                Debugger.Break();
            }
        }
Esempio n. 34
0
        private void ShellWinProc(System.Windows.Forms.Message msg)
        {
            if (msg.Msg == WM_SHELLHOOKMESSAGE)
            {
                try
                {
                    var win = new ApplicationWindow(msg.LParam, this);

                    lock (this._windowsLock)
                    {
                        switch (msg.WParam.ToInt32())
                        {
                            case HSHELL_WINDOWCREATED:
                                Trace.WriteLine("Created: " + msg.LParam.ToString());
                                if(win.ShowInTaskbar)
                                    Windows.Add(win);
                                break;

                            case HSHELL_WINDOWDESTROYED:
                                Trace.WriteLine("Destroyed: " + msg.LParam.ToString());
                                if (this.Windows.Contains(win))
                                {
                                    this.Windows.Remove(win);
                                }
                                break;

                            case HSHELL_WINDOWREPLACING:
                                Trace.WriteLine("Replacing: " + msg.LParam.ToString());
                                if (this.Windows.Contains(win))
                                {
                                    this.Windows.Remove(win);
                                }
                                break;
                            case HSHELL_WINDOWREPLACED:
                                Trace.WriteLine("Replaced: " + msg.LParam.ToString());
                                if (this.Windows.Contains(win))
                                {
                                    win = this.Windows.First(wnd => wnd.Handle == msg.LParam);
                                    win.State = ApplicationWindow.WindowState.Inactive;
                                }
                                else
                                {
                                    win.State = ApplicationWindow.WindowState.Inactive;
                                    if (win.ShowInTaskbar)
                                        Windows.Add(win);
                                }
                                break;

                            case HSHELL_WINDOWACTIVATED:
                                Trace.WriteLine("Activated: " + msg.LParam.ToString());

                                foreach (var aWin in this.Windows.Where(w => w.State == ApplicationWindow.WindowState.Active))
                                {
                                    aWin.State = ApplicationWindow.WindowState.Inactive;
                                }

                                if (msg.LParam != IntPtr.Zero)
                                {

                                    if (this.Windows.Contains(win))
                                    {
                                        win = this.Windows.First(wnd => wnd.Handle == msg.LParam);
                                        win.State = ApplicationWindow.WindowState.Active;
                                    }
                                    else
                                    {
                                        win.State = ApplicationWindow.WindowState.Active;
                                        if (win.ShowInTaskbar)
                                            Windows.Add(win);
                                    }
                                }
                                break;

                            case HSHELL_RUDEAPPACTIVATED:
                                Trace.WriteLine("Activated: " + msg.LParam.ToString());

                                foreach (var aWin in this.Windows.Where(w => w.State == ApplicationWindow.WindowState.Active))
                                {
                                    aWin.State = ApplicationWindow.WindowState.Inactive;
                                }

                                if (msg.LParam != IntPtr.Zero)
                                {

                                    if (this.Windows.Contains(win))
                                    {
                                        win = this.Windows.First(wnd => wnd.Handle == msg.LParam);
                                        win.State = ApplicationWindow.WindowState.Active;
                                    }
                                    else
                                    {
                                        win.State = ApplicationWindow.WindowState.Active;
                                        if (win.ShowInTaskbar)
                                            Windows.Add(win);
                                    }
                                }
                                break;

                            case HSHELL_FLASH:
                                Trace.WriteLine("Flashing window: " + msg.LParam.ToString());
                                if (this.Windows.Contains(win))
                                {
                                    win = this.Windows.First(wnd => wnd.Handle == msg.LParam);
                                    win.State = ApplicationWindow.WindowState.Flashing;
                                }
                                else
                                {
                                    win.State = ApplicationWindow.WindowState.Flashing;
                                    if (win.ShowInTaskbar)
                                        Windows.Add(win);
                                }
                                break;

                            case HSHELL_ACTIVATESHELLWINDOW:
                                Trace.WriteLine("Activate shell window called.");
                                break;

                            case HSHELL_ENDTASK:
                                Trace.WriteLine("EndTask called.");
                                if (this.Windows.Contains(win))
                                {
                                    this.Windows.Remove(win);
                                }
                                break;

                            case HSHELL_GETMINRECT:
                                Trace.WriteLine("GetMinRect called.");
                                SHELLHOOKINFO winHandle = (SHELLHOOKINFO)Marshal.PtrToStructure(msg.LParam, typeof(SHELLHOOKINFO));
                                winHandle.rc.Top = 0;
                                winHandle.rc.Left = 0;
                                winHandle.rc.Bottom = 100;
                                winHandle.rc.Right = 100;
                                Marshal.StructureToPtr(winHandle, msg.LParam, true);
                                msg.Result = winHandle.hwnd;
                                break;

                            case HSHELL_REDRAW:
                                Trace.WriteLine("Redraw called.");
                                this.OnRedraw(msg.LParam);
                                break;

                            // TaskMan needs to return true if we provide our own task manager to prevent explorers.
                            // case HSHELL_TASKMAN:
                            //     Trace.WriteLine("TaskMan Message received.");
                            //     break;

                            default:
                                Trace.WriteLine("Unknown called. " + msg.Msg.ToString());
                                break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("Exception: " + ex.ToString());
                    Debugger.Break();
                }
            }
        }