Exemple #1
0
        void UpdatePhotos(List <FlickrPhoto> photos, TileCollection tiles, bool keepExistent)
        {
            flickrTiles.BeginUpdate();

            if (!keepExistent)
            {
                tiles.Clear(true);
            }

            foreach (FlickrPhoto photo in photos)
            {
                var tile = new Tile();
                tile.HorizontalSize = 4;
                tile.VerticalSize   = 3;
                tile.Template       = tempFlickr;
                tile.Text           = photo.Title;
                tile.Text1          = photo.AuthorName;
                tile.Tag            = photo;
                tile.Click         += Tile_Click;

                if (!string.IsNullOrEmpty(photo.ThumbnailUri))
                {
                    _downloadQueue.Enqueue(new DownloadItem(photo.ThumbnailUri, tile, false));
                }
                if (!string.IsNullOrEmpty(photo.AuthorBuddyIconUri))
                {
                    _downloadQueue.Enqueue(new DownloadItem(photo.AuthorBuddyIconUri, tile, true));
                }


                tiles.Add(tile);
            }

            flickrTiles.EndUpdate();
        }
Exemple #2
0
        void ShowErrorTile()
        {
            _downloadQueue.Clear();
            try
            {
                TileCollection tiles = flickrTiles.Groups[0].Tiles;
                flickrTiles.BeginUpdate();
                tiles.Clear(true);

                var tile = new Tile();
                tile.HorizontalSize = 4;
                tile.VerticalSize   = 2;
                tile.Template       = tempError;
                tile.Click         += ErrorTile_Click;
                tiles.Add(tile);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }



            flickrTiles.EndUpdate();
        }
        private void LoadFoods(bool keepExistent)
        {
            TileCollection tiles1 = TileRec.Groups[0].Tiles;

            tiles1.Clear(true);
            lfooR = mposC.mposDB.fooDB.getlFoodsRecommend();
            foreach (Foods foo1 in lfooR)
            {
                var tile = new Tile();
                tile.HorizontalSize = mposC.takeouttilhorizontalsize;
                tile.VerticalSize   = mposC.takeouttilverticalsize;
                tile.Template       = tempFlickr;
                tile.Text           = foo1.foods_name;
                tile.Text1          = "ราคา " + foo1.foods_price;
                tile.Tag            = foo1;
                tile.Name           = foo1.foods_id;
                tile.Click         += Tile_Click;
                tile.Image          = null;
                try
                {
                    tile.Image = null;
                    tiles1.Add(tile);
                    MemoryStream stream = new MemoryStream();
                    Image        loadedImage = null, resizedImage;
                    if (foo1.filename.Equals(""))
                    {
                        continue;
                    }
                    //stream = mposC.ftpC.download(mposC.iniC.ShareFile + "/foods/" + foo1.filename);
                    string ext = Path.GetExtension(foo1.filename);
                    String file = "";
                    file   = foo1.filename.Replace(ext, "");
                    file   = file + "_210" + ext;
                    stream = mposC.ftpC.download(mposC.iniC.ShareFile + "/foods/" + file);
                    //loadedImage = new Bitmap(stream);
                    //if (loadedImage != null)
                    //{
                    //    //SizeF size = tile.Width;
                    //    int originalWidth = loadedImage.Width;
                    //    int newWidth = 180;
                    //    resizedImage = loadedImage.GetThumbnailImage(newWidth, (newWidth * loadedImage.Height) / originalWidth, null, IntPtr.Zero);
                    //    tile.Image = resizedImage;
                    //}
                    tile.Image = new Bitmap(stream);
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("" + ex.Message, "showImg");
                }
                //if (!string.IsNullOrEmpty(photo.ThumbnailUri))
                //    _downloadQueue.Enqueue(new DownloadItem(photo.ThumbnailUri, tile, false));
                //if (!string.IsNullOrEmpty(photo.AuthorBuddyIconUri))
                //    _downloadQueue.Enqueue(new DownloadItem(photo.AuthorBuddyIconUri, tile, true));
            }

            for (int i = 0; i < dtCat.Rows.Count; i++)
            {
                LoadFoods(false, i, dtCat.Rows[i]["foods_cat_id"].ToString());
            }
        }
        private void LoadFoods(bool keepExistent, int index, String catid)
        {
            //Control.FromHandle(intptr);
            Control ctl = new Control();

            ctl = tabPage[1];
            //if (index == 0) return;
            if (TileFoods[index + 1] == null)
            {
                return;
            }
            TileCollection tiles = TileFoods[index + 1].Groups[0].Tiles;

            tiles.Clear(true);
            lfooT = mposC.mposDB.fooDB.getlFoodsByCat(catid);
            foreach (Foods foo1 in lfooT)
            {
                var tile = new Tile();
                tile.HorizontalSize = mposC.takeouttilhorizontalsize;
                tile.VerticalSize   = mposC.takeouttilverticalsize;
                tile.Template       = tempFlickr;
                tile.Text           = foo1.foods_name;
                tile.Text1          = "ราคา " + foo1.foods_price;
                tile.Tag            = foo1;
                tile.Name           = foo1.foods_id;
                tile.Click         += Tile_Click;
                tile.Image          = null;
                try
                {
                    tile.Image = null;
                    tiles.Add(tile);
                    MemoryStream stream = new MemoryStream();
                    Image        loadedImage = null, resizedImage;
                    if (foo1.filename.Equals(""))
                    {
                        continue;
                    }
                    stream      = mposC.ftpC.download(mposC.iniC.ShareFile + "/foods/" + foo1.filename);
                    loadedImage = new Bitmap(stream);
                    if (loadedImage != null)
                    {
                        //SizeF size = tile.Width;
                        int originalWidth = loadedImage.Width;
                        int newWidth      = 180;
                        resizedImage = loadedImage.GetThumbnailImage(newWidth, (newWidth * loadedImage.Height) / originalWidth, null, IntPtr.Zero);
                        tile.Image   = resizedImage;
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("" + ex.Message, "showImg");
                }
                //if (!string.IsNullOrEmpty(photo.ThumbnailUri))
                //    _downloadQueue.Enqueue(new DownloadItem(photo.ThumbnailUri, tile, false));
                //if (!string.IsNullOrEmpty(photo.AuthorBuddyIconUri))
                //    _downloadQueue.Enqueue(new DownloadItem(photo.AuthorBuddyIconUri, tile, true));
            }
        }
Exemple #5
0
        void ShowErrorTile()
        {
            _downloadQueue.Clear();

            TileCollection tiles = flickrTiles.Groups[0].Tiles;

            flickrTiles.BeginUpdate();

            tiles.Clear(true);

            var tile = new Tile();

            tile.HorizontalSize = 4;
            tile.VerticalSize   = 2;
            tile.Template       = tempError;
            tile.Click         += ErrorTile_Click;
            tiles.Add(tile);

            flickrTiles.EndUpdate();
        }