private void InitializeMethods()
        {
            btnImport.TouchUpInside += async(sender, e) =>
            {
                coinFile = ScanSelected(urlList);
                if (coinFile != null && coinFile.IsValidFile)
                {
                    isPasswordForSafe = await ShowAlert("Confirmation", confirmMsg, new string[] { "Yes", "No" });

                    btnCancel.Hidden = true;
                    btnImport.Hidden = true;

                    if (isPasswordForSafe == 0)
                    {
                        RAIDA.Instance.Detect(coinFile.Coins, true);

                        DetectHandler.Invoke(this, true);
                        //will implement the Safe source.
                    }
                    else
                    {
                        RAIDA.Instance.Detect(coinFile.Coins, false);

                        DetectHandler.Invoke(this, false);
                    }

                    //var raida = RAIDA.Instance;
                    //var tasks = raida.GetMultiDetectTasks(coinFile.Coins, 1000);

                    //await Task.WhenAll(tasks.AsParallel().Select(async task => await task()));
                    //raida.onStackScanCompleted(new StackScanCompletedEventArgs(coinFile.Coins, null, raida));

                    ImportFilesHandler.Invoke(this, coinFile);
                    RemoveAnimate();
                }
                else
                {
                    await ShowAlert("Message", "There are no coins to import. " +
                                    "You have to get coins in form of .stack or " +
                                    ".jpg/.jpeg files from email or AirDrop. Choose" +
                                    " CloudCoin Scan&Safe icon to get files.", new string[] { "Ok" });

                    RemoveAnimate();
                }
            };

            btnCancel.TouchUpInside += (sender, e) =>
            {
                RemoveAnimate();
            };

            btnFinished.TouchUpInside += (sender, e) =>
            {
                //RemoveAnimate();
                //if (isPasswordForSafe == 0)
                //CompletedWithPassword(coinFile);
            };
        }
        public static CloudCoinFile ScanSelected(List <string> urlList)
        {
            CloudCoinFile coinFile = null;

            if (urlList != null && urlList.Count != 0)
            {
                coinFile = new CloudCoinFile(urlList);
            }
            return(coinFile);
        }
Ejemplo n.º 3
0
 private void FinishImporting(object sender, CloudCoinFile ccFile)
 {
     this.coinFile = ccFile;
     Logger.Write(string.Format("Finish Importing (coins count = {0})", ccFile.Coins.cloudcoin.Count), Logger.Level.Normal);
 }