public void Start()
        {
            mObjectsSpawnedSoFar = 0;

            if (this.SourceObjectPool == null && !string.IsNullOrEmpty(this.ResourceName))
            {
                ChangeTemplate(this.ResourceName);
            }

            if (!this.SpawnAllObjectsAtOnce)
            {
                mSpawnTimer       = new FrequencyTimer(Common.TimeScale.Scaled);
                mSpawnTimer.Tick += SpawnObject;
            }

            if (this.ActiveOnStart)
            {
                if (!this.SpawnAllObjectsAtOnce)
                {
                    mSpawnTimer.Start(this.SpawnFrequency);
                }
                else
                {
                    SpawnAllObjects();
                }
            }
        }
Пример #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 Awake()
        {
            this.mAnchorPosition = Vector3.zero;
            this.mLastPosition   = Vector3.zero;
            this.mBodyHasMoved   = true;
            this.mTimer          = new UpdateTimer(Common.TimeScale.Scaled);
            this.mFTimer         = new FrequencyTimer(Common.TimeScale.Scaled);

            this.mFTimer.Tick += mFTimer_Tick;
            this.mFTimer.Start(this.CheckIntervalSeconds);

            this.mAnchorPosition = this.transform.position;
        }
Пример #4
0
        private void LoadAllFeeds()
        {
            var feeds = FeedManager.LoadFeeds();

            if (Validator.IsNotNull(feeds))
            {
                _FeedGroup.AddRange(feeds);
                UpdateFeedListView();
                foreach (Feed feed in feeds)
                {
                    FrequencyTimer.Start(feed);
                }
            }
        }
        private void Start()
        {
            if (this.Frequency <= 0f)
            {
                throw new ArgumentOutOfRangeException("Frequency cannot be less than or equal to zero");
            }

            mStartedEmitting = false;
            mDurationTimer   = new UpdateTimer(Common.TimeScale.Scaled);
            mFireTimer       = new FrequencyTimer(Common.TimeScale.Scaled);
            mFireTimer.Tick += this.FireParticle;

            if (this.StartOnAwake)
            {
                Begin();
            }
        }