Example #1
0
        private void LoadShotcuts()
        {
            this.world.Children.Clear();
            this.tiles.Clear();

            var files = SystemHelper.GetAllDesktopShortcuts();

            int idx = 0;

            foreach (var item in files)
            {
                Tile tile = new Tile(AppMeta.create(item));
                tile.Owner = this;
                tiles.Add(tile);


                var posConfig = SysConfig.Instance.Position.Where(x => x.Path == tile.AppMeta.Path).FirstOrDefault();
                var p         = tile.Margin;

                if (posConfig != null)
                {
                    tile.VirtualPosition.X = posConfig.X;
                    tile.VirtualPosition.Y = posConfig.Y;
                }
                else
                {
                    tile.VirtualPosition.X = idx++;
                    tile.VirtualPosition.Y = 0;
                }
                tile.Margin = p;
                world.Children.Add(tile);
                tile.AdjustToGrid();
            }
        }
Example #2
0
        public static AppMeta create(ShortcutInfo info)
        {
            FileInfo fileInfo = new FileInfo(info.ExePath);

            var ret = new AppMeta();

            ret.Shortcut = info;
            ret.Path     = info.ExePath;
            ret.Name     = fileInfo.Name;

            return(ret);
        }
Example #3
0
        public Tile(AppMeta meta)
        {
            InitializeComponent();
            this.HorizontalAlignment = HorizontalAlignment.Left;
            this.VerticalAlignment   = VerticalAlignment.Top;
            this.Margin          = new Thickness(0, 0, 0, 0);
            this.AppMeta         = meta;
            this.Width           = SysConfig.Instance.Tile.Width;
            this.Height          = SysConfig.Instance.Tile.Height;
            this.HalfWidth       = this.Width / 2;
            this.iconGrid.Margin = new Thickness(
                this.Width * 0.15,
                this.Width * 0.15,
                this.Width * 0.15,
                this.Width * 0.15
                );

            this.LoadMeta();
        }