Esempio n. 1
0
        /// <summary>
        /// The default constructor
        /// </summary>
        public Actions()
        {
            StartPosition     = FormStartPosition.CenterScreen;
            Size              = new Size(790, 590);
            MinimumSize       = new Size(500, 375);
            Icon              = Data.Icon;
            Text              = Data.ProgramName;
            FormClosing      += new FormClosingEventHandler(Actions_FormClosing);
            Application.Idle += new EventHandler(Application_Idle);

            // Load a data file
            UpdateStatusLabel("Loading historical data...");
            if (LoadInstrument(false) != 0)
            {
                LoadInstrument(true);
                string messageText = Language.T("Forex Strategy Builder cannot load a historical data file and is going to use integrated data!");
                MessageBox.Show(messageText, Language.T("Data File Loading"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            // Prepare custom indicators
            if (Configs.LoadCustomIndicators)
            {
                UpdateStatusLabel("Loading custom indicators...");
                Custom_Indicators.LoadCustomIndicators();
            }
            else
            {
                Indicator_Store.CombineAllIndicators();
            }

            // Load a strategy
            UpdateStatusLabel("Loading strategy...");
            string sStrategyPath = Data.StrategyPath;

            if (Configs.RememberLastStr && Configs.LastStrategy != "")
            {
                string sLastStrategy = Path.GetDirectoryName(Configs.LastStrategy);
                if (sLastStrategy != "")
                {
                    sLastStrategy = Configs.LastStrategy;
                }
                else
                {
                    string sPath = Path.Combine(Data.ProgramDir, Data.DefaultStrategyDir);
                    sLastStrategy = Path.Combine(sPath, Configs.LastStrategy);
                }
                if (File.Exists(sLastStrategy))
                {
                    sStrategyPath = sLastStrategy;
                }
            }

            if (OpenStrategy(sStrategyPath) == 0)
            {
                AfterStrategyOpening(false);
            }

            Calculate(false);

            Check_Update liveContent = new Check_Update(Data.SystemDir, miLiveContent, miForex);

            Registrar registrar = new Registrar();

            registrar.Register();

            // Starting tips
            if (Configs.ShowStartingTip)
            {
                Starting_Tips startingTips = new Starting_Tips();
                startingTips.Show();
            }

            UpdateStatusLabel("Loading user interface...");

            return;
        }
        /// <summary>
        /// The default constructor
        /// </summary>
        public Actions()
        {
            StartPosition     = FormStartPosition.CenterScreen;
            Size              = new Size(790, 590);
            MinimumSize       = new Size(500, 375);
            Icon              = Data.Icon;
            Text              = Data.ProgramName;
            FormClosing      += new FormClosingEventHandler(Actions_FormClosing);
            Application.Idle += new EventHandler(Application_Idle);

            // Load a data file
            UpdateStatusLabel("Loading historical data...");
            if (LoadInstrument(false) != 0)
            {
                LoadInstrument(true);
                string messageText = Language.T("Forex Strategy Builder cannot load a historical data file and is going to use integrated data!");
                MessageBox.Show(messageText, Language.T("Data File Loading"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            // Prepare custom indicators
            if (Configs.LoadCustomIndicators)
            {
                UpdateStatusLabel("Loading custom indicators...");
                Custom_Indicators.LoadCustomIndicators();
            }
            else
                Indicator_Store.CombineAllIndicators();

            // Load a strategy
            UpdateStatusLabel("Loading strategy...");
            string sStrategyPath = Data.StrategyPath;

            if (Configs.RememberLastStr && Configs.LastStrategy != "")
            {
                string sLastStrategy = Path.GetDirectoryName(Configs.LastStrategy);
                if (sLastStrategy != "")
                    sLastStrategy = Configs.LastStrategy;
                else
                {
                    string sPath = Path.Combine(Data.ProgramDir, Data.DefaultStrategyDir);
                    sLastStrategy = Path.Combine(sPath, Configs.LastStrategy);
                }
                if (File.Exists(sLastStrategy))
                    sStrategyPath = sLastStrategy;
            }

            if (OpenStrategy(sStrategyPath) == 0)
            {
                AfterStrategyOpening(false);
            }

            Calculate(false);

            Check_Update liveContent = new Check_Update(Data.SystemDir, miLiveContent, miForex);

            Registrar registrar = new Registrar();
            registrar.Register();

            // Starting tips
            if (Configs.ShowStartingTip)
            {
                Starting_Tips startingTips = new Starting_Tips();
                startingTips.Show();
            }

            UpdateStatusLabel("Loading user interface...");

            return;
        }