public void StartSpawning()
 {
     if (mSpawnTimer != null)
     {
         mSpawnTimer.Start(this.SpawnFrequency);
     }
 }
示例#2
0
        private async void btnAddPodcast_Click(object sender, EventArgs e)
        {
            if (Validator.TryParseComboBoxValue(cmbFreq, out string message))
            {
                if (Validator.CheckIfFeedExists(txtURL.Text, _FeedGroup.GetAll()))
                {
                    if (Validator.AllFieldsFilled(txtURL.Text, cmbCat))
                    {
                        Category category = (Category)cmbCat.SelectedItem;
                        var      time     = int.Parse(cmbFreq.SelectedItem.ToString());

                        Feed feed = null;

                        Task  taskA = Task.Run(() => feed = FeedManager.CreateFeed(txtURL.Text, category, new UpdateFrequency(time)));
                        await taskA;

                        if (Validator.IsNotNull(feed))
                        {
                            _FeedGroup.Add(feed);
                            ListViewItem item = new ListViewItem(new[] {
                                feed.NumberOfEpisodes.ToString(),
                                feed.Name,
                                feed.Frequency.Minutes.ToString(),
                                feed.Category.Name
                            })
                            {
                                Tag = feed
                            };
                            lvPodcasts.Items.Add(item);
                            FrequencyTimer.Start(feed);
                            txtURL.Clear();
                            UpdateFeedListView();
                        }
                        else
                        {
                            MessageBox.Show("Ogiltig URL");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Fyll i alla fälten korrekt");
                    }
                }
                else
                {
                    MessageBox.Show("Feeden finns redan");
                }
            }
            else
            {
                MessageBox.Show(message);
            }
        }
示例#3
0
        private void LoadAllFeeds()
        {
            var feeds = FeedManager.LoadFeeds();

            if (Validator.IsNotNull(feeds))
            {
                _FeedGroup.AddRange(feeds);
                UpdateFeedListView();
                foreach (Feed feed in feeds)
                {
                    FrequencyTimer.Start(feed);
                }
            }
        }
        /// <summary>
        /// Begins the emitting process
        /// </summary>
        public void Begin()
        {
            if (string.IsNullOrEmpty(this.ParticleName))
            {
                throw new ArgumentException("Particle name cannot be empty");
            }

            if (this.Duration != -1f)
            {
                mDurationTimer.Start(this.Duration);
            }

            mFireTimer.Start(this.Frequency);
            mStartedEmitting = true;
        }