Ejemplo n.º 1
0
        private void CreateTiles(IList <IShellApplication> applications)
        {
            tilePanel.Children.Clear();
            AppBlock appBlock = null;
            var      index    = 0;

            foreach (var application in applications)
            {
                var tile = new Tile();
                tile.Title      = application.MenuLabel;
                tile.Foreground = new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0xFF));
                tile.Background = new SolidColorBrush(Colors[index % 5]);
                tile.Tag        = application;
                tile.Click     += tile_Click;
                if (application.MenuImage != null)
                {
                    tile.Content = new Image {
                        Source = Imaging.CreateBitmapSourceFromBitmap(application.MenuImage), Height = 80, Stretch = Stretch.Uniform
                    };
                }

                if (appBlock == null)
                {
                    appBlock = new AppBlock();
                }

                appBlock.AppearanceType = (AppearanceType)(tilePanel.Children.Count % 5);
                appBlock.Add(tile);
                if (!appBlock.CanAdd())
                {
                    tilePanel.Children.Add(appBlock);
                    appBlock = null;
                }

                index++;
            }

            if (appBlock != null)
            {
                tilePanel.Children.Add(appBlock);
            }
        }
Ejemplo n.º 2
0
 private void LoadImage(string ImgFilename)
 {
     System.Drawing.Bitmap myBitmap = new System.Drawing.Bitmap(@ImgFilename);
     Img.Source = Imaging.CreateBitmapSourceFromBitmap(myBitmap);
     filename   = ImgFilename;
 }