示例#1
0
        private void AddSources()
        {
            var p = Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), "bin");
            var catalog = new DirectoryCatalog(p, "*.dll");

            var container = new CompositionContainer(catalog);
            container.ComposeParts(this);
            if (null != this._eventSource)
                this.Application.Add("EventSource", this._eventSource);
            if(null != this._picSource)
            {
                if(this._picSource.RequiresCredentials)
                {
                    PictureCredentials creds;
                    string apiKey = ConfigurationManager.AppSettings["photoAPIKey"];
                    string secretKey = ConfigurationManager.AppSettings["photoSecretKey"];
                    if (!string.IsNullOrEmpty(apiKey))
                        creds = new PictureCredentials(apiKey, secretKey);
                    else
                        creds = new PictureCredentials(System.IO.File.ReadAllLines(@"c:\temp\flickrcred.txt"));
                    this._picSource.Init(creds);
                }
                this.Application.Add("PhotoSource", this._picSource);
            }
            if(null != this._voteSource)
                this.Application.Add("VoteSource", this._voteSource);
            if(null != this._claimSource)
                this.Application.Add("ClaimSource", this._claimSource);
            if (null != this._doorSource)
                this.Application.Add("DoorSource", this._doorSource);
        }
示例#2
0
 public bool Init(PictureCredentials Credentials)
 {
     _flickr = new Flickr(Credentials.APIKey, Credentials.Secret);
     _flickr.InstanceCacheDisabled = true;
     return true;
 }
示例#3
0
 public bool Init(PictureCredentials Credentials)
 {
     return true;
 }