static List <Character> characterList = new List <Character>(); //for position rubbish public Character(string imageName, string characterColor) { this.characterColor = characterColor; loadImage = new LoadImage(this); unloadImage = new UnloadImage(this); setPosition = new SetPosition(this); gameObject = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("CharacterPrefab")); string[] words = imageName.Split('-'); //backwards from SetImageName() if (words.Length >= 1) { characterName = words[0]; } if (words.Length >= 2) { characterClothes = words[1]; } if (words.Length >= 3) { characterExpression = words[2]; } if (characterName.Length > 0) { loadImage.PushLoadImageEvent(true); } }
private void SetDefaultBindings() { SongName = "Song name(not Sandstorm)"; ArtistName = "Artist"; AlbumName = "Album"; AlbumImage = new LoadImage().SetDefaultImage(); }
public void ProcessRequest(HttpContext context) { int strW; int strH; if (int.TryParse(context.Request.Params["w"], out strW) && int.TryParse(context.Request.Params["h"], out strH)) { context.Response.Clear(); string gurl = context.Request.Params["gurl"]; if (!string.IsNullOrEmpty(gurl)) { if (File.Exists(context.Server.MapPath(gurl))) { LoadImage.GenThumbnail(context.Request.Params["gurl"], strW, strH); } else { LoadImage.GenThumbnail("Images/nopic.gif", strW, strH); } } else { LoadImage.GenThumbnail("Images/nopic.gif", strW, strH); } } }
void Start() { Random.seed = 0; List <int> toLoad = this.numbersToLoad(); int j = 0; foreach (int i in toLoad) { GameObject go = GameObject.Instantiate(cloneMe); LoadImage li = go.GetComponent <LoadImage>(); string fp = li.filePath; fp = fp.Replace("00", i.ToString()); li.filePath = fp; go.transform.SetParent(this.gameObject.transform); Vector3 pos = go.transform.localPosition; pos.x = j % columns; pos.y = -j / columns; go.transform.localPosition = pos; go.SetActive(true); go.GetComponent <QuadID>().id = i; j++; allQuads.Add(go); } fo.t = this.allQuads[107].transform; }
public void LoadTexture() { //loadImage = new LoadImage (TexturePath, Width, Height, this); loadImage = new LoadImage(data.Length, data, this, logfile, TexturePath, Width, Height); loadImage.start(); isLoading = true; }
private void LoadImage_Click(object sender, EventArgs e) { //按钮点击效果 this.LoadImage.BackgroundImage = global::通用架构.Properties.Resources.PicImage_Gray; Task LoadImage_Active = new Task(() => { Delay(150); this.LoadImage.BackgroundImage = global::通用架构.Properties.Resources.PicImage_White; }); LoadImage_Active.Start(); // LoadImage.Refresh();//刷新控件 //打开指定路径文件夹,加载图片 OpenFileDialog FileDialog = new OpenFileDialog(); FileDialog.InitialDirectory = "F:\\1.工作文件\\1.程序文件"; if (FileDialog.ShowDialog() == DialogResult.OK) { try { ho_Image = new HImage(FileDialog.FileName); HOperatorSet.GetImageSize(ho_Image, out ImageWidth, out ImageHeight); HWndCtrl.addIconicVar(ho_Image); LineDetect.ho_Image = ho_Image; HWndCtrl.repaint(); } catch (Exception exc) { MessageBox.Show("读取静态图像失败!" + exc.ToString()); } } // }
//TODO: make this an IEnumerator. private void HandleFinishSelect(Color[,] averages) { this.allCubes = new List <GameObject>(); int rows = averages.GetLength(0); int columns = averages.GetLength(1); float xInc = this.selectedCube.transform.localScale.x / (columns); float yInc = this.selectedCube.transform.localScale.y / (rows); float startX = xInc * -columns / 2.0f + 0.5f * xInc; float startY = yInc * -rows / 2.0f + 0.5f * yInc; dataLoader.Reset(); for (int y = 0; y < rows; y++) { for (int x = 0; x < columns; x++) { GameObject go = this.CreateCube(); //load image from correct place. Color c = averages[y, x]; string url = this.dataLoader.matchColour(c); LoadImage li = go.GetComponent <LoadImage>(); li.filePath = this.getCubePath(url); Transform t = go.transform; t.localScale = new Vector3(xInc, yInc, 1.0f); t.localPosition = new Vector3(xInc * x + startX, yInc * y + startY, 0.0f); t.SetParent(this.transform); go.SetActive(true); go.GetComponent <Renderer>().material.color = c; allCubes.Add(go); } } }
public async Task <IActionResult> Create([Bind("DishId,Name,Price,Image,DishCategoryId")] Dish dish, IFormCollection collection, IFormFile file) { var filePath = Path.GetTempFileName(); using (var stream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(stream); } dish.Image = LoadImage.GetPictureData(filePath); List <Ingredient> testList = new List <Ingredient>(); foreach (var item in collection.Keys.Where(m => m.StartsWith("ingredient-"))) { var listIngredient = _context.Ingredients.FirstOrDefault(d => d.IngredientId == Int32.Parse(item.Remove(0, 11))); testList.Add(listIngredient); DishIngredient di = new DishIngredient() { Dish = dish, Ingredient = listIngredient }; _context.DishIngredients.Add(di); } if (ModelState.IsValid) { _context.Add(dish); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DishCategoryId"] = new SelectList(_context.DishCategories, "DishCategoryId", "Description", dish.DishCategoryId); return(View(dish)); }
private void Awake() { if (Instance == null) { Instance = this; } }
public static void loadSpriteToObject(string newURL, GameObject g) { if (loadImageObject == null) { loadImageObject = new GameObject("LoadImageManager").AddComponent <LoadImage>(); } loadImageObject.loadSpriteImage(newURL, g); }
public async Task <IActionResult> Edit(int id, [Bind("DishId,Name,Price,DishCategoryId")] Dish dish, IFormCollection collection, IFormFile file) { if (file != null) { var filePath = Path.GetTempFileName(); using (var stream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(stream); } dish.Image = LoadImage.GetPictureData(filePath); } else { dish.Image = await _context.Dishes.Where(x => x.DishId == dish.DishId).Select(x => x.Image).FirstOrDefaultAsync(); } _dishService.RemoveIngredients(id); List <Ingredient> testList = new List <Ingredient>(); foreach (var item in collection.Keys.Where(m => m.StartsWith("ingredient-"))) { var listIngredient = _context.Ingredients.FirstOrDefault(d => d.IngredientId == Int32.Parse(item.Remove(0, 11))); testList.Add(listIngredient); DishIngredient di = new DishIngredient() { Dish = dish, Ingredient = listIngredient }; _context.DishIngredients.Add(di); } if (id != dish.DishId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dish); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DishExists(dish.DishId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DishCategoryId"] = new SelectList(_context.DishCategories, "DishCategoryId", "Description", dish.DishCategoryId); return(View(dish)); }
private void SetBindings(PlayerList musicInfo) { SliderValue = 0; SongName = musicInfo.SongName; ArtistName = musicInfo.Artist; AlbumName = musicInfo.Album; MediaElement.Source = new Uri(musicInfo.FilePath); AlbumImage = new LoadImage().LoadAlbumArt(musicInfo.FilePath); }
void OnGUI() { if (GUI.Button(new Rect(Screen.width / 3 - 30, Screen.height - 30, 150, 20), "Load Sprite From URL")) { if (LoadImage.IsReady) { LoadImage.loadSpriteToObject(URL, gameObject); } } }
// Use this for initialization void Start() { unlockedLevel = PlayerPrefsManager.GetUnlockedLevel(); content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, unlockedLevel * 210 + 10); content.anchoredPosition = Vector2.zero; for (int i = 0; i < unlockedLevel; i++) { GameObject tempBtn = (GameObject)Instantiate(button); RectTransform tempRectTrans = tempBtn.GetComponent <RectTransform> (); tempRectTrans.SetParent(content); tempRectTrans.anchoredPosition = new Vector2(0, -10 - 210 * i); tempRectTrans.localScale = Vector3.one; tempBtn.GetComponent <Image> ().sprite = images [i]; LoadImage tempLoader = tempBtn.GetComponentInChildren <LoadImage> (); tempLoader.image = images [i]; tempLoader.content = imageContent; tempLoader.display = imageDisplay; } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. if (!string.IsNullOrEmpty(MovieItem.Poster)) { var imageView = new UIImageView(LoadImage.FromUrl(MovieItem.Poster)); this.posterImage.Add(imageView); } this.movieTitle.Text = MovieItem.Title; this.movieYear.Text = MovieItem.Year; this.movieActors.Text = "Actors : " + MovieItem.Actors; this.releaseDate.Text = "Released Date : " + MovieItem.Released; this.movieLanguage.Text = "Langauge : " + MovieItem.Language; this.moviePlot.Text = " Movie Plot : " + MovieItem.Plot; this.movieDirector.Text = "Direcotr : " + MovieItem.Director; }
public IActionResult Index() { // var base64 = Convert.ToBase64String(item.BusLogo); // var imagesrc = string.Format("data:image/png;base64,{0}", base64); //< img src = '@imagesrc' style = "max-width:100px;max-height:100px" /> #region MyRegion //File(new System.IO.MemoryStream(Convert.ToByte("hello world ")), "application/pdf", "filename.pdf") #endregion //F:\Publish\WebApplicationFaceBook\src\WebApplicationno\wwwroot\images\1ad6d6d772966fc112a68096dee8a315.png byte[] a = { 1, 3, 5 }; byte[] b = { 2, 6, 7 }; byte[] c = Microsoft.Azure.Devices.Client.SHA.computeHMAC_SHA256(a, b); string path = FileStrem.GetFilePath("wwwroot/images/1ad6d6d772966fc112a68096dee8a315.png"); byte[] imagebyte = LoadImage.GetPictureData(path); ViewBag.imagebyte = imagebyte; var base64 = Convert.ToBase64String(imagebyte); ViewBag.imagesrc = string.Format("data:image/png;base64,{0}", base64); ViewBag.imagelegth = base64.Length; return(View()); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell(cellId); if (cell == null) { cell = new UITableViewCell( UITableViewCellStyle.Default, cellId ); cell.LayoutMargins = UIEdgeInsets.Zero; // remove table cell separator margin } if (!string.IsNullOrEmpty(controller.searchResults[indexPath.Row].Poster)) { var backgroundView = new UIImageView(LoadImage.FromUrl(controller.searchResults[indexPath.Row].Poster)); //backgroundView.ClipsToBounds = true; backgroundView.ContentMode = UIViewContentMode.ScaleToFill; cell.BackgroundView = backgroundView; } cell.TextLabel.Text = controller.searchResults[indexPath.Row].Title + " " + controller.searchResults[indexPath.Row].Year; //cell.DetailTextLabel.Text = controller.searchResults[indexPath.Row].Year; cell.Layer.CornerRadius = 5.0f; cell.Layer.BorderColor = UIColor.Clear.CGColor; cell.Layer.BorderWidth = 5.0f; cell.Layer.ShadowOpacity = 0.5f; cell.Layer.ShadowColor = UIColor.LightGray.CGColor; cell.Layer.ShadowRadius = 5.0f; //view.Layer.ShadowOffset=Estimate cell.Layer.MasksToBounds = true; return(cell); }
public MainWindowModel() { ImageList = new ObservableCollection <ImageModel>(); //Backgrounds = Directory.GetFiles(Directory.GetCurrentDirectory() + "//Backgrounds").ToList(); Widthh = SystemParameters.PrimaryScreenWidth; Heightt = SystemParameters.PrimaryScreenHeight; WidthOfElement = Widthh / 5.05; HeightOfElement = Heightt / 4.8; loadImage = new LoadImage(ImageList, this); Watcher = new FileSystemWatcher(); Watcher.Path = Explorer.FilePath; Watcher.NotifyFilter = NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.Security; Watcher.Changed += UpdateList; Watcher.Deleted += UpdateList; Watcher.Renamed += UpdateList; Watcher.EnableRaisingEvents = true; }
public static void Initialize(ApplicationDbContext context, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager) { if (context.Users.ToList().Count == 0) { var aUser = new ApplicationUser(); aUser.UserName = "******"; aUser.Email = "*****@*****.**"; var r = userManager.CreateAsync(aUser, "Pa$$w0rd").Result; var adminUser = new ApplicationUser(); adminUser.UserName = "******"; adminUser.Email = "*****@*****.**"; adminUser.PhoneNumber = "0701111222"; adminUser.CustomerName = "Madoka"; adminUser.Street = "Kungsgatan 123"; adminUser.PostalCode = "12345"; adminUser.City = "Stockholm"; var adminUserResult = userManager.CreateAsync(adminUser, "Pa$$w0rd").Result; var adminRole = new IdentityRole { Name = "Admin" }; var roleResult = roleManager.CreateAsync(adminRole).Result; userManager.AddToRoleAsync(adminUser, "Admin").Wait(); } //Om det inte finns Dishes i databasen if (context.Dishes.ToList().Count == 0) { var pizzaImage = LoadImage.GetPictureData("wwwroot/images/pizza.jpg"); var carzonesImage = LoadImage.GetPictureData("wwwroot/images/carzone.jpg"); var dessertImage = LoadImage.GetPictureData("wwwroot/images/dessert.jpg"); var pizza = new DishCategory { Description = "Pizza" }; var carzone = new DishCategory { Description = "Calzone" }; var dessert = new DishCategory { Description = "Dessert" }; context.DishCategories.Add(pizza); context.DishCategories.Add(carzone); context.DishCategories.Add(dessert); var cheese = new Ingredient { Name = "Cheese", Price = 30 }; var tomato = new Ingredient { Name = "Tomato", Price = 10 }; var ham = new Ingredient { Name = "Ham", Price = 25 }; var pineapple = new Ingredient { Name = "Pineapple", Price = 10 }; var bacon = new Ingredient { Name = "Bacon", Price = 25 }; var onions = new Ingredient { Name = "Onions", Price = 10 }; var mushrooms = new Ingredient { Name = "Mushrooms", Price = 20 }; var apple = new Ingredient { Name = "Apple", Price = 20 }; var currySauce = new Ingredient { Name = "Curry sauce", Price = 15 }; var banana = new Ingredient { Name = "Banana", Price = 10 }; var capricciosa = new Dish { Name = "Capricciosa", Price = 79, Image = pizzaImage, DishCategory = pizza }; var margaritha = new Dish { Name = "Margaritha", Price = 69, Image = pizzaImage, DishCategory = pizza }; var hawaii = new Dish { Name = "Hawaii", Price = 85, Image = pizzaImage, DishCategory = pizza }; var tropical = new Dish { Name = "Tropical", Price = 75, Image = pizzaImage, DishCategory = pizza }; var veggie = new Dish { Name = "Veggie", Price = 95, Image = pizzaImage, DishCategory = pizza }; var calzone = new Dish { Name = "Calzone", Price = 100, Image = carzonesImage, DishCategory = carzone }; var calzoneSp = new Dish { Name = "Calzone SP", Price = 115, Image = carzonesImage, DishCategory = carzone }; var applePie = new Dish { Name = "Apple pie", Price = 70, Image = dessertImage, DishCategory = dessert }; var capricciosaHam = new DishIngredient { Dish = capricciosa, Ingredient = ham }; var capricciosaMushrooms = new DishIngredient { Dish = capricciosa, Ingredient = mushrooms }; capricciosa.DishIngredients = new List <DishIngredient>(); capricciosa.DishIngredients.Add(capricciosaHam); capricciosa.DishIngredients.Add(capricciosaMushrooms); var margarithaCheese = new DishIngredient { Dish = margaritha, Ingredient = cheese }; margaritha.DishIngredients = new List <DishIngredient>(); margaritha.DishIngredients.Add(margarithaCheese); var hawaiiHam = new DishIngredient { Dish = hawaii, Ingredient = ham }; var hawaiiPineapple = new DishIngredient { Dish = hawaii, Ingredient = pineapple }; hawaii.DishIngredients = new List <DishIngredient>(); hawaii.DishIngredients.Add(hawaiiHam); hawaii.DishIngredients.Add(hawaiiPineapple); var tropicalBanana = new DishIngredient { Dish = tropical, Ingredient = banana }; var tropicalCurrySauce = new DishIngredient { Dish = tropical, Ingredient = currySauce }; tropical.DishIngredients = new List <DishIngredient>(); tropical.DishIngredients.Add(tropicalBanana); tropical.DishIngredients.Add(tropicalCurrySauce); var veggieMushrooms = new DishIngredient { Dish = veggie, Ingredient = mushrooms }; var veggieOnions = new DishIngredient { Dish = veggie, Ingredient = onions }; var veggieTomato = new DishIngredient { Dish = veggie, Ingredient = tomato }; veggie.DishIngredients = new List <DishIngredient>(); veggie.DishIngredients.Add(veggieMushrooms); veggie.DishIngredients.Add(veggieOnions); veggie.DishIngredients.Add(veggieTomato); var calzoneHam = new DishIngredient { Dish = calzone, Ingredient = ham }; calzone.DishIngredients = new List <DishIngredient>(); calzone.DishIngredients.Add(calzoneHam); var calzoneSpHam = new DishIngredient { Dish = calzoneSp, Ingredient = ham }; var calzoneSpMushrooms = new DishIngredient { Dish = calzoneSp, Ingredient = mushrooms }; calzoneSp.DishIngredients = new List <DishIngredient>(); calzoneSp.DishIngredients.Add(calzoneSpHam); calzoneSp.DishIngredients.Add(calzoneSpMushrooms); var applePieApple = new DishIngredient { Dish = applePie, Ingredient = apple }; applePie.DishIngredients = new List <DishIngredient>(); applePie.DishIngredients.Add(applePieApple); context.Dishes.Add(capricciosa); context.Dishes.Add(margaritha); context.Dishes.Add(hawaii); context.Dishes.Add(tropical); context.Dishes.Add(veggie); context.Dishes.Add(calzone); context.Dishes.Add(calzoneSp); context.Dishes.Add(applePie); var visa = new Card { Name = "Visa" }; var masterCard = new Card { Name = "Master card" }; context.Cards.Add(visa); context.Cards.Add(masterCard); context.SaveChanges(); } }
public void Awake() { Instance = this; }
void Awake() { GetLoadIamge = this; }
public System.IO.Stream OnLoadImage(string image) => LoadImage?.Invoke(image);
/// <summary> /// Initializes a new instance of the <see cref="ImageEditorViewModel" /> class. /// </summary> /// <param name="imageService">Service for image loading and manipulation.</param> public ImageEditorViewModel(IImageService imageService = null) { _imageService = imageService ?? Locator.Current.GetService <IImageService>(); IObservable <ImageHandle> selectionChanges = this.WhenAnyValue(x => x.SelectedImage).Publish().RefCount(); ImageExplorer = new ImageExplorerViewModel(_source.AsObservableCache()); ImagePreview = new ImagePreviewViewModel(selectionChanges); Settings = new ImageSettingsViewModel(selectionChanges); SelectFolder = new Interaction <string, string>(); LoadImage = ReactiveCommand.CreateFromObservable <string, ImageHandle>(x => _imageService.LoadImage(x)); ExportSelected = ReactiveCommand.CreateFromObservable(ExportSelectedImpl); ExportAll = ReactiveCommand.CreateFromObservable(ExportAllImpl); _calculatePreview = ReactiveCommand.CreateFromObservable <ImageHandle, ImageHandle>(x => _imageService.CalculatePreview(x)); var connection = _source.Connect(); this.WhenActivated(d => { // Dispose handles removed from the source collection connection .DisposeMany() .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _images) .Subscribe() .DisposeWith(d); // Recaluclate image when quality changes connection.WhenPropertyChanged(x => x.ManipulationState.Quality, false) .Throttle(TimeSpan.FromMilliseconds(50)) .Select(x => x.Sender) .InvokeCommand(_calculatePreview) .DisposeWith(d); // Notify about successful export. ExportSelected .Do(name => this.Notify().PublishInfo($"Image export to {name}", "Export completed!", TimeSpan.FromSeconds(3))) .Subscribe() .DisposeWith(d); // Notify about successful export. ExportAll .Do(path => this.Notify().PublishInfo($"All images exported to {path}", "Export completed!", TimeSpan.FromSeconds(3))) .Subscribe() .DisposeWith(d); // Add loaded images to source LoadImage .ObserveOn(RxApp.TaskpoolScheduler) .Where(x => x != null) .SelectMany(x => _calculatePreview.Execute(x)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(handle => _source.AddOrUpdate(handle)) .DisposeWith(d); // Show image loading error LoadImage.ThrownExceptions .OfType <ImageLoadingException>() .Subscribe(ex => this.Notify() .PublishError($"Sorry. \"{ex.FilePath}\" does not have a supported file format.", "Error", TimeSpan.FromSeconds(5))) .DisposeWith(d); // Pipe loadings to property Observable.CombineLatest( LoadImage.IsExecuting, ExportSelected.IsExecuting, ExportAll.IsExecuting, _calculatePreview.IsExecuting, (a, b, c, d) => a || b || c || d) .ObserveOn(RxApp.MainThreadScheduler) .ToPropertyEx(this, x => x.IsLoading) .DisposeWith(d); // React on close requests from explorer view this.WhenAnyObservable(x => x.ImageExplorer.DeletionRequests) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => _source.Remove(x)) .DisposeWith(d); // Select explorer item this.WhenAnyObservable(x => x.ImageExplorer.Selections) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => SelectedImage = x) .DisposeWith(d); }); }
//public ImageNASA img; private void Awake() { sp = GetComponent <SpriteRenderer>(); _instantiate = this; }
private void panel1_DoubleClick(object sender, EventArgs e) { ImagePath_txt.Text = ""; LoadImage.PerformClick(); }
void Start() { loadImageObject = this; }
private void OnNewDump(DumpMessage message) { IsDumpingScreen = false; LoadImage?.Invoke(this, message.DumpInfo); _topNode = message.TopNode; }