Ejemplo n.º 1
0
        private void SetView(bool resize = false)
        {
            //tabControl.SelectedIndex = PreferenceManager.preferences.BalanceView.GetHashCode();
            try
            {
                //LogManager.AddLogMessage(Name, "SetView", "index:" + tabControl.SelectedIndex, LogMessageType.DEBUG);
                switch (PreferenceManager.preferences.BalanceView)
                {
                case BalanceViewType.balance:
                    //tabControl.SelectedIndex = 0;
                    SetSymbolsChart();
                    BalanceViewControl balancecontrol = tabControl.SelectedTab.Controls[0] as BalanceViewControl;
                    balancecontrol.UpdateUI(resize);
                    break;

                case BalanceViewType.exchange:
                    //tabControl.SelectedIndex = 1;
                    SetExchangesChart();
                    BalanceViewControl exchangecontrol = tabControl.SelectedTab.Controls[0] as BalanceViewControl;
                    exchangecontrol.UpdateUI(resize);
                    break;

                case BalanceViewType.symbol:
                    //tabControl.SelectedIndex = 2;
                    SetSymbolsChart();
                    BalanceViewControl symbolcontrol = tabControl.SelectedTab.Controls[0] as BalanceViewControl;
                    symbolcontrol.UpdateUI(resize);
                    break;

                case BalanceViewType.orders:
                    //tabControl.SelectedIndex = 3;
                    //SetOrdersChart();
                    OrderViewControl orderscontrol = tabControl.SelectedTab.Controls[0] as OrderViewControl;
                    orderscontrol.UpdateUI(resize);
                    break;

                case BalanceViewType.forks:
                    //tabControl.SelectedIndex = 4;
                    SetForksChart();
                    ForkListControl forkcontrol = tabControl.SelectedTab.Controls[0] as ForkListControl;
                    forkcontrol.UpdateUI(resize);
                    break;

                default:
                    AddLogMessage(Name, "SetView", "VIEW NOT DEFINED!!! : " + PreferenceManager.preferences.BalanceView, LogMessageType.DEBUG);
                    break;
                }
            }
            catch (Exception ex)
            {
                AddLogMessage(Name, "SetView", ex.Message, LogMessageType.EXCEPTION);
            }
        }
Ejemplo n.º 2
0
        private void InitializeViews()
        {
            var values = EnumUtils.GetValues <BalanceViewType>();

            // BALANCES
            foreach (var item in values)
            {
                //LogManager.AddLogMessage(Name, "InitializeViews", item.ToString() + " | " + item.GetHashCode(), LogManager.LogMessageType.DEBUG);
                switch (item)
                {
                case BalanceViewType.balance:
                case BalanceViewType.exchange:
                case BalanceViewType.symbol:
                    TabPage tabPage = new TabPage()
                    {
                        Name    = item.ToString(),
                        Text    = item.ToString(),
                        Margin  = new Padding(0, 0, 0, 0),
                        Padding = new Padding(0, 0, 0, 0)
                    };

                    BalanceViewControl view = new BalanceViewControl()
                                              //BalanceDataViewControl view = new BalanceDataViewControl()
                    {
                        Dock    = DockStyle.Fill,
                        view    = item,
                        Margin  = new Padding(0, 0, 0, 0),
                        Padding = new Padding(0, 0, 0, 0),
                        manager = this
                    };
                    view.SetView();
                    tabPage.Controls.Add(view);
                    tabControl.TabPages.Add(tabPage);
                    break;

                case BalanceViewType.orders:
                    TabPage orderTabPage = new TabPage()
                    {
                        Name    = item.ToString(),
                        Text    = item.ToString(),
                        Margin  = new Padding(0, 0, 0, 0),
                        Padding = new Padding(0, 0, 0, 0)
                    };

                    OrderViewControl orderview = new OrderViewControl()
                    {
                        Dock = DockStyle.Fill,
                        //view = item,
                        Margin  = new Padding(0, 0, 0, 0),
                        Padding = new Padding(0, 0, 0, 0),
                        //manager = this
                    };
                    //view.SetView();
                    orderview.UpdateUI(true);
                    orderTabPage.Controls.Add(orderview);
                    tabControl.TabPages.Add(orderTabPage);
                    break;

                case BalanceViewType.forks:
                    TabPage forkTabPage = new TabPage()
                    {
                        Name    = item.ToString(),
                        Text    = item.ToString(),
                        Margin  = new Padding(0, 0, 0, 0),
                        Padding = new Padding(0, 0, 0, 0)
                    };

                    ForkListControl forkview = new ForkListControl()
                    {
                        Dock = DockStyle.Fill,
                        //view = item,
                        Margin  = new Padding(0, 0, 0, 0),
                        Padding = new Padding(0, 0, 0, 0),
                        //manager = this
                    };
                    //view.SetView();
                    forkview.UpdateUI(true);
                    forkTabPage.Controls.Add(forkview);
                    tabControl.TabPages.Add(forkTabPage);
                    break;

                default:
                    //AddLogMessage(Name, "SetView", "VIEW NOT DEFINED!!! : " + PreferenceManager.preferences.BalanceView, LogMessageType.DEBUG);
                    break;
                }
            }
            //SetView(true);
        }