aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/Properties/Settings.settings
blob: 033d7a5e9e2266753180f4e3a9299f575046701e (plain)
1
2
3
4
5
6
7
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
  <Profiles>
    <Profile Name="(Default)" />
  </Profiles>
  <Settings />
</SettingsFile>
ht: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Settings;

namespace Tango.MachineStudio.Common.Helpers
{
    /// <summary>
    /// Contains RealTimeGraphEx helper methods.
    /// </summary>
    public static class GraphsHelper
    {
        /// <summary>
        /// Gets the maximum points graph points by correlating between seconds duration from settings and expected graph points per frame.
        /// </summary>
        /// <param name="pointsPerFrame">Length of graph points per frame.</param>
        /// <returns></returns>
        public static int GetMaxPoints(double pointsPerFrame)
        {
            try
            {
                var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();

                double seconds = settings.GraphsViewDurationSeconds;
                double pullRate = settings.DiagnosticsResponseIntervalMilli;
                return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65);
            }
            catch (Exception)
            {
                return 300;
            }
        }
    }
}