Exemplo n.º 1
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 Sloven issue
                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].ToString(CultureInfo.InvariantCulture) + asSS[1] +
                          acDS[0].ToString(CultureInfo.InvariantCulture) + asSS[2];

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

            // Point character
            CultureInfo culInf = CultureInfo.CurrentCulture;

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

            // Set the working directories
            ProgramDir   = Directory.GetCurrentDirectory();
            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);

            try
            {
                SoundConnect         = new SoundPlayer(Path.Combine(SystemDir, @"Sounds\connect.wav"));
                SoundDisconnect      = new SoundPlayer(Path.Combine(SystemDir, @"Sounds\disconnect.wav"));
                SoundError           = new SoundPlayer(Path.Combine(SystemDir, @"Sounds\error.wav"));
                SoundOrderSent       = new SoundPlayer(Path.Combine(SystemDir, @"Sounds\order_sent.wav"));
                SoundPositionChanged = new SoundPlayer(Path.Combine(SystemDir, @"Sounds\position_changed.wav"));
            }
            catch
            {
                SoundConnect         = new SoundPlayer(Resources.sound_connect);
                SoundDisconnect      = new SoundPlayer(Resources.sound_disconnect);
                SoundError           = new SoundPlayer(Resources.sound_error);
                SoundOrderSent       = new SoundPlayer(Resources.sound_order_sent);
                SoundPositionChanged = new SoundPlayer(Resources.sound_position_changed);
            }

            Logger = new Logger();
        }
Exemplo n.º 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);
        }