public object Execute(object command, IFetch executor)
 {
     try
     {
         return executor.Fetch(command);
     }
     finally
     {
         _container.Release(executor);
     }
 }
    public Nasa Fetch()
    {
        var result = _fetcher.Fetch();

        if (result != null)
        {
            switch (result.media_type)
            {
            case "image":
                var nasaFetchImageTransformer = new NasaFetchImageTransformer();
                nasaFetchImageTransformer.Transform(result);
                break;

            case "video":
                var nasaFetchVideoTransformer = new NasaFetchVideoTransformer();
                nasaFetchVideoTransformer.Transform(result);
                break;
            }
        }

        return(result);
    }
Esempio n. 3
0
 public void Display(IFetch <T> fetch, int id)
 {
     myLabel.Text = fetch.Fetch(id).ToString();
 }