/// <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]; } var presentationUtils = new PresentationUtils(); Size dpi = presentationUtils.GetScreenDpi(); VDpiScale = dpi.Height/96.0; HDpiScale = dpi.Width/96.0; // Point character CultureInfo culInf = CultureInfo.CurrentCulture; PointChar = culInf.NumberFormat.NumberDecimalSeparator.ToCharArray()[0]; // Set the working directories ProgramDir = Directory.GetCurrentDirectory(); UserFilesDir = Path.Combine(ProgramDir, UserFilesDir); 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); 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(); }
/// <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, Color.Yellow); PeriodColor.Add(DataPeriod.M5, Color.Lime); PeriodColor.Add(DataPeriod.M15, Color.Green); PeriodColor.Add(DataPeriod.M30, Color.Orange); PeriodColor.Add(DataPeriod.H1, Color.DarkSalmon); PeriodColor.Add(DataPeriod.H4, Color.Peru); PeriodColor.Add(DataPeriod.D1, Color.Red); PeriodColor.Add(DataPeriod.W1, Color.DarkViolet); }