Esempio n. 1
0
 private void ChartWindow_Closed(object sender, EventArgs e)
 {
     this.Dispatcher.Invoke(DispatcherPriority.Background, (ThreadStart) delegate
     {
         chartWindow = null;
     });
 }
Esempio n. 2
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;
                    }
                }
            }
        }
Esempio n. 3
0
        private async Task OpenChartHistory()
        {
            await Task.Run(() =>
            {
                this.Dispatcher.Invoke(DispatcherPriority.Background, (ThreadStart) delegate
                {
                    if (chartWindow == null)
                    {
                        chartWindow       = new ChartWindow(CurrencyPair.Parse(selectedCurrency));
                        chartWindow.Owner = MainWindow;

                        chartWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                        chartWindow.Width  = MainWindow.Width / 1.2;
                        chartWindow.Height = MainWindow.Height / 1.2;

                        chartWindow.Show();
                        chartWindow.Closed += ChartWindow_Closed;
                    }
                });
            });
        }