Ejemplo n.º 1
0
        private void ToggleCharts()
        {
            //LogManager.AddLogMessage(Name, "ToggleCharts", PreferenceManager.ArbitragePreferences.ShowCharts.ToString(), LogManager.LogMessageType.DEBUG);
            ArbitrageWatchList watchlist = ArbitragePreferences.GetCurrentWatchList();

            if (WatchList.ShowCharts)
            {
                // Remove Charts
                //WatchList.ShowCharts = false;
                watchlist.ShowCharts = false;
                //UpdatePreferenceFile(PreferenceType.Arbitrage);
                //toolStripButton_charts.Text = "Show Charts";
                //toolStripButton_charts.Image = Properties.Resources.ConnectionStatus_ERROR;
                //controlSize = new Size(150, 150);
                toolStripMenuItem_chart.Text  = "Show Charts";
                toolStripMenuItem_chart.Image = Properties.Resources.ConnectionStatus_ERROR;
            }
            else
            {
                // Add Charts
                //WatchList.ShowCharts = true;
                watchlist.ShowCharts = true;

                //toolStripButton_charts.Text = "Hide Charts";
                //toolStripButton_charts.Image = Properties.Resources.ConnectionStatus_ACTIVE;
                //controlSize = new Size(150, 300);
                toolStripMenuItem_chart.Text  = "Hide Charts";
                toolStripMenuItem_chart.Image = Properties.Resources.ConnectionStatus_ACTIVE;
            }
            UpdatePreferenceFile(PreferenceType.Arbitrage);
            //UpdateUI();
            SetWatchlist(true);
        }
Ejemplo n.º 2
0
        private void ToggleLists()
        {
            //LogManager.AddLogMessage(Name, "ToggleCharts", PreferenceManager.ArbitragePreferences.ShowCharts.ToString(), LogManager.LogMessageType.DEBUG);
            ArbitrageWatchList watchlist = ArbitragePreferences.GetCurrentWatchList();

            if (watchlist.ShowLists)
            {
                // Remove Lists
                watchlist.ShowLists = false;
                //UpdatePreferenceFile(PreferenceType.Arbitrage);
                toolStripMenuItem_list.Text  = "Show Lists";
                toolStripMenuItem_list.Image = Properties.Resources.ConnectionStatus_ERROR;
            }
            else
            {
                // Add Lists
                WatchList.ShowLists          = true;
                toolStripMenuItem_list.Text  = "Hide Lists";
                toolStripMenuItem_list.Image = Properties.Resources.ConnectionStatus_ACTIVE;
            }
            UpdatePreferenceFile(PreferenceType.Arbitrage);
            //UpdateUI();
            SetWatchlist(true);
        }
Ejemplo n.º 3
0
        public void SetWatchlist(bool resize = false, bool clear = false)
        {
            if (flowLayoutPanel.InvokeRequired)
            {
                SetWatchlistCallback d = new SetWatchlistCallback(SetWatchlist);
                flowLayoutPanel.Invoke(d, new object[] { resize, clear });
            }
            else
            {
                if (clear)
                {
                    flowLayoutPanel.Controls.Clear();
                }

                /*
                 * if (ArbitragePreferences.CurrentWatchList.Contains('|'))
                 * {
                 *  string[] data = ArbitragePreferences.CurrentWatchList.Split('|');
                 *  string name = data[0];
                 *  string preset = data[1];
                 *  toolStripLabel_totals.Text = GetPresetWatchlistTotals(name, preset);
                 * }
                 * else
                 * {
                 *  toolStripLabel_totals.Text = "NO";
                 * }
                 */
                WatchList = ArbitragePreferences.GetCurrentWatchList();
                SetOptionsMenu();

                foreach (ExchangeTicker ticker in WatchList.Items.OrderByDescending(item => item.last))
                {
                    //LogManager.AddLogMessage(Name, "SetWatchlist", "ticker=" + ticker.symbol + " | " + ticker.market + " | " + ticker.last, LogManager.LogMessageType.DEBUG);
                    Control[] ctrls = flowLayoutPanel.Controls.Find(ticker.symbol, false);

                    if (ctrls.Length > 0)
                    {
                        // UPDATE
                        ArbitrageItemControl control = ctrls[0] as ArbitrageItemControl;
                        //control.UpdateUI();
                        //control.SetData(ticker.symbol, PreferenceManager.ArbitragePreferences.market);
                        if (ticker.symbol != "BTC")
                        {
                            control.SetData(ticker.symbol, ArbitragePreferences.market);
                        }
                        else
                        {
                            control.SetData(ticker.symbol, "USD");
                        }
                    }
                    else
                    {
                        // ADD
                        ArbitrageItemControl control = new ArbitrageItemControl()
                        {
                            Name = ticker.symbol, manager = this
                        };
                        if (ticker.symbol != "BTC")
                        {
                            control.SetData(ticker.symbol, ArbitragePreferences.market);
                        }
                        else
                        {
                            control.SetData(ticker.symbol, "USD");
                        }
                        //PreferenceManager.SetControlTheme(control, PreferenceManager.preferences.Theme, ParentForm);
                        flowLayoutPanel.Controls.Add(control);
                        //LogManager.AddLogMessage(Name, "SetWatchlist", "ticker=" + ticker.symbol + " | " + ticker.market + " | " + ticker.last, LogManager.LogMessageType.DEBUG);
                    }
                }
                UpdateUI(resize);
            }
        }