public TopTenController(MovieService api, ImageDownloader imageDownloader) { this._api = api; this._imageDownloader = imageDownloader; this._movieList = new List <MovieDetails>(); this.TabBarItem = new UITabBarItem(UITabBarSystemItem.TopRated, 1); }
public void GetEntries(string localImageCache) { xmlDoc = new XmlDocument(); entries = new Collection<MemberEntry>(); // Form the http request httpRequest = HttpRequestHandler.BuildRequest("<Module>membership</Module>" + "<Section>members</Section>", filter, auth, sort); // Send the request HttpWebResponse response = HttpRequestHandler.SendRequest(httpRequest); // Load the response into an XML document xmlDoc.Load(new StreamReader(response.GetResponseStream())); // Extract the security token from the response HttpRequestHandler.GetSession(xmlDoc, ref auth); // Load the directory entries LoadEntries(localImageCache); // Are we downloading images? if (localImageCache != null && localImageCache != string.Empty) { // Create the downloader class ImageDownloader imageDownloader = new ImageDownloader(imageList, localImageCache); Thread imageThread = new Thread(new ThreadStart(imageDownloader.DownloadImages)); imageThread.Start(); } }
public ArticleController() { _contentApi = new ContentApi(); this.SavedArticles = new ObservableCollection <Article>(); this.Sections = new List <Section>(); _imageDownloader = new ImageDownloader(); }
public MovieCell(NSString cellId, ImageDownloader downloader) : base(UITableViewCellStyle.Default, cellId) { this._downloader = downloader; this.SelectionStyle = UITableViewCellSelectionStyle.Gray; this._imageView = new UIImageView() { Frame = new CGRect(0, 5, ImageHeight, ImageHeight), }; this._headingLabel = new UILabel() { Frame = new CGRect(45, 5, this.ContentView.Bounds.Width - 60, 25), Font = UIFont.FromName("Helvetica", 20f), TextColor = UIColor.FromRGB(64, 64, 64), BackgroundColor = UIColor.Clear }; this._subheadingLabel = new UILabel() { Frame = new CGRect(45, 25, 300, 20), Font = UIFont.FromName("HelveticaNeue-Bold", 12f), TextColor = UIColor.FromRGB(64, 64, 64), TextAlignment = UITextAlignment.Right, BackgroundColor = UIColor.Clear }; this.ContentView.AddSubviews(new UIView[] { this._imageView, this._headingLabel, this._subheadingLabel }); this.Accessory = UITableViewCellAccessory.DisclosureIndicator; }
/// <summary> /// Constructor for tests only /// </summary> public ArticleController(IContentApi contentApi, IList <Section> sections) { _contentApi = contentApi; this.SavedArticles = new ObservableCollection <Article>(); this.Sections = sections; _imageDownloader = new ImageDownloader(); }
IObservable <byte[]> DownloadImage(Uri url) { return(ImageDownloader.DownloadImageBytes(url) .SelectMany(x => x == null ? Observable.Empty <byte[]>() : Observable.Return(x))); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Details); // Retrieve navigation parameter and set as current "DataContext" Vm = GlobalNavigation.GetAndRemoveParameter <FlowerViewModel>(Intent); var headerView = LayoutInflater.Inflate(Resource.Layout.CommentsListHeaderView, null); headerView.FindViewById <TextView>(Resource.Id.NameText).Text = Vm.Model.Name; headerView.FindViewById <TextView>(Resource.Id.DescriptionText).Text = Vm.Model.Description; CommentsList.AddHeaderView(headerView); CommentsList.Adapter = Vm.Model.Comments.GetAdapter(GetCommentTemplate); ImageDownloader.AssignImageAsync(FlowerImageView, Vm.Model.Image, this); // Avoid aggressive linker problem which removes the Click event AddCommentButton.Click += (s, e) => { }; AddCommentButton.SetCommand( "Click", Vm.AddCommentCommand); }
static void Main(string[] args) { // This is the query - or you could get it from args. string query = "human form abstract"; var count = 100; var debug = true; List <ImageQueryResult> imageList = new List <ImageQueryResult>(); if (GlobalConfig._global_useSearchApiSource) { if (debug) { Console.WriteLine("Getting ImageQueryResults from BING SEARCH API"); } // get the image list from actual source var grabber = new ImageUrlGrabber(); imageList = grabber.GetImageUrlList( ImageQueryConfig.Get( query, count, ImageSearchOptions.Build(QueryAdultValues.OFF, imageFilterColor: ImageFilterColorValues.MONOCHROME, imageFilterAspectValue: ImageFilterAspectValues.SQUARE)), debug); // serialize it for temporary storage for any usage // mostly to prevent extra queries when debugging. ImageResultXmlProcessor.Serialize(imageList); } else { Console.WriteLine("Getting ImageQueryResults from XML"); imageList = ImageResultXmlProcessor.Desirialize(); } if (GlobalConfig._download_run_download) { Console.WriteLine("Redownloading images"); // Try and download images var imageDownloader = new ImageDownloader(); imageDownloader.DownloadImages(imageList, DownloadOptions.Build(true, "thumb_"), debug); } else { Console.WriteLine("Using Predownloaded images"); // do not download image and run the composer from what is // already in the folder } var imageComposer = new ImageComposer(); var composedImage = imageComposer.CombineImagesInFolder(GlobalConfig._download_imageDownloadPath, debug); composedImage.Save(GlobalConfig.ComposedImagePath); composedImage.Dispose(); Console.WriteLine("DONE!"); Console.ReadLine(); }
public HudManager() { Images = new Dictionary <string, Image>(); GameEvents = Instance.GameObject.AddComponent <GameEventWatcher>(); ImageDownloader = Instance.GameObject.AddComponent <ImageDownloader>(); MapOverlayGenerator = Instance.GameObject.AddComponent <MapOverlayGenerator>(); }
private async Task GetTopRatedMovies() { var movieApi = MovieDbFactory.Create <IApiMovieRequest>().Value; ApiSearchResponse <MovieInfo> responseMovieInfos = await movieApi.GetTopRatedAsync(); await _movieHelper.GetMovies(responseMovieInfos); _topMoviesList = _movieHelper.MoviesList; // Set image path StorageClient client = new StorageClient(); ImageDownloader downloader = new ImageDownloader(client); foreach (Movie m in _movieHelper.MoviesList) { if (m.ImagePath != null) { string localPath = downloader.LocalPathForFilename(m.ImagePath); // if localPath does not exist then download image if (!File.Exists(localPath)) { await downloader.DownloadImage(m.ImagePath, localPath, new CancellationToken()); } m.setImagePath(localPath); } else { m.setImagePath(""); } } }
private async Task HandleFileDrop(DragEventArgs e) { if (romsListMain.SelectedIndex > -1 && e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] file_paths = (string[])(e.Data.GetData(DataFormats.FileDrop)); var file = file_paths[0]; if (ImageFileValidator.IsValid(file)) { var selected_rom = (Rom)romsListMain.SelectedObject; Library.SetRomImage(selected_rom, file); romsListMain.RefreshSelectedObjects(); } } else if (romsListMain.SelectedIndex > -1 && e.Data.GetDataPresent(DataFormats.Html)) { var selected_rom = (Rom)romsListMain.SelectedObject; string data = (string)e.Data.GetData(DataFormats.Html); string image_path = HtmlCodeImageUrlExtractor.Extract(data); Bitmap image = await ImageDownloader.Download(image_path); if (image != null) { Library.SetRomImage(selected_rom, image); romsListMain.RefreshSelectedObjects(); } } }
// Token: 0x06005156 RID: 20822 RVA: 0x001BE008 File Offset: 0x001BC408 public static void DownloadImage(string url, Action <string, Texture2D> onImageDownloaded = null, string fallbackUrl = "") { if (url != null) { if (url.StartsWith("file:")) { if (Downloader.downloadManager == null) { Downloader.InitializeDownloadManager(); } LocalImageDownloader localImageDownloader = Downloader.downloadManager.AddComponent <LocalImageDownloader>(); localImageDownloader.DownloadLocalImage(url, onImageDownloaded); } else { ImageDownloader.DownloadImage(url, delegate(Texture2D image) { if (onImageDownloaded != null) { onImageDownloaded(url, image); } }, fallbackUrl, false); } } }
public override View GetView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = this._context.LayoutInflater.Inflate(Resource.Layout.expertslistviewitemlayout, null); } var name = convertView.FindViewById <TextView>(Resource.Id.expert_text_name); var university = convertView.FindViewById <TextView>(Resource.Id.expert_text_university); var isexpert = convertView.FindViewById <TextView>(Resource.Id.expert_text_isexpert); var email = convertView.FindViewById <TextView>(Resource.Id.expert_text_email); var degree = convertView.FindViewById <TextView>(Resource.Id.expert_text_degree); var image = convertView.FindViewById <ImageView>(Resource.Id.expert_imageView); var lineitem = _items[position]; name.Text = lineitem.Name; university.Text = lineitem.University; if (lineitem.IsCounsellor == true) { isexpert.Text = "Counsellor"; } email.Text = lineitem.Email; degree.Text = lineitem.Degree; ////implement image loader for the image. var url = GlobalVal.webapibaseurl + lineitem.ImagePath; ImageDownloader.AssignImageAsync(image, url, _context); return(convertView); }
/// <summary> /// Returns all Categories for a given Site /// </summary> /// <param name="siteName"></param> /// <returns></returns> internal List <Category> GetSiteCategories(string siteName) { SiteUtilBase site; if (!OnlineVideoSettings.Instance.SiteUtilsList.TryGetValue(siteName, out site)) { return(new List <Category>()); } if (!site.Settings.DynamicCategoriesDiscovered) { try { site.DiscoverDynamicCategories(); } catch (Exception ex) { Logger.Error("OnlineVideosManager: Error in DiscoverDynamicCategories", ex); } } List <Category> categories = site.Settings.Categories.ToList(); // be clever and already download the Thumbs in the background ImageDownloader.GetImages(categories); return(categories); }
public override async Task DoWork(AbbybotCommandArgs message) { Script script = new Script(CoreModules.Preset_HardSandbox); //no io/sys calls allowed script.Options.DebugPrint = async s => await message.Send(s); //when print is used send message var asx = message.originalMessage.Attachments; foreach (var a in asx) { if (!a.Filename.Contains(".lua")) { continue; } string fileurl = ""; try { fileurl = await ImageDownloader.DownloadImage(a.Url); } catch { await message.Send("I could tell it was a lua file but i couldn't quite get ahold of it... (download failed...)"); } try { var lua = File.ReadAllText(fileurl); DynValue d = script.DoString(lua); } catch { await message.Send("I could tell it was a lua file but i couldn't read it..."); } } }
private static void InitialSitesUpdateAndLoad() { // clear cache files that might be left over from an application crash MPUrlSourceFilter.Downloader.ClearDownloadCache(); // load translation strings TranslationLoader.LoadTranslations(ServiceRegistration.Get <ILocalization>().CurrentCulture.TwoLetterISOLanguageName, Path.Combine(Path.GetDirectoryName(typeof(OnlineVideosPlugin).Assembly.Location), "Language"), "en", "strings_{0}.xml"); // load the xml that holds all configured sites OnlineVideoSettings.Instance.LoadSites(); var settingsManager = ServiceRegistration.Get <ISettingsManager>(); var ovMP2Settings = settingsManager.Load <Configuration.Settings>(); // if the current version is compatible and automatic update is enabled and due, run it before loading the site utils if (Sites.Updater.VersionCompatible && ovMP2Settings.AutomaticUpdate && ovMP2Settings.LastAutomaticUpdate.AddHours(ovMP2Settings.AutomaticUpdateInterval) < DateTime.Now) { Sites.Updater.UpdateSites(); ovMP2Settings.LastAutomaticUpdate = DateTime.Now; settingsManager.Save(ovMP2Settings); // delete old cached thumbs (todo : no better place to do this for now, should be configurable) ImageDownloader.DeleteOldThumbs(30, r => { return(true); }); } // instantiate and initialize all siteutils OnlineVideoSettings.Instance.BuildSiteUtilsList(); }
public override View GetView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = this._context.LayoutInflater.Inflate(Resource.Layout.evallistviewitemlayout, null); } var code = convertView.FindViewById <TextView>(Resource.Id.eval_text_code); var name = convertView.FindViewById <TextView>(Resource.Id.eval_text_name); var subject = convertView.FindViewById <TextView>(Resource.Id.eval_text_subject); var year = convertView.FindViewById <TextView>(Resource.Id.eval_text_year); //var category = convertView.FindViewById<TextView>(Resource.Id.eval_text_category); var duration = convertView.FindViewById <TextView>(Resource.Id.eval_text_duration); var noofquestions = convertView.FindViewById <TextView>(Resource.Id.eval_text_noofquestions); var image = convertView.FindViewById <ImageView>(Resource.Id.eval_imageView); var lineitem = _items[position]; code.Text = lineitem.Code; name.Text = lineitem.Name; subject.Text = lineitem.Subject; year.Text = lineitem.Year.ToString(); //category.Text = lineitem.CategoryId.ToString(); duration.Text = lineitem.Duration.ToString(); noofquestions.Text = lineitem.NoOfQuestions.ToString(); //implement image loader for the image. var url = GlobalVal.webapibaseurl + lineitem.ImagePath; ImageDownloader.AssignImageAsync(image, url, _context); return(convertView); }
public override View GetView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = this._context.LayoutInflater.Inflate(Resource.Layout.mysubscriptionslistviewitemlayout, null); } var name = convertView.FindViewById <TextView>(Resource.Id.mysub_text_name); var category = convertView.FindViewById <TextView>(Resource.Id.mysub_text_category); var subject = convertView.FindViewById <TextView>(Resource.Id.mysub_text_subject); var duration = convertView.FindViewById <TextView>(Resource.Id.mysub_text_duration); var author = convertView.FindViewById <TextView>(Resource.Id.mysub_text_author); var amount = convertView.FindViewById <TextView>(Resource.Id.mysub_text_amount); var image = convertView.FindViewById <ImageView>(Resource.Id.mysub_imageView); var lineitem = _items[position]; name.Text = lineitem.Name; category.Text = lineitem.Category; subject.Text = lineitem.Subject; duration.Text = lineitem.Duration.ToString(); author.Text = lineitem.Author; amount.Text = lineitem.Amount.ToString(); //implement image loader for the image. var url = GlobalVal.webapibaseurl + lineitem.url; ImageDownloader.AssignImageAsync(image, url, _context); return(convertView); }
public override View GetView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = this._context.LayoutInflater.Inflate(Resource.Layout.mymessageslistviewitemlayout, null); } var instructorname = convertView.FindViewById <TextView>(Resource.Id.mymessage_text_instructorname); var message = convertView.FindViewById <TextView>(Resource.Id.mymessage_text_message); var reply = convertView.FindViewById <TextView>(Resource.Id.mymessage_text_reply); var subject = convertView.FindViewById <TextView>(Resource.Id.mymessage_text_subject); var useremail = convertView.FindViewById <TextView>(Resource.Id.mymessage_text_useremail); var read = convertView.FindViewById <TextView>(Resource.Id.mymessage_text_read); var image = convertView.FindViewById <ImageView>(Resource.Id.mymessage_imageView); var lineitem = _items[position]; instructorname.Text = lineitem.InstructorName; message.Text = lineitem.Message; subject.Text = lineitem.Subject; reply.Text = lineitem.Reply; useremail.Text = lineitem.UserEmail; read.Text = lineitem.Read; //implement image loader for the image. var url = GlobalVal.webapibaseurl + lineitem.InstructorImage; ImageDownloader.AssignImageAsync(image, url, _context); return(convertView); }
public frmMain() { InitializeComponent(); #if DEBUG this.mnuMain_HelpDebug.Checked = true; #endif this.mnuMain_ScraperThreads.SelectedIndex = 0; this.FormClosing += new FormClosingEventHandler(frmMain_FormClosing); this._downloader = new ImageDownloader(1); this._imageCache = new GenericCache<string, Image>(5); // Windows XP visuals fix. if (Environment.OSVersion.Version.Major == 5) { this.grpStatus.Location = new Point(247, 27); this.grpStatus.Size -= new Size(0, 6); this.grpPostStats.Location = new Point(0, 76); this.grpPostStats.Size -= new Size(0, 13); } this.treePostWindow.TreeViewNodeSorter = new TreeViewComparer(); #region Tree View Context Menu Setup this.cmTree = new ContextMenu(); this.cmTree.Name = "cmTree"; this.cmTree.Popup += new EventHandler(this.cmTree_Popup); this.cmTree_Rename = new MenuItem("Rename Thread"); this.cmTree_Rename.Name = "cmTree_Rename"; this.cmTree_Rename.Click += new EventHandler(cmTree_Rename_Click); this.cmTree_Delete = new MenuItem("Delete"); this.cmTree_Delete.Name = "cmTree_Delete"; this.cmTree_Delete.Shortcut = Shortcut.Del; this.cmTree_Delete.Click += new EventHandler(cmTree_Delete_Click); this.cmTree_Rescrape = new MenuItem("Rescrape Thread"); this.cmTree_Rescrape.Name = "cmTree_Rescrape"; this.cmTree_Rescrape.Shortcut = Shortcut.CtrlR; this.cmTree_Rescrape.Click += new EventHandler(cmTree_Rescrape_Click); this.cmTree_Download = new MenuItem("Download"); this.cmTree_Download.Name = "cmTree_Download"; this.cmTree_Download.Shortcut = Shortcut.CtrlD; this.cmTree_Download.Click += new EventHandler(cmTree_Download_Click); this.cmTree_OpenInExplorer = new MenuItem("Show Image in Explorer"); this.cmTree_OpenInExplorer.Name = "cmTree_OpenInExplorer"; this.cmTree_OpenInExplorer.Click += new EventHandler(cmTree_OpenInExplorer_Click); this.cmTree_GenerateImgUrl = new MenuItem("Copy 4chan Image URL"); this.cmTree_GenerateImgUrl.Name = "cmTree_GenerateImgUrl"; this.cmTree_GenerateImgUrl.Click += new EventHandler(cmTree_GenerateImgUrl_Click); this.cmTree_GenerateThreadArchive = new MenuItem("Create Thread Archive"); this.cmTree_GenerateThreadArchive.Name = "cmTree_GenerateThreadArchive"; this.cmTree_GenerateThreadArchive.Click += new EventHandler(cmTree_GenerateThreadArchive_Click); this.cmTree_Sep1 = new MenuItem("-"); this.cmTree_Sep1.Name = "cmTree_Sep1"; this.cmTree_Sep2 = new MenuItem("-"); this.cmTree_Sep2.Name = "cmTree_Sep2"; this.cmTree__Thread = new MenuItem[] { this.cmTree_Rescrape, this.cmTree_Download, this.cmTree_Sep1, this.cmTree_Rename, this.cmTree_Delete, this.cmTree_Sep2, this.cmTree_GenerateThreadArchive }; this.cmTree__Post = new MenuItem[] { this.cmTree_Download, this.cmTree_Sep1, this.cmTree_Delete, this.cmTree_Sep2, this.cmTree_OpenInExplorer, this.cmTree_GenerateImgUrl }; this.cmTree.MenuItems.AddRange(this.cmTree__Thread); this.treePostWindow.ContextMenu = this.cmTree; #endregion }
public void DownloadOrLoadImage(ImageDownloadFormat format, string imageURL, string appDataFolderName, float loadingColorAlpha, Action onSuccess = null) { if (!string.IsNullOrEmpty(imageURL) && !string.IsNullOrEmpty(appDataFolderName)) { _progressSpinner.gameObject.SetActive(true); Image image = Image; image.sprite = null; image.color = ColorUtils.ColorWithAlpha(image.color, loadingColorAlpha); void onEnd() { image.color = ColorUtils.ColorWithAlpha(image.color, 1f); _progressSpinner.gameObject.SetActive(false); onSuccess?.Invoke(); } switch (format) { case ImageDownloadFormat.PNG_JPG: ImageDownloader.DownloadIntoOrLoadFromFolder(appDataFolderName, Canvas, imageURL, image, onEnd); break; #if WEBP case ImageDownloadFormat.WebP: DownloadIntoOrLoadWebPFromFolder(appDataFolderName, Canvas, imageURL, image, onEnd); break; #endif default: break; } } }
public MovieSearchViewController(MovieService api, ImageDownloader imageDownloader) { _api = api; _imageDownloader = imageDownloader; _movieList = new List <MovieDetails>(); this.TabBarItem = new UITabBarItem(UITabBarSystemItem.Search, 0); }
/// <summary> /// This routine load the image from a web uri. /// To achieve this it will start a thread in order to not block the application to continue working. /// </summary> /// <param name="ImageUri">The URI of the resource</param> public void LoadScreenshot(string ImageUri) { //_screenshot = null; _imageUri = ImageUri; //Here I create/start the thread to download the image downloader = new ImageDownloader(_imageUri); AddDownloadHandlers(downloader); _progress = new ProgressBar(); _progress.Height = 10; _progress.Width = this.Width - 50; _progress.Top = (this.Height / 2) - 5; _progress.Left = (this.Width / 2) - (_progress.Width / 2); _progress.Style = ProgressBarStyle.Continuous; _progress.Minimum = 0; _progress.Maximum = 100; _progress.Visible = true; this.Controls.Add(_progress); _thread = new Thread(downloader.DoWork); _thread.Start(); }
public MovieListController(ApiSearchResponse <MovieInfo> response, ImageDownloader downloader, IApiMovieRequest movieApi, MovieCredit[] credits) { this._response = response; this._downloader = downloader; this._movieApi = movieApi; this._credits = credits; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Details); // Retrieve navigation parameter and set as current "DataContext" Vm = GlobalNavigation.GetAndRemoveParameter <FlowerViewModel>(Intent); var headerView = LayoutInflater.Inflate(Resource.Layout.CommentsListHeaderView, null); headerView.FindViewById <TextView>(Resource.Id.NameText).Text = Vm.Model.Name; headerView.FindViewById <TextView>(Resource.Id.DescriptionText).Text = Vm.Model.Description; CommentsList.AddHeaderView(headerView); CommentsList.Adapter = Vm.Model.Comments.GetAdapter(GetCommentTemplate); ImageDownloader.AssignImageAsync(FlowerImageView, Vm.Model.Image, this); AddCommentButton.SetCommand(Vm.AddCommentCommand); // Subscribing to events to avoid linker issues in release mode --------------------------------- // This "fools" the linker into believing that the events are used. // In fact we don't even subscribe to them. // See https://developer.xamarin.com/guides/android/advanced_topics/linking/ if (_falseFlag) { AddCommentButton.Click += (s, e) => { }; } }
public IActionResult Index(String type, String domain) { domain = domain.Replace(":", "_"); var filePath = Configs.tempPath; var tempFilePath = "wd.jpg"; filePath = _hostingEnvironment.WebRootPath.TrimEnd('\\', '/') + "/" + filePath.TrimEnd('\\', '/') + "/"; System.IO.Directory.CreateDirectory(filePath); tempFilePath = _hostingEnvironment.WebRootPath.TrimEnd('\\', '/') + "/" + tempFilePath; String p = filePath + "/" + domain + ".ico"; if (!System.IO.File.Exists(p)) { String url = (type == ("1") ? "http" : "https") + "://" + domain + "/favicon.ico"; ImageDownloader.addTask(url, p, _hostingEnvironment.WebRootPath.TrimEnd('\\', '/') + "/wd.ico"); return(File("~/wd.ico", "image/x-icon")); } Response.ContentType = "image/x-icon"; Response.Headers.Add("expires", "Fri Feb 01 2999 00:00:00 GMT+0800"); return(File("~/" + Configs.tempPath + "/" + domain + ".ico", "image/x-icon")); }
private async void DetailForm_Load(object sender, EventArgs e) { var filename = DetailWindowManager.GetReplayFilename(replaypath); GeneralGameFileLabel.Text = filename; try { fileinfo = await ReplayReader.ReadReplayFileAsync(replaypath); ImageDownloader.SetDataDragonVersion(fileinfo.MatchMetadata.GameVersion.ToString()); } catch (Exception ex) { MessageBox.Show("Error Parsing Replay: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } if (fileinfo != null) { DetailWindowManager.PopulatePlayerData(fileinfo.MatchMetadata, this); DetailWindowManager.PopulateGeneralReplayData(fileinfo, this); } else { MessageBox.Show("Error Parsing Replay", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method var client = new StorageClient(); ImageDownloader down = new ImageDownloader(client); this.Window = new UIWindow(UIScreen.MainScreen.Bounds); MovieSettings ApiConnection = new MovieSettings(); DownloadImage download = new DownloadImage(down); MovieService ApiService = new MovieService(download); var MovieSearchController = new MovieController(ApiConnection, ApiService); var MovieSearchNavigationControler = new UINavigationController(MovieSearchController); var MovieRatedController = new RatedController(ApiConnection, ApiService); var MovieRatedNavigationController = new UINavigationController(MovieRatedController); var movieTabController = new MovieTabController() { ViewControllers = new UIViewController[] { MovieSearchNavigationControler, MovieRatedNavigationController } }; this.Window.RootViewController = movieTabController; this.Window.MakeKeyAndVisible(); return(true); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.evalstartevallayout, container, false); var category = view.FindViewById <TextView>(Resource.Id.starteval_text_category); var subject = view.FindViewById <TextView>(Resource.Id.starteval_text_subject); var noofquestions = view.FindViewById <TextView>(Resource.Id.starteval_text_noofquestions); var totalscore = view.FindViewById <TextView>(Resource.Id.starteval_text_totalscore); var textlabel = view.FindViewById <TextView>(Resource.Id.starteval_titlelabel); textlabel.Text = "Start Exam"; var btnnext = view.FindViewById <Button>(Resource.Id.btn_starteval_next); var btnprevious = view.FindViewById <Button>(Resource.Id.btn_starteval_previous); var btnsubmit = view.FindViewById <Button>(Resource.Id.btn_starteval_submit); var qimage = view.FindViewById <ImageView>(Resource.Id.starteval_imageView); var optionlist = view.FindViewById <ListView>(Resource.Id.starteval_optionslistview); var questiontext = view.FindViewById <TextView>(Resource.Id.starteval_text_questiontext); //_bindings.Add(this.SetBinding(() => Vm.Category, category, () => category.Text, BindingMode.TwoWay)); //_bindings.Add(this.SetBinding(() => Vm.NoOfQuestions, noofquestions, () => noofquestions.Text, BindingMode.TwoWay)); //_bindings.Add(this.SetBinding(() => Vm.Subject, subject, () => subject.Text, BindingMode.TwoWay)); //_bindings.Add(this.SetBinding(() => Vm.TotalScore, totalscore, () => totalscore.Text, BindingMode.TwoWay)); //_bindings.Add(this.SetBinding(() => Vm.QuestionText, questiontext, () => questiontext.Text, BindingMode.TwoWay)); Vm.EvalId = msg._evalId; category.Text = Vm.Category; subject.Text = Vm.Subject; noofquestions.Text = Vm.NoOfQuestions.ToString(); totalscore.Text = Vm.TotalScore.ToString(); questiontext.Text = Vm.QuestionText; if (Vm.ImagePath == "") { qimage.Visibility = ViewStates.Gone; } else { qimage.Visibility = ViewStates.Visible; var url = GlobalVal.webapibaseurl + Vm.ImagePath; ImageDownloader.AssignImageAsync(qimage, url, this.Activity); } _bindings.Add(this.SetBinding(() => Vm.QuestionOptionsList).WhenSourceChanges(() => { optionlist.Adapter = Vm.QuestionOptionsList.GetAdapter(GetOptionsList); optionlist.OnItemClickListener = this; })); btnnext.Click += Btnnext_Click; btnprevious.Click += Btnprevious_Click; btnsubmit.Click += Btnsubmit_Click; Vm.LoadStartEvaluationCommand.Execute(msg._evalId); return(view); }
public MovieTopListController(IMovieService movieService, ImageDownloader imageDownloader) { _movieService = movieService; _imageDownloader = imageDownloader; _movies = new List <MovieListViewModel>(); this.TabBarItem = new UITabBarItem(UITabBarSystemItem.TopRated, 1); refreshList = true; }
public static BitmapImage GetImage(string image) { BitmapImage bmp = ImageDownloader.NewLoadingBitmap(); getImage(image, bmp); return(bmp); }
public MovieListDataSource(ApiSearchResponse <MovieInfo> response, Action <int> onSelectedPerson, ImageDownloader downloader, IApiMovieRequest movieApi, MovieCredit[] credits) { this._response = response; this._onSelectedPerson = onSelectedPerson; this._downloader = downloader; this._movieApi = movieApi; this._credits = credits; }
public JobViewModel(JobContainerViewModel container, ImageDownloader model) { _model = model; _model.ChangedTaskStatus += _model_ChangedTaskStatus; _container = container; DownloadStatus = model.Status; ImageUrl = _model.ImageInfo.ImageUrl; OpenImageCommand = new RelayCommand( obj => _model.Open(), obj => { if (_model.DownloadedImageFile == null) return false; //OpenImageCommandを呼び出せるかチェックする際にDownloadStatus //を更新することで、画像を落とした後にその画像を削除し、その上 //で画像のサムネイルをダブルクリックした時にサムネイルの状態を //更新する用にした。 _model.RefreshStatus(); DownloadStatus = _model.Status; return _model.Status == Model.DownloadStatus.Loaded; }); }
public Media CreateYouTubeMedia(Media obj, Guid objID, YouTubeApiResult youTubeResult) { var imgID = Guid.NewGuid().ToString().Substring(0, 12); string fileName = string.Format("{0}.jpg", imgID); using (Stream stream = new ImageDownloader().DownloadImageAsStream(youTubeResult.Thumbnail)) { imgManager.SaveThumb75x75_MediumCompressed(stream, ImageManager.MediaPhotosTmPath, fileName); } obj.FeedVisible = true; //-- Movies are always visible obj.TypeID = (byte)MediaType.Youtube; obj.Content = (new YouTubeMediaData() { Thumbnail = fileName, YouTubeID = youTubeResult.ID }).ToJson(); obj.ContentType = "application/json"; obj.Description = youTubeResult.Description; obj.Author = youTubeResult.Author; obj.TakenDate = DateTime.Parse(youTubeResult.Published).Date; return CreateMedia(obj, objID); }
/// <summary> /// Take an existing image somewhere on the internet and save it using the destination path/name, crop and resize options. /// </summary> /// <param name="originalImgUrl"></param> /// <param name="destFilePath"></param> /// <param name="destFileName"></param> /// <param name="cropOptions"></param> /// <param name="resizeOptions"></param> /// <remarks> /// This method is useful when saving images from "web" (external sites). It is also useful during the upload / cropping process /// </remarks> public void ProcessAndSaveImageFromWebUrl(string originalImgUrl, string destFilePath, string destFileName, ImageCropOpts cropOptions, ImageResizeOpts resizeOptions, ImageCrompressOpts compressOptions) { using (Stream imageStream = new ImageDownloader().DownloadImageAsStream(originalImgUrl)) { ProcessAndSaveImageFromStream(imageStream, destFilePath, destFileName, cropOptions, resizeOptions, compressOptions, null); } }