コード例 #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     currentSite = sites.Find(x => x.name.Contains((String)comboBoxSites.SelectedValue));
     if (!worker.IsBusy)
     {
         worker.RunWorkerAsync();
     }
     timerNewImg.Interval = (int)timeSlider.Value * 1000;
 }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();
            sites = new List <site>();
            sites.Add(new site {
                name = "konachan.net", url = "http://konachan.net/post/random"
            });
            sites.Add(new site {
                name = "konachan.com", url = "http://konachan.com/post/random"
            });
            //sites.Add(new site { name = "danbooru.donmai.us", url = "https://danbooru.donmai.us/posts/random" }); //not working with tags
            sites.Add(new site {
                name = "gelbooru.com", url = "https://gelbooru.com/index.php?page=post&s=random"
            });
            sites.Add(new site {
                name = "local", url = "127.0.0.1"
            });

            comboBoxSites.ItemsSource       = sites;
            comboBoxSites.DisplayMemberPath = "name";
            comboBoxSites.SelectedValuePath = "name";
            currentSite = sites.Find(x => x.name.Contains(Properties.Settings.Default.site));
            comboBoxSites.SelectedIndex = sites.FindIndex(x => x.name.Contains(Properties.Settings.Default.site));
            timeSlider.Value            = Properties.Settings.Default.time;
            filter.Text     = Properties.Settings.Default.tags;
            filterText      = Properties.Settings.Default.tags;
            rateS.IsChecked = Properties.Settings.Default.rateS;
            rateQ.IsChecked = Properties.Settings.Default.rateQ;
            rateE.IsChecked = Properties.Settings.Default.rateE;

            subFolder.Add(imagePath);
            subFolder.AddRange(Directory.GetDirectories(imagePath));
            comboBoxFolder.ItemsSource   = subFolder;
            comboBoxFolder.SelectedIndex = subFolder.FindIndex(x => x.Contains(Properties.Settings.Default.subFolder));
            currentFolder = Properties.Settings.Default.subFolder;

            worker.DoWork               += worker_DoWork;
            worker.RunWorkerCompleted   += worker_RunWorkerCompleted;
            worker.ProgressChanged      += worker_ProgressChanged;
            worker.WorkerReportsProgress = true;

            var runningProcessByName = Process.GetProcessesByName("httpd");

            if (runningProcessByName.Length == 0)
            {
                Process.Start("E:/xampp/apache_start.bat");
            }

            srcUrl = sites.Find(x => x.name.Contains(Properties.Settings.Default.site)).url;
            worker.RunWorkerAsync();
            InitTimer();
        }
コード例 #3
0
 private void comboBoxSites_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     currentSite = sites.Find(x => x.name.Contains((String)comboBoxSites.SelectedValue));
 }