Ejemplo n.º 1
0
        protected override void OnStart(string[] args)
        {
            try
            {
                RobotCollection.Initialize();
            }
            catch (Exception ex)
            {
                Logger.Error("Ошибка инициализации коллекции роботов", ex);
                throw;
            }

            QuoteStorage.Instance.LoadQuotes(string.Format("{0}\\lastquote.txt", ExecutablePath.ExecPath));
            try
            {
                quoteReceiver = new TcpQuoteReceiver();
            }
            catch (Exception ex)
            {
                Logger.Error("Ошибка получения котировок", ex);
                throw;
            }

            Logger.InfoFormat("Старт сервиса - загрузка настроек");
            BL.RobotFarm.Instance.LoadSettings();
            quoteReceiver.OnQuotesReceived += BL.RobotFarm.Instance.OnQuotesReceived;
            StartWebServer();
        }
Ejemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();
            workerQuote.WorkerSupportsCancellation = true;
            workerQuote.WorkerReportsProgress      = true;
            workerQuote.DoWork          += WorkerQuoteOnDoWork;
            workerQuote.ProgressChanged += (sender, args) =>
            {
                lblWorkerProgress.Text = "прогресс: " + args.ProgressPercentage;
            };
            workerQuote.RunWorkerCompleted += WorkerQuoteOnRunWorkerCompleted;

            RobotCollection.Initialize();
        }
Ejemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();
            SetupDaysOff();

            workerQuote.WorkerSupportsCancellation = true;
            workerQuote.WorkerReportsProgress      = true;
            workerQuote.DoWork          += WorkerQuoteOnDoWork;
            workerQuote.ProgressChanged += (sender, args) =>
            {
                lblWorkerProgress.Text = "прогресс: " + args.ProgressPercentage;
            };
            workerQuote.RunWorkerCompleted += WorkerQuoteOnRunWorkerCompleted;

            receiver = new TcpQuoteReceiver();
            receiver.OnQuotesReceived += (names, quotes) =>
            {
                LiveQuotes.Instance.UpdateQuotes(names, quotes);
            };

            RobotCollection.Initialize();
        }