Exemplo n.º 1
0
        private TopicsForm()
        {
            InitializeComponent();
            this.Icon = Resources.AppIcon;
            this.api  = UnsplashAPI.GetInstance();

            List <string> topicsSelected = Utils.GetSetting("topicsSelected").Split(',').ToList();

            topicsBox.CheckOnClick = true;
            topicsBox.BeginUpdate();

            foreach (var topic in api.GetTopicsList())
            {
                var selected = topicsSelected.FirstOrDefault(x => x == topic.title);

                if (selected != null)
                {
                    topicsBox.Items.Add(topic.title, CheckState.Checked);
                }
                else
                {
                    topicsBox.Items.Add(topic.title);
                }
            }

            topicsBox.EndUpdate();
        }
Exemplo n.º 2
0
        public static UnsplashAPI GetInstance()
        {
            if (api == null)
            {
                api = new UnsplashAPI();
            }

            return(api);
        }
        public Worker()
        {
            SetTimer(int.Parse(Utils.GetSetting("defaultUpdateInterval")) * 60 * 1000);

            api = UnsplashAPI.GetInstance();

            worker = new BackgroundWorker
            {
                WorkerSupportsCancellation = true
            };
            worker.DoWork             += Worker_DoWork;
            worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
        }
        private void UpdateFolder(object sender, EventArgs e)
        {
            UnsplashAPI api = UnsplashAPI.GetInstance();

            api.GetPhotos();
        }