private void AddImagesView_LongClick(object sender, PropertyChangedEventArgs e) { var senderObject = sender as NewPinImage; if (senderObject != null) { ImagePaths.Remove(senderObject.ImagePath); if (!string.IsNullOrEmpty(senderObject.ImageUri)) { ImagePaths.Remove(senderObject.ImageUri); } if (ImagePaths.Count == 9 && !string.IsNullOrEmpty(ImagePaths[0])) { ImagePaths.Insert(0, string.Empty); _images[0].ClearImage(); _images[0].Source = "plus_icon.png"; _images[0].CanUseLongClick = false; } for (int i = 1; i < _images.Length; i++) { _images[i].ClearImage(); } for (int i = 1; i < ImagePaths.Count; i++) { _images[i].SetPath(ImagePaths[i]); } OnPropertyChanged("HaveChange"); } }
private void AddImagesView_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case "Width": if (Width > 0) { var tempWidthOneCell = (Width - Spacing * 6) / 5; HeightRequest = tempWidthOneCell * 2 + Spacing * 3; } break; case "OldImagePaths": if (OldImagePaths?.Count > 0) { for (int i = 0; i < OldImagePaths.Count && i < 9; i++) { ImagePaths.Insert(1, OldImagePaths[i]); _images[i + 1].SetUri(OldImagePaths[i]); } if (OldImagePaths.Count >= 10) { ImagePaths[0] = OldImagePaths[9]; _images[0].SetUri(OldImagePaths[9]); _images[0].CanUseLongClick = true; } } break; } }
/// <summary> /// /// </summary> /// <param name="options"></param> /// <returns></returns> public async Task <string> ConcatenateAsync(ImageOptions options) { var fileName = options.ConcatenatedImageFileNameScheme.Invoke(this); var filePath = Path.Combine(options.ConcatenatedImageDirectory, fileName); var filePhysicalPath = Path.Combine(options.RootDirectory, filePath).Replace('/', Path.DirectorySeparatorChar); Path.GetDirectoryName(filePhysicalPath).CreateDirectory(); if (!File.Exists(filePhysicalPath)) { var fileAbsolutePaths = ImagePaths .Where(_ => !_.IsNullOrWhiteSpace()) .Select(_ => _.PreProcess(options.RootDirectory)) .ToList(); var fileImage = (await ImageHelper.FromFileOrNetworkAsync(fileAbsolutePaths[0]))?.Resize(Width, Height); foreach (var path in fileAbsolutePaths.Skip(1)) { using var image = await ImageHelper.FromFileOrNetworkAsync(path); if (image == null) { continue; } fileImage = fileImage.Concatenate(image.Resize(Width, Height)); } using (fileImage) fileImage.CompressSave(filePhysicalPath, options.CompressFlag, ImageFormat.Jpeg); } return(filePath); }
public WellSchematic() { InitializeComponent(); DataContext = this; ImagePaths.Add("Image1"); ImagePaths.Add("Image2"); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <MarsRoverDbContext>(options => { options.UseSqlite(Configuration.GetConnectionString("SqlLiteConnection")); }); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "MarsRoverApi", Version = "v1" }); }); INasaApiSettings nasaApiSettings = new NasaApiSettings(); Configuration.GetSection("NasaApi").Bind(nasaApiSettings); services.AddSingleton(nasaApiSettings); IImagePaths imagePaths = new ImagePaths(); Configuration.GetSection("ImagePaths").Bind(imagePaths); services.AddSingleton(imagePaths); services.AddHttpClient <INasaApiClient, NasaApiClient>(httpClient => { httpClient.BaseAddress = new Uri(nasaApiSettings.NasaApiUrl); httpClient.Timeout = TimeSpan.FromSeconds(45); }); // Initializing service services.AddTransient <InitializationService>(); services.AddSingleton <IImageProviderSettings, ImageProviderSettings>(serviceProvider => { var webHostEnvironment = serviceProvider.GetRequiredService <IWebHostEnvironment>(); ImageProviderSettings imageProvider = new ImageProviderSettings() { FileProvider = webHostEnvironment.ContentRootFileProvider }; return(imageProvider); }); // Services services.AddScoped <IImageService, ImageService>(); services.AddScoped <IMarsPhotoRetrievalService, MarsPhotoRetrievalService>(); services.AddScoped <IDateService, DateService>(); services.AddScoped <IMarsRoverDbRepository, MarsRoverDbRepository>(); // Automapper services.AddAutoMapper( options => options.AddProfile <MappingProfile>()); }
public List <List <AvactorInfo> > GetImageSize() { List <List <AvactorInfo> > list = new List <List <AvactorInfo> >(); list.Add(new List <AvactorInfo>() { new AvactorInfo { FilePath = TempImage, Width = 158, Heigh = 2, IsResize = true } }); List <AvactorInfo> floor1 = new List <AvactorInfo>(); AvactorInfo width = new AvactorInfo { FilePath = TempImage, Width = 41, Heigh = 75, IsResize = false }; floor1.Add(width); floor1.Add(new AvactorInfo { FilePath = ImagePaths.First(), Width = 75, Heigh = 75, IsResize = false }); floor1.Add(width); list.Add(floor1); list.Add(new List <AvactorInfo>() { new AvactorInfo { FilePath = TempImage, Width = 158, Heigh = 2, IsResize = true } }); List <AvactorInfo> floor2 = new List <AvactorInfo>(); AvactorInfo width2 = new AvactorInfo { FilePath = TempImage, Width = 2, Heigh = 75, IsResize = true }; floor2.Add(width2); floor2.Add(new AvactorInfo { FilePath = ImagePaths.ElementAt(1), Width = 75, Heigh = 75, IsResize = false }); floor2.Add(width2); floor2.Add(new AvactorInfo { FilePath = ImagePaths.ElementAt(2), Width = 75, Heigh = 75, IsResize = false }); floor2.Add(width2); list.Add(floor2); list.Add(new List <AvactorInfo>() { new AvactorInfo { FilePath = TempImage, Width = 158, Heigh = 2, IsResize = true } }); return(list); }
private static void showLoading_() { if (!tw.hasInit) { tw.image.init(3, ImagePaths.getPathByName("加载")); tw.hasInit = true; } tw.tipBorder.Visibility = Visibility.Hidden; tw.Show(); tw.image.start(); }
public Unit(XElement item) { Description = item.Element("Description").Value; Type = stringsToTypes[item.Attribute("Type").Value]; Answer = item.Attribute("Answer").Value; DemoImagePath = item.Element("Description").Attribute("Image").Value; foreach (var i in item.Elements("Item")) { ImagePaths.Add(i.Value); ImageValues.Add(int.Parse(i.Attribute("Value").Value)); } }
public override void Update(GameTime time) { if (NextImageTime == TimeSpan.Zero) { NextImageTime = time.TotalGameTime + SecondsBetweenImage.Seconds(); } if (NextImageTime <= time.TotalGameTime) { NextImageTime = TimeSpan.Zero; var oldPath = Path; Path = ImagePaths.MoveNext(); } base.Update(time); }
public static Image PredictionOutlookImage(Result result) { return(new Image() { Source = SvgIcon(ImagePaths.GetOutlookImagePath(result)), MaxHeight = 50, MaxWidth = 50, Margin = new System.Windows.Thickness(20, 0, 20, 0) , ToolTip = StringFormater.GetClimate(result), Effect = shadowEffect }); }
/// <summary> /// This method generate the most probable prediction Image with appropriate width and height and effect /// </summary> private void GenerateFirstOutcastImage() { Result result = predictionSystem.Result.Results[0]; ///TODO : Change this to use Resources : //Uri imagePath = new Uri(@"" + ImagePaths.GetOutlookImagePath(result), UriKind.Absolute); outcastImage.Source = UIFactory.SvgIcon(ImagePaths.GetOutlookImagePath(result)); outcastImage.VerticalAlignment = VerticalAlignment.Stretch; outcastImage.HorizontalAlignment = HorizontalAlignment.Stretch; ///------------------------------ outcastImage.ToolTip = result.Climate; animation.Duration = new System.Windows.Duration(TimeSpan.FromSeconds(animationTime)); outcastImage.BeginAnimation(OpacityProperty, animation); outcastImage.BeginAnimation(OpacityProperty, animation); }
private void SetNewPhoto(string photoPath) { if (ImagePaths.Count < 10) { ImagePaths.Insert(1, photoPath); for (int i = 1; i < ImagePaths.Count; i++) { _images[i].SetPath(ImagePaths[i]); } } else if (ImagePaths.Count == 10) { ImagePaths[0] = photoPath; _images[0].SetPath(photoPath); _images[0].CanUseLongClick = true; } OnPropertyChanged("HaveChange"); }
private void BrowseCommandImageClick(object param) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Multiselect = true; fileDialog.Filter = "Image files (.jpg, .jpeg, .png)|*.jpg; *.jpeg; *.png"; fileDialog.ShowDialog(); ImagePaths.Clear(); DisplayImagePaths = ""; foreach (string filename in fileDialog.FileNames) { ImagePaths.Add(filename); } foreach (string ImagePaths in ImagePaths) { DisplayImagePaths += ImagePaths + "\n"; } }
public void BeginSlideShow() { // Reset Data CurrentPicture = null; ImagePaths.Clear(); // Validate SelectedPath var directories = SelectedPath.Split('%'); foreach (var directory in directories) { if (!Directory.Exists(directory)) { MessageBox.Show("A specified file path is not a real directory. Please ammend.", "Path Not Found", MessageBoxButton.OK, MessageBoxImage.Error); return; } } // Load Files var files = new List <string>(); foreach (var directory in directories) { LoadFiles(directory, ref files); } foreach (var file in files) { ImagePaths.Add(file); } // Shuffle ImagePaths.Shuffle(); // TODO: Check speedy loading // TODO: settings // Progress SlideshowProgress(null, null); }
private void ImagePaths_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (ImagePaths.Count(i => !string.IsNullOrEmpty(i)) > 0) { if (ImagePaths.Count(i => !string.IsNullOrEmpty(i)) > _photosBase64Dictionary.Count) { var fileProvider = DependencyService.Get <IFileSystemWork>(); foreach ( var newPhotoPath in ImagePaths.Where(path => _photosBase64Dictionary.All(b64 => b64.Key != path))) { if (!newPhotoPath.Contains("http://185.76.145.214/") && !string.IsNullOrEmpty(newPhotoPath)) { var tempBase64Photo = Convert.ToBase64String(fileProvider.GetFile(newPhotoPath)); _photosBase64Dictionary.Add(newPhotoPath, tempBase64Photo); PhotosBase64Dictionary.Add(tempBase64Photo); } else if (!string.IsNullOrEmpty(newPhotoPath)) { _photosBase64Dictionary.Add(newPhotoPath, newPhotoPath); PhotosBase64Dictionary.Add(newPhotoPath); } } } else if (ImagePaths.Count(i => !string.IsNullOrEmpty(i)) < _photosBase64Dictionary.Count) { var tempToRemove = _photosBase64Dictionary.Where(b64 => !ImagePaths.Contains(b64.Key)) .Select(b64 => b64.Key); foreach (var itemToDelete in tempToRemove) { PhotosBase64Dictionary.Remove(_photosBase64Dictionary.First(i => i.Key == itemToDelete).Value); _photosBase64Dictionary.Remove(itemToDelete); } } } else { _photosBase64Dictionary.Clear(); PhotosBase64Dictionary.Clear(); } }
public static StackPanel Prediction(Result item, int mode) { /// a container for the parameters that stacks them horizontaly StackPanel parametres = UIFactory.ParametersPanel(); foreach (var param in item.Predictions) { ///TODO : change this to use resources parametres.Children.Add(UIFactory.GeneratePredictionWrapPanel(mode, ImagePaths.GetImagePathForParameter(param), param.ParamKey, StringFormater.GetParameterValue(param), (Math.Round(param.StandardDeviation, 2)).ToString("00"), (Math.Abs(Math.Round(param.StandardDeviation, 2))).ToString())); } /// a container for the image of the outlook StackPanel outlookPanel = new StackPanel() { Orientation = Orientation.Horizontal, }; /// TODO : change this to use resources Image outlook = UIFactory.PredictionOutlookImage(item); ///------------------ outlookPanel.Children.Add(outlook); /// This is the probability text TextBlock probability = UIFactory.Probabilityblock(item, mode); /// a container for the whole prediction element StackPanel prediction = new StackPanel() { Orientation = Orientation.Horizontal, Width = double.NaN , Margin = new System.Windows.Thickness(0, 2, 0, 2) }; /// creating the prediction prediction.Children.Add(outlookPanel); prediction.Children.Add(parametres); prediction.Children.Add(probability); return(prediction); }
/// <summary> /// Generates the most probable prédiction first parameters /// </summary> private void GenerateFirstPredictionParameters() { /// Determining the number of parameters to draw int nbParam = (int)Math.Round(predictionSystem.GetNbParameters() * 0.5) + 1; int i = 0; foreach (var item in predictionSystem.Result.Results[0].Predictions) { /// TODO : Change this to use resources Image img = UIFactory.CreatePredictionIcon(ImagePaths.GetImagePathForParameter(item)); /// TextBlock text = UIFactory.CreatePredictionText(StringFormater.GetParameterValue(item)); WrapPanel panel = UIFactory.CreatePredictionWrapPanel(img, text, Orientation.Vertical); firstPrediction.Children.Add(panel); panel.BeginAnimation(OpacityProperty, animation); i++; if (i >= nbParam) { break; } } }
protected override void Seed(ApplicationDbContext context) { context.Categories.Add(new Category() { CategoryName = "Đồng hồ cơ" }); context.Categories.Add(new Category() { CategoryName = "Đồng hồ điện tử" }); context.Categories.Add(new Category() { CategoryName = "Đồng hồ kim cương" }); context.Categories.Add(new Category() { CategoryName = "Phiên bản đặc biệt" }); context.Categories.Add(new Category() { CategoryName = "Eco-Drive" }); context.SaveChanges(); context.PriceFilterings.Add(new PriceFiltering { Min = 2000000, Max = 5000000, Name = "Từ 2 triệu - 5 triệu" }); context.PriceFilterings.Add(new PriceFiltering { Min = 5000000, Max = 10000000, Name = "Từ 5 triệu - 10 triệu" }); context.PriceFilterings.Add(new PriceFiltering { Min = 10000000, Max = 20000000, Name = "Từ 10 triệu - 20 triệu" }); context.PriceFilterings.Add(new PriceFiltering { Min = 20000000, Max = 50000000, Name = "Từ 20 triệu - 50 triệu" }); context.PriceFilterings.Add(new PriceFiltering { Min = 50000000, Max = 99000000, Name = "Từ 50 triệu - 99 triệu" }); context.PriceFilterings.Add(new PriceFiltering { Min = 99000000, Max = 2000000000, Name = "Trên 99 triệu" }); context.Straps.Add(new Strap() { StrapName = "Dây da" }); context.Straps.Add(new Strap() { StrapName = "Thép không gỉ 316L" }); context.Straps.Add(new Strap() { StrapName = "Ceramic" }); context.Straps.Add(new Strap() { StrapName = "Mạ vàng hồng" }); context.Straps.Add(new Strap() { StrapName = "Titanium" }); context.SaveChanges(); context.Tags.Add(new Tag { TagName = "Đồng hồ đẹp" }); context.Tags.Add(new Tag { TagName = "Đồng hồ Nam" }); context.Tags.Add(new Tag { TagName = "Đồng hồ Nữ" }); context.Tags.Add(new Tag { TagName = "Đồng hồ hiếm" }); context.Tags.Add(new Tag { TagName = "Giảm giá" }); context.Tags.Add(new Tag { TagName = "Đồng hồ 99%" }); context.SaveChanges(); context.Brands.Add(new Brand() { Name = "Alpina", Image = "~/Content/Images/Brand/Alpina.png" }); context.Brands.Add(new Brand() { Name = "Bering", Image = "~/Content/Images/Brand/Bering.png" }); context.Brands.Add(new Brand() { Name = "Breitling", Image = "~/Content/Images/Brand/Breitling.png" }); context.Brands.Add(new Brand() { Name = "CalvinKlein", Image = "~/Content/Images/Brand/Calvin-Klein.png" }); context.Brands.Add(new Brand() { Name = "Candino", Image = "~/Content/Images/Brand/Candino.png" }); context.Brands.Add(new Brand() { Name = "Century", Image = "~/Content/Images/Brand/Century.png" }); context.Brands.Add(new Brand() { Name = "Chronoswiss", Image = "~/Content/Images/Brand/Chronoswiss.png" }); context.Brands.Add(new Brand() { Name = "Citizen", Image = "~/Content/Images/Brand/Citizen.png" }); context.Brands.Add(new Brand() { Name = "D&G", Image = "~/Content/Images/Brand/DAG.png" }); context.Brands.Add(new Brand() { Name = "Ernest-Borel", Image = "~/Content/Images/Brand/Ernest-Borel.png" }); context.Brands.Add(new Brand() { Name = "Festina", Image = "~/Content/Images/Brand/Festina.png" }); context.Brands.Add(new Brand() { Name = "Francisdelon", Image = "~/Content/Images/Brand/Francisdelon.png" }); context.Brands.Add(new Brand() { Name = "Freelook", Image = "~/Content/Images/Brand/Freelook.png" }); context.Brands.Add(new Brand() { Name = "Hermle", Image = "~/Content/Images/Brand/Hermle.png" }); context.Brands.Add(new Brand() { Name = "Longines", Image = "~/Content/Images/Brand/longines.png" }); context.SaveChanges(); context.Products.Add(new Product { Name = "Đồng hồ Breitling Navitimer 01 46mm Southeast Asia AB01281A/BF19/4100", Code = "AB01281A/BF19/4100", Image = "~/Content/Images/Products/new_1503395212.png", PromotionalPrice = 179676000, Price = 199640000, BrandId = 3, CategoryId = 1, Status = true, Warranty = 60, CaseSize = 43, Gender = 1, IncludedVAT = true }); ImagePaths ips = new ImagePaths(); ips.Images.Add("~/Content/Images/Products/ab012012-bb01-447a-1.jpg"); ips.Images.Add("~/Content/Images/Products/$_57.jpg"); ips.Images.Add("~/Content/Images/Products/JFbiao01575 (7).jpg"); context.Products.Add(new Product { Name = "Đồng hồ Breitling Navitimer 01 AB012012/BB01/447A", Code = "AB012012/BB01/447A", Image = "~/Content/Images/Products/3-ab012012-bb01-447a_1503395271.png", PromotionalPrice = 226872000, Price = 252080000, BrandId = 3, CategoryId = 1, Status = true, Warranty = 60, CaseSize = 43, Gender = 1, IncludedVAT = true, MoreImages = JsonConvert.SerializeObject(ips) }); context.Products.Add(new Product { Name = "Đồng hồ Breitling Chronomat 44 Black Dial Mens AB011012/B967/375A", Code = "AB011012/B967/375A", Image = "~/Content/Images/Products/2ab011012-b967-375a_1503395306.png", PromotionalPrice = 226458000, Price = 251620000, BrandId = 3, CategoryId = 1, Status = true, Warranty = 60, CaseSize = 44, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Breitling Chronomat 38 W1331012/BD92/385A", Code = "W1331012/BD92/385A", Image = "~/Content/Images/Products/1w1331012-bd92-385a_1503395340.png", PromotionalPrice = 1, Price = 197340000, BrandId = 3, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 38, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Breitling Galactic 36 W7433012/BE08/376A", Code = "W7433012/BE08/376A", Image = "~/Content/Images/Products/16-w7433012-be08-376a_1503395701.png", PromotionalPrice = 1, Price = 131790000, BrandId = 3, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 36, Gender = 2, IncludedVAT = true }); context.ProductStrap.Add(new ProductStrap() { ProductId = 1, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 2, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 3, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 4, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 5, StrapId = 2 }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Heritage Pilot Chronograph AL-860S4H5", PromotionalPrice = 78651000, Price = 87390000, BrandId = 1, Code = "AL-860S4H5", Status = true, Warranty = 24, CaseSize = 41.5, CategoryId = 1, Gender = 1, IncludedVAT = true, Image = "~/Content/Images/Products/AL-860S4H5.png" }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Startimer Pilot AL-860GB4S6", PromotionalPrice = 68742000, Price = 76380000, BrandId = 1, Code = "AL-860GB4S6", Status = true, Warranty = 24, CaseSize = 44, CategoryId = 1, Gender = 1, IncludedVAT = true, Image = "~/Content/Images/Products/AL-860GB4S6.png" }); ips = new ImagePaths(); ips.Images.Add("~/Content/Images/Products/AL-860B5AQ6_1.jpg"); ips.Images.Add("~/Content/Images/Products/AL-860B5AQ6_2.jpg"); ips.Images.Add("~/Content/Images/Products/AL-860B5AQ6_3.jpg"); context.Products.Add(new Product { Name = "Đồng hồ Alpina Alpiner 4 Chronograph AL-860B5AQ6B", Code = "AL-860B5AQ6B", Image = "~/Content/Images/Products/AL-860B5AQ6B.png", PromotionalPrice = 68004000, Price = 75560000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 44, Gender = 1, IncludedVAT = true, MoreImages = JsonConvert.SerializeObject(ips) }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Alpiner Chronograph AL-860AD5AQ6", Code = "AL-860AD5AQ6", Image = "~/Content/Images/Products/AL-860AD5AQ6.png", PromotionalPrice = 68004000, Price = 75560000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 44, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Alpiner Automatic Chronograph AL-750N4E6B", Code = "AL-750N4E6B", Image = "~/Content/Images/Products/AL-750N4E6B.png", PromotionalPrice = 52866000, Price = 58740000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 44, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Seastrong Diver 300 AL-725LB4V26B", Code = "AL-725LB4V26B", Image = "~/Content/Images/Products/AL-725LB4V26B.png", PromotionalPrice = 55386000, Price = 61540000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 44, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina AL-525VG4E6", Code = "AL-525VG4E6", Image = "~/Content/Images/Products/AL-525VG4E6.png", PromotionalPrice = 29844000, Price = 33160000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 41.5, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Alpiner 4 Manufacture Flyback Chronograph AL-760BS5AQ6", Code = "AL-760BS5AQ6", Image = "~/Content/Images/Products/AL-760BS5AQ6.png", PromotionalPrice = 98280000, Price = 109200000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 41.5, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Startimer Pilot AL-725B4S6", Code = "AL-725B4S6", Image = "~/Content/Images/Products/AL-725B4S6.png", PromotionalPrice = 50463000, Price = 56070000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 41.5, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina Alpiner 4 GMT AL-550GRN5AQ6", Code = "AL-550GRN5AQ6", Image = "~/Content/Images/Products/AL-550GRN5AQ6.png", PromotionalPrice = 42156000, Price = 46840000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 41.5, Gender = 1, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Alpina AL-525STD2CD3B", Code = "AL-525STD2CD3B", Image = "~/Content/Images/Products/AL-525STD2CD3B.png", PromotionalPrice = 1, Price = 86430000, BrandId = 1, CategoryId = 1, Status = true, Warranty = 24, CaseSize = 34, Gender = 2, IncludedVAT = true }); //1 1 2 1 2 2 1 1 1 1 2 context.ProductStrap.Add(new ProductStrap() { ProductId = 6, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 7, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 8, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 9, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 10, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 11, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 12, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 13, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 14, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 15, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 16, StrapId = 2 }); // 3 3 2 3 2 context.Products.Add(new Product { Name = "Đồng hồ Bering 32426-789", Code = "32426-789", Image = "~/Content/Images/Products/32426-789.png", PromotionalPrice = 1, Price = 1, BrandId = 2, CategoryId = 2, Status = true, Warranty = 36, CaseSize = 26, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Bering 32230-442", Code = "32230-442", Image = "~/Content/Images/Products/32230-442.png", PromotionalPrice = 1, Price = 4330000, BrandId = 2, CategoryId = 2, Status = true, Warranty = 36, CaseSize = 26, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Bering 32230-262", Code = "32230-262", Image = "~/Content/Images/Products/32230-262.png", PromotionalPrice = 1, Price = 6490000, BrandId = 2, CategoryId = 2, Status = true, Warranty = 36, CaseSize = 30, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Bering 30226-751", Code = "30226-751", Image = "~/Content/Images/Products/30226-751.png", PromotionalPrice = 1, Price = 8350000, CategoryId = 2, Status = true, Warranty = 36, BrandId = 2, CaseSize = 26, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Bering 13139-002", Code = "13139-002", Image = "~/Content/Images/Products/13139-002.png", PromotionalPrice = 3753000, Price = 4170000, BrandId = 2, CategoryId = 2, Status = true, Warranty = 36, CaseSize = 39, Gender = 2, IncludedVAT = true }); context.ProductStrap.Add(new ProductStrap() { ProductId = 17, StrapId = 3 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 18, StrapId = 3 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 19, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 20, StrapId = 3 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 21, StrapId = 2 }); //24 24 1 2 context.Products.Add(new Product { Name = "Đồng hồ Calvin Klein K7W2S116", Code = "K7W2S116", Image = "~/Content/Images/Products/K7W2S116.png", PromotionalPrice = 1, Price = 6930000, BrandId = 4, CategoryId = 2, Status = true, Warranty = 24, CaseSize = 28, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Calvin Klein K7W2M616", Code = "K7W2M616", Image = "~/Content/Images/Products/K7W2M616.png", PromotionalPrice = 1, Price = 8870000, BrandId = 4, CategoryId = 2, Status = true, Warranty = 24, CaseSize = 28, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Calvin Klein K7N236K2", Code = "K7N236K2", Image = "~/Content/Images/Products/K7N236K2.png", PromotionalPrice = 1, Price = 7470000, BrandId = 4, CategoryId = 2, Status = true, Warranty = 24, CaseSize = 38, Gender = 2, IncludedVAT = true }); context.Products.Add(new Product { Name = "Đồng hồ Calvin Klein K7Q21146", Code = "K7Q21146", Image = "~/Content/Images/Products/K7Q21146.png", PromotionalPrice = 1, Price = 7470000, BrandId = 4, CategoryId = 2, Status = true, Warranty = 24, CaseSize = 38, Gender = 2, IncludedVAT = true }); context.ProductStrap.Add(new ProductStrap() { ProductId = 22, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 22, StrapId = 4 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 23, StrapId = 2 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 23, StrapId = 4 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 24, StrapId = 1 }); context.ProductStrap.Add(new ProductStrap() { ProductId = 25, StrapId = 2 }); context.Products.Add(new Product { Name = "Đồng hồ Citizen AW1370.51E", Code = "AW1370.51E", Image = "~/Content/Images/Products/AW1370.51E.png", PromotionalPrice = 4140000, Price = 4600000, BrandId = 8, CategoryId = 5, Status = false, Warranty = 12, CaseSize = 41, Gender = 2, IncludedVAT = true }); context.ProductStrap.Add(new ProductStrap() { ProductId = 26, StrapId = 5 }); context.Products.Add(new Product { Name = "Đồng hồ Candino C4606/4", Code = "C4606/4", Image = "~/Content/Images/Products/c4606-4_1495771094.png", PromotionalPrice = 9936000, Price = 11040000, BrandId = 8, CategoryId = 5, Status = false, Warranty = 12, CaseSize = 41, Gender = 2, IncludedVAT = true }); context.ProductStrap.Add(new ProductStrap() { ProductId = 27, StrapId = 5 }); context.Products.Add(new Product { Name = "Đồng hồ Longines L4.874.3.27.7", Code = "L4.874.3.27.7", Image = "~/Content/Images/Products/l48743277_1493198071.png", PromotionalPrice = 46926000, Price = 52140000, BrandId = 8, CategoryId = 3, Status = false, Warranty = 12, CaseSize = 41, Gender = 2, IncludedVAT = true }); context.ProductStrap.Add(new ProductStrap() { ProductId = 28, StrapId = 2 }); context.SaveChanges(); foreach (var item in context.Products.ToList()) { if (item.Price < 5000000) { item.Quantity = 5; } else { item.Quantity = 3; } if (item.PromotionalPrice != 1) { context.ProductTags.Add(new ProductTag { ProductId = item.Id, TagId = 5 }); } } context.SaveChanges(); context.Comments.Add(new Comment() { Email = "Đỗ Đức Anh", Content = "Đồng hồ fake đấy đừng có mua ^^", ProductId = 2 }); context.Comments.Add(new Comment() { Email = "Hán Thị Hồng Nhung", Content = "Đẹp thế mà kêu fake", ProductId = 2 }); context.Comments.Add(new Comment() { Email = "Anonymous", Content = "Đồng hồ fake đấy đừng có tin ^^", ProductId = 2 }); context.Comments.Add(new Comment() { Email = "Nguyễn Văn An", Content = "Đồng hồ fake đấy đừng có tin ^^", ProductId = 2 }); context.SaveChanges(); context.Roles.Add(new Microsoft.AspNet.Identity.EntityFramework.IdentityRole { Id = "admin", Name = "admin" }); context.Roles.Add(new Microsoft.AspNet.Identity.EntityFramework.IdentityRole { Id = "mod", Name = "mod" }); context.Roles.Add(new Microsoft.AspNet.Identity.EntityFramework.IdentityRole { Id = "member", Name = "member" }); }
private void SlideshowProgress(object sender, EventArgs e) { _dispatcherTimer.Stop(); _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 3500); if (CurrentPictureIndex >= ImagePaths.Count) { CurrentPictureIndex = 0; ImagePaths.Shuffle(); } WriteDebugEntry("Loading Image " + ImagePaths[CurrentPictureIndex]); BitmapImage newImage = null; try { newImage = new BitmapImage(new Uri(ImagePaths[CurrentPictureIndex])); CurrentPicture = newImage; } catch (NotSupportedException) { WriteDebugEntry("Unable to load image.. skipping"); CurrentPictureIndex++; _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1); _dispatcherTimer.Start(); } try { using (var reader = new ExifReader(ImagePaths[CurrentPictureIndex])) { object orignt = null; var orientation = reader.GetTagValue(ExifTags.Orientation, out orignt); if (orignt != null && ((ushort)orignt != 1)) { var transformBitmap = new TransformedBitmap(); transformBitmap.BeginInit(); transformBitmap.Source = newImage; switch ((ushort)orignt) { case 8: WriteDebugEntry(" Image required rotation :: RotateTransform(-90)"); transformBitmap.Transform = new RotateTransform(-90); break; case 6: WriteDebugEntry(" Image required rotation :: RotateTransform(90)"); transformBitmap.Transform = new RotateTransform(90); break; default: break; } transformBitmap.EndInit(); CurrentPicture = ((BitmapSource)transformBitmap).ToBitmapImage(); } } } catch (ExifLibException ex) { } switch (ImagePaths[CurrentPictureIndex].Split('.').Last().ToLowerInvariant()) { case "gif": WriteDebugEntry(" Image is gif :: setting up gif looping"); TimeSpan duration = TimeSpan.FromTicks(0); var gif = GifBitmapDecoder.Create(new Uri(ImagePaths[CurrentPictureIndex]), BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); var delay = 0; foreach (var frame in gif.Frames) { frame.Freeze(); delay += (ushort)((BitmapMetadata)frame.Metadata).GetQuery("/grctlext/Delay"); } duration = TimeSpan.FromMilliseconds(delay * 10); if (duration < TimeSpan.FromSeconds(5)) { _dispatcherTimer.Interval = TimeSpan.FromTicks(duration.Ticks * 3); } else if (duration < TimeSpan.FromSeconds(10)) { _dispatcherTimer.Interval = TimeSpan.FromTicks(duration.Ticks * 2); } else { _dispatcherTimer.Interval = duration; } break; } CurrentPictureIndex++; _dispatcherTimer.Start(); }
public void Add(string imagePath) { ImagePaths.Add(imagePath); }
public void RemoveAt(int index) { ImagePaths.RemoveAt(index); }
/// <summary> /// Add an image paths to observable collection /// </summary> /// <param name="tmp"></param> internal void AddImagePaths(C_PathsDouble tmp) { ImagePaths.Add(tmp); }