コード例 #1
0
ファイル: Data.cs プロジェクト: xbotuk/Forex-Strategy-Builder
        /// <summary>
        ///     Initial settings.
        /// </summary>
        public static void Start()
        {
            // Sets the date format.
            if (DateTimeFormatInfo.CurrentInfo != null)
            {
                Df = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
            }
            if (Df == "dd/MM yyyy")
            {
                Df = "dd/MM/yyyy";    // Fixes the Uzbek (Latin) issue
            }
            Df = Df.Replace(" ", ""); // Fixes the Slovenian issue
            if (DateTimeFormatInfo.CurrentInfo != null)
            {
                char[]   acDs = DateTimeFormatInfo.CurrentInfo.DateSeparator.ToCharArray();
                string[] asSs = Df.Split(acDs, 3);
                asSs[0] = asSs[0].Substring(0, 1) + asSs[0].Substring(0, 1);
                asSs[1] = asSs[1].Substring(0, 1) + asSs[1].Substring(0, 1);
                asSs[2] = asSs[2].Substring(0, 1) + asSs[2].Substring(0, 1);
                Df      = asSs[0] + acDs[0] + asSs[1] + acDs[0] + asSs[2];

                if (asSs[0].ToUpper() == "YY")
                {
                    Dfs = asSs[1] + acDs[0] + asSs[2];
                }
                else if (asSs[1].ToUpper() == "YY")
                {
                    Dfs = asSs[0] + acDs[0] + asSs[2];
                }
                else
                {
                    Dfs = asSs[0] + acDs[0] + asSs[1];
                }
            }

            var  presentationUtils = new PresentationUtils();
            Size dpi = presentationUtils.GetScreenDpi();

            VDpiScale = dpi.Height / 96.0;
            HDpiScale = dpi.Width / 96.0;

            // Point character
            CultureInfo cultureInfo = CultureInfo.CurrentCulture;

            PointChar = cultureInfo.NumberFormat.NumberDecimalSeparator.ToCharArray()[0];

            // Set the working directories
            ProgramsDir  = Directory.GetCurrentDirectory();
            UserFilesDir = Path.Combine(ProgramsDir, UserFilesDir);

            DefaultOfflineDataDir = Path.Combine(UserFilesDir, OfflineDataDir);
            OfflineDataDir        = DefaultOfflineDataDir;
            OfflineDocsDir        = Path.Combine(UserFilesDir, OfflineDocsDir);
            StrategyDir           = Path.Combine(UserFilesDir, DefaultStrategyDir);
            SourceFolder          = Path.Combine(UserFilesDir, SourceFolder);
            SystemDir             = Path.Combine(UserFilesDir, SystemDir);
            LibraryDir            = Path.Combine(UserFilesDir, LibraryDir);
            LanguageDir           = Path.Combine(SystemDir, LanguageDir);
            ColorDir = Path.Combine(SystemDir, ColorDir);

            // Scanner colors
            PeriodColor.Add(DataPeriod.M1, ColorTranslator.FromHtml("#04FF14"));
            PeriodColor.Add(DataPeriod.M5, ColorTranslator.FromHtml("#87E800"));
            PeriodColor.Add(DataPeriod.M15, ColorTranslator.FromHtml("#FFED00"));
            PeriodColor.Add(DataPeriod.M30, ColorTranslator.FromHtml("#E8C400"));
            PeriodColor.Add(DataPeriod.H1, ColorTranslator.FromHtml("#E8AB00"));
            PeriodColor.Add(DataPeriod.H4, ColorTranslator.FromHtml("#FF8B07"));
            PeriodColor.Add(DataPeriod.D1, ColorTranslator.FromHtml("#E84006"));
            PeriodColor.Add(DataPeriod.W1, ColorTranslator.FromHtml("#FF0E1F"));
        }
コード例 #2
0
        /// <summary>
        /// Initial settings.
        /// </summary>
        public static void Start()
        {
            // Sets the date format.
            if (DateTimeFormatInfo.CurrentInfo != null)
            {
                DF = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
            }
            if (DF == "dd/MM yyyy")
            {
                DF = "dd/MM/yyyy";    // Fixes the Uzbek (Latin) issue
            }
            DF = DF.Replace(" ", ""); // Fixes the Slovenian issue
            if (DateTimeFormatInfo.CurrentInfo != null)
            {
                char[]   acDS = DateTimeFormatInfo.CurrentInfo.DateSeparator.ToCharArray();
                string[] asSS = DF.Split(acDS, 3);
                asSS[0] = asSS[0].Substring(0, 1) + asSS[0].Substring(0, 1);
                asSS[1] = asSS[1].Substring(0, 1) + asSS[1].Substring(0, 1);
                asSS[2] = asSS[2].Substring(0, 1) + asSS[2].Substring(0, 1);
                DF      = asSS[0] + acDS[0] + asSS[1] + acDS[0] + asSS[2];

                if (asSS[0].ToUpper() == "YY")
                {
                    DFS = asSS[1] + acDS[0] + asSS[2];
                }
                else if (asSS[1].ToUpper() == "YY")
                {
                    DFS = asSS[0] + acDS[0] + asSS[2];
                }
                else
                {
                    DFS = asSS[0] + acDS[0] + asSS[1];
                }
            }

            // Point character
            CultureInfo cultureInfo = CultureInfo.CurrentCulture;

            PointChar = cultureInfo.NumberFormat.NumberDecimalSeparator.ToCharArray()[0];

            // Set the working directories
            ProgramDir            = Directory.GetCurrentDirectory();
            DefaultOfflineDataDir = Path.Combine(ProgramDir, OfflineDataDir);
            OfflineDataDir        = DefaultOfflineDataDir;
            OfflineDocsDir        = Path.Combine(ProgramDir, OfflineDocsDir);
            StrategyDir           = Path.Combine(ProgramDir, DefaultStrategyDir);
            SourceFolder          = Path.Combine(ProgramDir, SourceFolder);
            SystemDir             = Path.Combine(ProgramDir, SystemDir);
            LanguageDir           = Path.Combine(SystemDir, LanguageDir);
            ColorDir = Path.Combine(SystemDir, ColorDir);

            // Scanner colors
            PeriodColor.Add(DataPeriods.min1, Color.Yellow);
            PeriodColor.Add(DataPeriods.min5, Color.Lime);
            PeriodColor.Add(DataPeriods.min15, Color.Green);
            PeriodColor.Add(DataPeriods.min30, Color.Orange);
            PeriodColor.Add(DataPeriods.hour1, Color.DarkSalmon);
            PeriodColor.Add(DataPeriods.hour4, Color.Peru);
            PeriodColor.Add(DataPeriods.day, Color.Red);
            PeriodColor.Add(DataPeriods.week, Color.DarkViolet);
        }