コード例 #1
0
        public SettingsTableViewModel(CBotBase bot, ControlBotGUI botGUI)
        {
            try
            {
                _bot    = bot;
                _botGUI = botGUI;
                int cnt = 0;

                //use only case when one instr
                if (_bot.SettingsBot.ListIsins.Count == 1)
                {
                    string isin = bot.SettingsBot.ListIsins[0];

                    SetBorder();

                    AddNewSettingRecord("Instr:", isin);

                    CTradingSettings ts = _bot.SettingsBot.TradingSettings[isin];
                    AddNewSettingRecord("Lot:", ts.Lot.ToString());
                    AddNewSettingRecord("Stoploss:", ts.StopLoss.ToString());
                    AddNewSettingRecord("TakeProfit:", ts.TakeProfit.ToString());

                    foreach (var v in bot.SettingsStrategy)
                    {
                        AddNewSettingRecord(v.Key, v.Value);
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
コード例 #2
0
        private void BindBotControls(ControlBotGUI botGUI, CBotBase bot)
        {
            bot.GUIBot.DisposeGUIBotEvent += botGUI.OnDisposeGUIBot;
            botGUI.GUIBot = bot.GUIBot;

            botGUI.DataContext = bot;
            botGUI.EllipseEnabled.DataContext = bot;
            botGUI.TextEnabled.DataContext    = bot;

            //botGUI.EllipseReady.DataContext = bot.GUIBot;
            botGUI.EllipseReady.DataContext = bot;
            botGUI.TextReady.DataContext    = bot;

            botGUI.ButtonEnableBot.DataContext     = bot;
            botGUI.ButtonDisableBot.DataContext    = bot;
            botGUI.ButtonManualControl.DataContext = bot;

            botGUI.MonitorPos.ItemsSource = bot.GUIBot.MonitorPos;

            botGUI.DealingServer = Plaza2Connector;
            bot.GUIBot.MonitorPos.CollectionChanged += botGUI.OnMonitorPosCollectionChanged;

            botGUI.Orders.ItemsSource            = bot.GUIBot.Orders;
            bot.GUIBot.Orders.CollectionChanged += botGUI.OnMonitorOrdersCollectionChanged;

            bot.GUIBot.DisposeGUIBotEvent += botGUI.OnDisposeGUIBot;


            botGUI.ButtonPosLog.Id            = bot.BotId;
            botGUI.ButtonPosLog.BotOperations = Plaza2Connector;

            botGUI.ButtonDisableBot.Id            = bot.BotId;
            botGUI.ButtonDisableBot.BotOperations = Plaza2Connector;

            botGUI.ButtonEnableBot.Id            = bot.BotId;
            botGUI.ButtonEnableBot.BotOperations = Plaza2Connector;

            botGUI.ButtonLoadBot.Id            = bot.BotId;
            botGUI.ButtonLoadBot.BotOperations = Plaza2Connector;

            botGUI.ButtonManualControl.Id            = bot.BotId;
            botGUI.ButtonManualControl.BotOperations = Plaza2Connector;



            BindBotButtons(ref botGUI.ButtonPosLog, bot);
            BindBotButtons(ref botGUI.ButtonDisableBot, bot);
            BindBotButtons(ref botGUI.ButtonEnableBot, bot);
            BindBotButtons(ref botGUI.ButtonUnloadBot, bot);

            //botGUI.StopBot


            _vmSTab = new SettingsTableViewModel(bot, botGUI);


            CUtil.SetBinding(bot.GUIBot, "BotState", botGUI.BotSate, ControlSettingsDataBlock.SettingValueTextProperty);
            botGUI.EvntLoadBot += OnBotLoad;
        }
コード例 #3
0
        private void OnBotLoad(ControlBotGUI botGUI, long botId)
        {
            CBotBase bot = DealingServer.GetBotById(botId);

            if (bot != null)
            {
                BindBotControls(botGUI, bot);
            }
        }
コード例 #4
0
        private void OnBotLoad(ControlBotGUI botGUI, long botId)
        {
            CBotBase bot = Plaza2Connector.GetBotById(botId);

            if (bot != null)
            {
                BindBotControls(botGUI, bot);
            }
        }