Ejemplo n.º 1
0
 private void TradeHistoryWindow_Closed(object sender, EventArgs e)
 {
     this.Dispatcher.Invoke(DispatcherPriority.Background, (ThreadStart) delegate
     {
         TradeHistoryWindow = null;
     });
 }
Ejemplo n.º 2
0
        private async Task OpenTradeHistory(int selectedIndex = 0)
        {
            await Task.Run(() =>
            {
                this.Dispatcher.Invoke(DispatcherPriority.Background, (ThreadStart) delegate
                {
                    if (TradeHistoryWindow == null)
                    {
                        TradeHistoryWindow = new TradeHistory(CurrencyPair.Parse(selectedCurrency), selectedIndex);

                        TradeHistoryWindow.Top    = MainWindow.Top;
                        TradeHistoryWindow.Left   = MainWindow.Left + MainWindow.Width;
                        TradeHistoryWindow.Height = MainWindow.Height;
                        TradeHistoryWindow.Width  = 430;

                        MainWindow.LocationChanged      += EventHandler;
                        MainWindow.SizeChanged          += EventHandler;
                        MainWindow.StateChanged         += MainWindow_StateChanged;
                        TradeHistoryWindow.StateChanged += MainWindow_StateChanged;

                        TradeHistoryWindow.Show();
                        TradeHistoryWindow.Closed += TradeHistoryWindow_Closed;

                        MainWindow.WindowState = WindowState.Maximized;
                    }
                });
            });
        }
Ejemplo n.º 3
0
        void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    try
                    {
                        CancelTimer();

                        if (currencyItems != null)
                        {
                            currencyItems.Clear();
                        }


                        if (TradeHistoryWindow != null)
                        {
                            TradeHistoryWindow.Close();
                        }

                        if (chartWindow != null)
                        {
                            chartWindow.Close();
                        }

                        if (MarketService.Instance().TradesHistoryList != null)
                        {
                            MarketService.Instance().TradesHistoryList.Clear();
                        }

                        if (semaphoreSlim != null)
                        {
                            semaphoreSlim.Dispose();
                        }
                    }
                    finally
                    {
                        updateTimer        = null;
                        semaphoreSlim      = null;
                        PoloniexClient     = null;
                        currencyItems      = null;
                        TradeHistoryWindow = null;
                        chartWindow        = null;

                        MarketService.Instance().TradesHistoryList = null;

                        disposedValue = true;
                    }
                }
            }
        }