예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            BuildTabs();

            txtTrollbox.Document.Background = Brushes.Black;
            txtTrollbox.BorderThickness     = new Thickness(0);
            txtTrollbox.Margin = new Thickness(2);

            // Set icon from the assembly
            this.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location).ToImageSource();

            if (!int.TryParse(ConfigurationManager.AppSettings.Get("headerUpdateTimeMiliseconds"), out updateTimeMiliseconds))
            {
                MessageBox.Show("O parametro do App.Config lendingUpdateTimeMiliseconds está setado com valor inválido, foi aplicado o valor padrão (" + updateTimeMiliseconds + ")!");
            }

            PoloniexClient = PoloniexClient.Instance(ApiKeys.PublicKey, ApiKeys.PrivateKey);
            PoloniexClient.Live.OnTrollboxMessage += Live_OnTrollboxMessage;

            FachadaWSSGS = Singleton <FachadaWSSGS.FachadaWSSGSClient> .Instance;

            LiveStart();

            semaphoreSlim = new SemaphoreSlim(1);

            updateTimer = new Timer(UpdateView, null, 0, updateTimeMiliseconds);

            disposedValue = false;

            myNotifyIcon.Icon            = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
            myNotifyIcon.ToolTipText     = this.Title;
            myNotifyIcon.MenuActivation  = Hardcodet.Wpf.TaskbarNotification.PopupActivationMode.LeftClick;
            myNotifyIcon.PopupActivation = Hardcodet.Wpf.TaskbarNotification.PopupActivationMode.DoubleClick;

            txtTitleNotify.Text = this.Title;

            var contextMenu = new ContextMenu();

            myNotifyIcon.ContextMenu = contextMenu;

            myNotifyIcon.ShowBalloonTip(this.Title, "DallEX is started!", BalloonIcon.Info);
        }
예제 #2
0
        void Dispose(bool disposing)
        {
            try
            {
                if (!disposedValue)
                {
                    if (disposing)
                    {
                        if (PoloniexClient != null)
                        {
                            if (PoloniexClient.Live != null)
                            {
                                PoloniexClient.Live.Stop();
                            }
                        }

                        if (updateTimer != null)
                        {
                            updateTimer.Dispose();
                        }

                        updateTimer = null;

                        if (semaphoreSlim != null)
                        {
                            semaphoreSlim.Dispose();
                        }
                        semaphoreSlim = null;


                        if (lendingPage != null)
                        {
                            lendingPage.Dispose();
                        }
                        lendingPage = null;

                        if (exchangeBTCPage != null)
                        {
                            exchangeBTCPage.Dispose();
                        }
                        exchangeBTCPage = null;


                        if (exchangeXMRPage != null)
                        {
                            exchangeXMRPage.Dispose();
                        }
                        exchangeXMRPage = null;


                        if (exchangeUSDTPage != null)
                        {
                            exchangeUSDTPage.Dispose();
                        }
                        exchangeUSDTPage = null;

                        if (accountPage != null)
                        {
                            accountPage.Dispose();
                        }
                        accountPage = null;

                        if (TabMain != null)
                        {
                            if (TabMain.Items != null)
                            {
                                TabMain.Items.Clear();
                            }
                        }

                        LoanContext.Instance().Dispose();


                        if (FachadaWSSGS != null)
                        {
                            FachadaWSSGS.Close();
                        }
                    }
                }
            }
            finally
            {
                MarketService.Instance().MarketList = null;
                WalletService.Instance().WalletList = null;
                TabMain = null;

                exchangeBTCTab  = null;
                exchangeXMRTab  = null;
                exchangeUSDTTab = null;
                accountTab      = null;
                lendingTab      = null;

                FachadaWSSGS = null;

                disposedValue = true;
            }
        }