Esempio n. 1
0
File: Globals.cs Progetto: Foda/Tide
        public static void InitShellEvents()
        {
            ts = new TileSizer();
            ts.ReqSizeHeight = 100;
            ts.ReqSizeWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

            Timeline.DesiredFrameRateProperty.OverrideMetadata(
                typeof(Timeline),
                new FrameworkPropertyMetadata { DefaultValue = 30 }
                );

            sh = new ShellHook(new System.Windows.Forms.Form().Handle);
            sh.WindowCreated += sh_WindowCreated;
            sh.WindowDestroyed += sh_WindowDestroyed;
        }
Esempio n. 2
0
File: Globals.cs Progetto: Foda/Tide
        static void sh_WindowCreated(ShellHook sender, IntPtr hWnd)
        {
            bool b_ExistingProcess = false;
            Tile foundTile;

            if (Helpers.GetWindowText(hWnd) == "Add Tile" || Helpers.GetWindowText(hWnd) == "Window1")
                return;

            foreach (UserControl t2 in Globals.MainDock.DockTiles)
            {
                if (t2 is Tile)
                {
                    Tile t3 = (Tile)t2;
                    Console.WriteLine("Sender: " + Helpers.GetProcessName(hWnd) + "::" + t3.s_AppPath);
                    if (Helpers.GetProcessName(hWnd).Equals(t3.s_AppPath) == true)
                    {
                        Console.WriteLine("Found same process");
                        b_ExistingProcess = true;
                        foundTile = t3;
                        t3.lst_hwID.Add(hWnd);
                        t3.animateRunning();
                    }
                }
            }

            if (b_ExistingProcess != true)
            {
                Tile t = new Tile(Helpers.GetWindowText(hWnd), randomTileColor(), Helpers.GetProcessName(hWnd), false);
                t.hwID = hWnd;
                t.lst_hwID.Add(hWnd);
                t.animateRunning();
                Globals.MainDock.addTile(t);
            }
        }
Esempio n. 3
0
File: Globals.cs Progetto: Foda/Tide
 static void sh_WindowDestroyed(ShellHook sender, IntPtr hWnd)
 {
     foreach (UserControl t in Globals.MainDock.DockTiles)
     {
         if (t is Tile)
         {
             Tile t2 = (Tile)t;
             if (Helpers.GetProcessName(hWnd).Equals(t2.s_AppPath) == true || (t2.hwID == hWnd))
             {
                 TileArgs ta = new TileArgs("");
                 t2.lst_hwID.Remove(hWnd);
                 Globals.MainDock.deleteTile(t2, ta);
             }
         }
     }
 }