private void SetFullView()
        {
            tabPage_full.Controls.Clear();
            TradingViewWidgetControl widget = new TradingViewWidgetControl()
            {
                Dock = DockStyle.Fill
            };

            toolStripRadioButton_full.Image = ContentManager.GetSymbolIcon(PreferenceManager.TradingViewPreferences.AdvancedChartParameters.symbol);
            toolStripRadioButton_full.Text  = PreferenceManager.TradingViewPreferences.AdvancedChartParameters.symbol.ToUpper();
            PreferenceManager.TradingViewPreferences.AdvancedChartParameters.WatchList = GetWatchListBySymbol(PreferenceManager.TradingViewPreferences.AdvancedChartParameters.symbol);
            PreferenceManager.UpdatePreferenceFile(PreferenceManager.PreferenceType.TradingView);
            widget.setAdvancedChart(PreferenceManager.TradingViewPreferences.AdvancedChartParameters);
            tabPage_full.Controls.Add(widget);
            //LogManager.AddLogMessage(Name, "SetFullView", Size.Width + " | " + Size.Height + " || " + tabControl.Width + " | " + tabControl.Height + " || " + widget.Width + " | " + widget.Height + " || " + ParentForm.Width + " | " + ParentForm.Height + " || " + ParentForm.ClientSize.Width + " | " + ParentForm.ClientSize.Height, LogManager.LogMessageType.DEBUG);
            SetBTCView();
            SetUSDView();
        }
Example #2
0
        private void toolStripDropDownButton_options_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            LogManager.AddLogMessage(Name, "toolStripDropDownButton_options_DropDownItemClicked", e.ClickedItem.Text + " | " + e.ClickedItem.Tag, LogManager.LogMessageType.OTHER);
            string propertyName = e.ClickedItem.Tag.ToString();

            switch (propertyName)
            {
            case "hide_top_toolbar":
            case "withdateranges":
            case "allow_symbol_change":
            case "save_image":
            case "hide_side_toolbar":
            case "hideideas":
            case "hideideasbutton":
            case "enable_publishing":
            case "ShowWatchlist":
            case "ShowIndicators":
            case "details":
            case "stocktwits":
            case "headlines":
            case "hotlist":
            case "calendar":
            {
                //Type type = PreferenceManager.TradingViewPreferences.AdvancedChartParameters.GetType();
                Type         type  = Exchange.AdvancedChartParameters.GetType();
                PropertyInfo prop  = type.GetProperty(propertyName);
                bool         value = (bool)(prop.GetValue(Exchange.AdvancedChartParameters, null));
                prop.SetValue(Exchange.AdvancedChartParameters, !value, null);
                //LogManager.AddLogMessage(Name, "toolStripDropDownButton_options_DropDownItemClicked", "SWITCH : " + propertyName + " : " + value, LogManager.LogMessageType.OTHER);
                UpdateOptionsMenu();
                //PreferenceManager.UpdatePreferenceFile(PreferenceManager.PreferenceType.Exchange);
                break;
            }

            case "light":
            case "dark":
            {
                //LogManager.AddLogMessage(Name, "toolStripDropDownButton_options_DropDownItemClicked", "LIGHT OR DARK : " + propertyName, LogManager.LogMessageType.OTHER);
                if (propertyName == "light")
                {
                    //PreferenceManager.TradingViewPreferences.AdvancedChartParameters.theme = TradingViewColorTheme.Light;
                    Exchange.AdvancedChartParameters.theme = TradingViewColorTheme.Light;
                }
                else
                {
                    Exchange.AdvancedChartParameters.theme = TradingViewColorTheme.Dark;
                }
                UpdateOptionsMenu();
                //PreferenceManager.UpdatePreferenceFile(PreferenceManager.PreferenceType.Exchange);
                //UpdateUI(true);
                break;
            }

            default:
            {
                LogManager.AddLogMessage(Name, "toolStripDropDownButton_options_DropDownItemClicked", "NOTDEFINED : " + propertyName, LogManager.LogMessageType.OTHER);
                break;
            }
            }
            PreferenceManager.UpdatePreferenceFile(PreferenceManager.PreferenceType.Exchange);
            tradingView.setAdvancedChart(Exchange.AdvancedChartParameters);
            UpdateUI(true);
        }
        private void SetUSDView()
        {
            // USD
            tabPage_usd.Controls.Clear();

            TableLayoutPanel table = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill
            };

            int columnCount = GetTableCount("column", exchanges.Count);
            int rowCount    = GetTableCount("row", exchanges.Count);

            table.ColumnCount = columnCount;
            table.RowCount    = rowCount;

            for (int i = 0; i < columnCount + 1; i++)
            {
                table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            }

            for (int i = 0; i < rowCount + 1; i++)
            {
                table.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            }

            int currentColumn = 0;
            int currentRow    = 0;

            foreach (ExchangeManager.Exchange exchange in exchanges)
            {
                // make a widget
                TradingViewWidgetControl chartWidget = new TradingViewWidgetControl()
                {
                    Dock = DockStyle.Fill
                };

                TradingViewAdvancedChartParameters parameters = new TradingViewAdvancedChartParameters()
                {
                    symbol           = PreferenceManager.TradingViewPreferences.AdvancedChartParameters.symbol,
                    market           = exchange.USDSymbol,
                    exchange         = (TradingViewCryptoExchange)Enum.Parse(typeof(TradingViewCryptoExchange), exchange.TradingView, true),
                    hide_top_toolbar = true,
                    withdateranges   = true,
                    theme            = PreferenceManager.TradingViewPreferences.AdvancedChartParameters.theme
                };
                chartWidget.setAdvancedChart(parameters);
                //chartWidget.SetPair(exchange.Symbol, symbol, exchange.USDSymbol);

                table.Controls.Add(chartWidget, currentColumn, currentRow);

                if (currentColumn < columnCount)
                {
                    // increment column
                    currentColumn++;
                }
                else
                {
                    // reset column increment row
                    currentColumn = 0;
                    currentRow++;
                }
            }
            tabPage_usd.Controls.Add(table);
        }
        private void SetCustomView()
        {
            tabPage_custom.Controls.Clear();

            TableLayoutPanel table = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill
            };

            //int columnCount = GetTableCount("column", PreferenceManager.TradingViewPreferences.WatchList.Count);
            //int rowCount = GetTableCount("row", PreferenceManager.TradingViewPreferences.WatchList.Count);

            //int columnCount = GetTableCount("column", PreferenceManager.TradingViewPreferences.SymbolOverviewParameters.symbols.Count);
            //int rowCount = GetTableCount("row", PreferenceManager.TradingViewPreferences.SymbolOverviewParameters.symbols.Count);
            List <TradingViewSymbolOverview> list = PreferenceManager.TradingViewPreferences.GetCurrentWatchList();

            int columnCount = GetTableCount("column", list.Count);
            int rowCount    = GetTableCount("row", list.Count);

            table.ColumnCount = columnCount;
            table.RowCount    = rowCount;

            for (int i = 0; i < columnCount + 1; i++)
            {
                table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            }

            for (int i = 0; i < rowCount + 1; i++)
            {
                table.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            }

            int currentColumn = 0;
            int currentRow    = 0;

            foreach (TradingViewSymbolOverview item in list)
            {
                TradingViewWidgetControl chartWidget = new TradingViewWidgetControl()
                {
                    Dock = DockStyle.Fill
                };
                TradingViewAdvancedChartParameters parameters = new TradingViewAdvancedChartParameters()
                {
                    symbol = item.symbol,
                    market = item.market,
                    //exchange = (TradingViewCryptoExchange)Enum.Parse(typeof(TradingViewCryptoExchange), item.exchange.ToString(), true),
                    exchange       = item.exchange,
                    withdateranges = true
                                     //hide_top_toolbar = true
                };
                chartWidget.setAdvancedChart(parameters);
                table.Controls.Add(chartWidget, currentColumn, currentRow);

                if (currentColumn < columnCount)
                {
                    currentColumn++;
                }
                else
                {
                    currentColumn = 0;
                    currentRow++;
                }
            }
            tabPage_custom.Controls.Add(table);
        }