Example #1
0
        private void CaricaApi()
        {
            BinanceExchange binance = GestoreImpostazioni.LeggiDatiExchange <BinanceExchange>(valutaFactory);

            if (binance != null)
            {
                gestoreFondi.AggiungiExchange(binance);
            }
            BitfinexExchange bitfinex = GestoreImpostazioni.LeggiDatiExchange <BitfinexExchange>(valutaFactory);

            if (bitfinex != null)
            {
                gestoreFondi.AggiungiExchange(bitfinex);
            }
            BitcoinBlockexplorer bitcoin = GestoreImpostazioni.LeggiDatiBlockchain <BitcoinBlockexplorer>(valutaFactory);

            if (bitcoin != null)
            {
                gestoreFondi.AggiungiBlockchain(bitcoin);
            }
            EthereumEtherscan ethereum = GestoreImpostazioni.LeggiDatiBlockchain <EthereumEtherscan>(valutaFactory);

            if (ethereum != null)
            {
                gestoreFondi.AggiungiBlockchain(ethereum);
            }
        }
Example #2
0
 public Login()
 {
     InitializeComponent();
     if (GestoreImpostazioni.ControllaPassword(null))
     {
         ApriApplicazione(null);
     }
 }
Example #3
0
        private void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            string psw = PasswordBox.Password;

            if (GestoreImpostazioni.ControllaPassword(psw))
            {
                ApriApplicazione(psw);
            }
            else
            {
                MessageBox.Show("Password errata");
            }
        }
Example #4
0
        private void RimuoviEthereumBtn_Click(object sender, RoutedEventArgs e)
        {
            bool rimossoDaGestore        = gestoreFondi.RimuoviBlockchain(typeof(EthereumEtherscan));
            bool rimossoDaConfigurazione = GestoreImpostazioni.RimuoviDatiApi <EthereumEtherscan>();

            if (rimossoDaGestore || rimossoDaConfigurazione)
            {
                Dispatcher.BeginInvoke(new Action(async() => { await AggiornaFondi(); }));
                MessageBox.Show("Protafoglio rimosso correttamente.");
            }
            else
            {
                MessageBox.Show("Non ci sono attualmente indirizzi associati.");
            }
        }
Example #5
0
        private void RimuoviBitfinexBtn_Click(object sender, RoutedEventArgs e)
        {
            bool rimossoDaGestore        = gestoreFondi.RimuoviExchange(typeof(BitfinexExchange));
            bool rimossoDaConfigurazione = GestoreImpostazioni.RimuoviDatiApi <BitfinexExchange>();

            if (rimossoDaGestore || rimossoDaConfigurazione)
            {
                Dispatcher.BeginInvoke(new Action(async() => { await AggiornaFondi(); }));
                MessageBox.Show("Exchange rimosso correttamente.");
            }
            else
            {
                MessageBox.Show("Non ci sono attualmente chiavi associate per Bitfinex.");
            }
        }
Example #6
0
        private void SalvaPasswordBtn_Click(object sender, RoutedEventArgs e)
        {
            string password = PasswordTxt.Text;

            if (password == null || password == "")
            {
                MessageBox.Show("Inserire prima una password");
            }
            else if (password.Length < 8)
            {
                MessageBox.Show("Inserire una password di almeno 8 caratteri.");
            }
            else
            {
                GestoreImpostazioni.SalvaPassword(password);
                MessageBox.Show("Password Salvata");
            }
        }
Example #7
0
        private void SalvaEthereumBtn_Click(object sender, RoutedEventArgs e)
        {
            string indirizzo = EthereumTxt.Text;

            try
            {
                EthereumEtherscan ethereum = new EthereumEtherscan(indirizzo, valutaFactory);
                if (gestoreFondi.AggiungiBlockchain(ethereum))
                {
                    GestoreImpostazioni.SalvaDatiBlockchain(ethereum);
                    MessageBox.Show("Indirizzo salvato. Avviato aggiornamento fondi");
                    Dispatcher.BeginInvoke(new Action(async() => { await AggiornaFondi(); }));
                }
                else
                {
                    MessageBox.Show("Esiste già un indirizzo associato, rimuoverlo prima di aggiungerne un altro.");
                }
            }
            catch (ArgumentException eccezione)
            {
                MessageBox.Show(eccezione.Message);
            }
        }
Example #8
0
        private void SalvaBitfinexBtn_Click(object sender, RoutedEventArgs e)
        {
            string apiPub  = BitfinexPubblicaTxt.Text;
            string apiPriv = BitfinexPrivataTxt.Text;

            try
            {
                BitfinexExchange bitfinex = new BitfinexExchange(apiPub, apiPriv, valutaFactory);
                if (gestoreFondi.AggiungiExchange(bitfinex))
                {
                    GestoreImpostazioni.SalvaDatiExchange(bitfinex);
                    Dispatcher.BeginInvoke(new Action(async() => { await AggiornaFondi(); }));
                    MessageBox.Show("Chiavi api salvate. Avviato aggiornamento fondi");
                }
                else
                {
                    MessageBox.Show("Ci sono già delle chiavi API associate per bitfinex, rimuoverle prima di aggiungerne delle altre.");
                }
            }
            catch (ArgumentException eccezione)
            {
                MessageBox.Show(eccezione.Message);
            }
        }