Exemplo n.º 1
0
        //Add a new tile
        public void addTile(Tile t)
        {
            int pos = 24;
            foreach (UserControl u in DockTiles)
            {
                pos += (int)u.Width + TILE_BUFFER;
            }

            Canvas.SetLeft(t, pos);//GridPosX[DockTiles.Count]);
            Canvas.SetTop(t, 10);
            DockTiles.Add(t);
            CanvasMain.Children.Add(t);

            resizeMainBar();
        }
Exemplo n.º 2
0
        private void AddEmailTile()
        {
            Tile t = new Tile("Email", Globals.randomTileColor(), "", true);
            t.tt_Type = Tile.TileType.Live_Email;
            t.api_Email.setCred(tb_EUser.Text, pb_EPass.Password);

            //Some sort of error...
            if (t.api_Email.getUnreadCount() == -1)
            {
                //Something went wrong... could not connect or something
                System.Windows.MessageBox.Show("Wrong username/password", "Login Error", MessageBoxButton.OK,
                    MessageBoxImage.Error);
                return;
            }
            t.PushCount = t.api_Email.getUnreadCount().ToString();

            Globals.MainDock.addTile(t);
            this.Close();
        }
Exemplo n.º 3
0
        public static void LoadDock()
        {
            XDocument xmlDoc = XDocument.Load(Directory.GetCurrentDirectory() + "\\tiles.xml");

            // <3 LINQ
            var q = from c in xmlDoc.Descendants("Tile")
                    select new
                    {
                        title = c.Element("Title").Value,
                        color = c.Element("Color").Value,
                        app = c.Element("App").Value,
                        id = c.Element("hwID").Value
                    };

            foreach (var obj in q)
            {
                Tile t = new Tile(obj.title, HexStringToColor(obj.color), obj.app, true);
                t.hwID = new IntPtr(int.Parse(obj.id));

                Globals.MainDock.addTile(t);
            }
        }
Exemplo n.º 4
0
        private void b_Add_Click(object sender, RoutedEventArgs e)
        {
            if (tb_Title.Text != "")
            {
                Color c = Color.FromRgb(27, 161, 226);

                if (rb_Mag.IsChecked == true)
                    c = Color.FromRgb(255, 0, 151);
                else if (rb_Purp.IsChecked == true)
                    c = Color.FromRgb(162, 0, 255);
                else if (rb_Teal.IsChecked == true)
                    c = Color.FromRgb(0, 171, 169);
                else if (rb_Lime.IsChecked == true)
                    c = Color.FromRgb(140, 191, 38);
                else if (rb_Green.IsChecked == true)
                    c = Color.FromRgb(51, 153, 51);
                else if (rb_Pink.IsChecked == true)
                    c = Color.FromRgb(255, 0, 151);
                else if (rb_Orange.IsChecked == true)
                    c = Color.FromRgb(240, 150, 9);
                else if (rb_Blue.IsChecked == true)
                    c = Color.FromRgb(27, 161, 226);
                else if (rb_Red.IsChecked == true)
                    c = Color.FromRgb(229, 20, 0);

                if (rb_Stack.IsChecked == true)
                {
                    StackTile st = new StackTile(tb_Title.Text, (String)l_StackPath.Content, c);
                    Globals.MainDock.addTile(st);
                }
                else if (rb_App.IsChecked == true)
                {
                    Tile t = new Tile(tb_Title.Text, c, (String)l_FilePath.Content, true);
                    Globals.MainDock.addTile(t);
                }

                Close();
            }
        }
Exemplo n.º 5
0
        void detectPreviousRunning()
        {
            //ALL THE PROCESSES!
            foreach (Process p in Process.GetProcesses("."))
            {
                try
                {
                    if (p.MainWindowTitle.Length > 0)
                    {
                        //ALL THE TILES!
                        foreach (Tile t in Globals.MainDock.DockTiles)
                        {
                            //Check to see if a tile is already assigned to this process
                            if (Helpers.GetProcessName(p.MainWindowHandle).Equals(Helpers.GetProcessName(t.hwID)))
                            {
                                //Tile exists, add Handle to Tile's handle list
                                t.lst_hwID.Add(p.MainWindowHandle);
                            }
                            else
                            {
                                //New tile!
                                Tile nt = new Tile(p.ProcessName.ToString(), Globals.randomTileColor(),
                                    Helpers.GetProcessName(p.MainWindowHandle), false);
                                nt.s_AppPath = Helpers.GetProcessName(p.MainWindowHandle);
                                nt.lst_hwID.Add(p.MainWindowHandle); //Add handle to handle list
                                nt.animateRunning();

                                Globals.MainDock.addTile(nt);
                            }
                        }
                    }
                }
                catch
                {
                    //lolwut
                }
            }
        }
Exemplo n.º 6
0
 private void UserControl_Drop(object sender, DragEventArgs e)
 {
     if (e.Source != null)
     {
         string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
         foreach (string fileName in fileList)
         {
             if (System.IO.Path.GetExtension(fileName).Equals(".exe"))
             {
                 Tile t = new Tile(System.IO.Path.GetFileName(fileName), Globals.randomTileColor(),
                     fileName, true);
                 Globals.MainDock.addTile(t);
             }
         }
     }
 }
Exemplo n.º 7
0
Arquivo: Globals.cs Projeto: 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);
            }
        }