Esempio n. 1
0
        private void _fireworkManager_LineStarted(object sender, EventArgs e)
        {
            Line line = sender as Line;

            ComputeVisiblePeriod(line);
        }
Esempio n. 2
0
        private void ComputeVisiblePeriod(Line line)
        {
            TimeSpan lineIgnition = line.Ignition;

            DateTime visiblePeriodStart = DateTime.Now.Date.Add(line.Ignition).Subtract(new TimeSpan(0, 0, 20));
            DateTime visiblePeriodEnd   = DateTime.Now.Date.Add(line.Ignition).Add(new TimeSpan(0, 0, 40));

            //Change visible port view only if new visible period start - 20 s > period start ui
            if (visiblePeriodStart.CompareTo(_fireworkManager.PeriodStartUI) > 0)
            {
                _dispatcher.BeginInvoke((Action)(() =>
                {
                    _fireworkTimeline.VisiblePeriod = new Telerik.Windows.Controls.SelectionRange <DateTime>(visiblePeriodStart, visiblePeriodEnd);
                }));
            }

            _dispatcher.BeginInvoke((Action)(() =>
            {
                //Vertical part
                if (_verticalSlider != null)
                {
                    int nbOfElementVisiblePerRange = Convert.ToInt32(Math.Truncate((_fireworkManager.AllActiveFireworks.Count() * this._verticalSlider.SelectionRange)));
                    double range = (line.Fireworks[0].RadRowIndex * this._verticalSlider.SelectionRange / nbOfElementVisiblePerRange);


                    //End?
                    if (range + this._verticalSlider.SelectionRange - (this._verticalSlider.SelectionRange / 4) > 1)
                    {
                        this._verticalSlider.Selection = new SelectionRange <double>(1 - this._verticalSlider.SelectionRange, 1);
                        return;
                    }

                    //Mid screen reached?
                    if (range > (this._verticalSlider.SelectionRange / 4))
                    {
                        var newStart = range - (this._verticalSlider.SelectionRange / 4);
                        var newEnd = range + this._verticalSlider.SelectionRange - (this._verticalSlider.SelectionRange / 4);
                        this._verticalSlider.Selection = new SelectionRange <double>(newStart, newEnd);
                    }



                    /* double thirdScreenScroll = this._verticalSlider.SelectionRange / 2;
                     *
                     * int nbOfElementVisiblePerRange = Convert.ToInt32(Math.Truncate((_fireworkManager.AllFireworks.Count() * this._verticalSlider.SelectionRange) / 2));
                     *
                     * // nbOfElementVisiblePerRange = nbOfElementVisiblePerRange - 3;
                     *
                     * int decalage = Convert.ToInt32(Math.Truncate(Convert.ToDouble(line.Fireworks[0].RadRowIndex / nbOfElementVisiblePerRange)));
                     *
                     * //double range = decalage * halfScreenScroll;
                     *
                     * if (_oldDecalage != decalage)
                     * {
                     *   var newStart = this._verticalSlider.SelectionStart + thirdScreenScroll;
                     *   var newEnd = this._verticalSlider.SelectionEnd + thirdScreenScroll;
                     *   this._verticalSlider.Selection = new SelectionRange<double>(newStart, newEnd);
                     *
                     *   _oldDecalage = decalage;
                     * }*/
                }
            }));
        }
Esempio n. 3
0
 public FireworkManagementWindow(FireworkManager fm, SoftwareConfiguration softwareConfiguration, Line line) : this(fm, softwareConfiguration)
 {
     _line = line;
 }