/// <summary> /// After a duration of 0.5 seconds the image will be loaded /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void loading_timer_Tick(object sender, EventArgs e) { this.loading_timer.Stop(); if (this.model_datagrid.SelectedRows.Count == 0) { return; } try { int modelId = (int)this.model_datagrid.SelectedRows[0].Cells["iDDataGridViewTextBoxColumn"].Value; ItemModels.ModelsRow row = (from m in this.itemModels.Models where m.ID == modelId select m).Single <ItemModels.ModelsRow>(); this.load_model_image(row); } catch {} }
/// <summary> /// Finally loads an Image /// </summary> /// <param name="row"></param> private void load_model_image(ItemModels.ModelsRow row) { //Same Model chosen, do not load if (this.current_loaded_image == row.ID) { return; } //Not categoized, generally no preview available //OR Generally no preview available if (row.Category.Length == 0 || !row.Preview) { this.model_preview_picturebox.Image = this.model_preview_picturebox.InitialImage; return; } this.loading_panel.Visible = true; string base_url = @"http://www.dolserver.net/models/Models/items/" + row.ID + ".jpg"; this.model_preview_picturebox.ImageLocation = base_url; this.current_loaded_image = row.ID; }