private void btnCopySharesToClipboard_Click(object sender, RoutedEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            for (int i1 = 0; i1 < lstSplitShares.Items.Count; i1++)
            {
                ucShare share = (ucShare)lstSplitShares.Items[i1];
                sb.Append($"{i1+1}. {share.txtShare.Text}{Environment.NewLine}");
            }

            string sClip = sb.ToString();

            Clipboard.Clear();
            Clipboard.SetText(sClip);
        }
        private async void btnDoSplit_Click(object sender, RoutedEventArgs e)
        {
            btnDoSplit.Content  = "Calculating...";
            gridSplit.IsEnabled = false;
            lstSplitShares.Items.Clear();
            txtTestMerged.Text = "";

            clsSeed seed = new clsSeed(txtSeedToSplit.Text);

            byte[] baSeedHex = clsHelpers.StringToByteArray(seed.SeedBitsHex);

            List <string> liBestShares = new List <string>();
            int           iBestMaxLen  = int.MaxValue;
            Single        siBestAvg    = Single.MaxValue;
            string        sPassword    = txtPassword.Text;
            byte          bShareCount  = byte.Parse(txtShareCount.Text);
            byte          bThreshold   = byte.Parse(txtThreshold.Text);
            int           iTried       = 0;

            timerDoCounter          = new DispatcherTimer();
            timerDoCounter.Interval = new TimeSpan(0, 0, 1);
            timerDoCounter.Tick    += timerDoCounter_Tick;
            timerDoCounter.Start();

            dRunUntil = DateTime.Now.AddSeconds(Convert.ToInt32(txtSeconds.Text));
            await Task.Run(() =>
            {
                while (DateTime.Now < dRunUntil)
                {
                    iTried++;
                    clsBIP39Splitter splitter = new clsBIP39Splitter();
                    List <string> liShares    = splitter.SeedToSplitSecrets(seed.SeedBytes, bShareCount, bThreshold, sPassword);
                    int iCurrMax = 0, iCurrTotal = 0;

                    foreach (string s1 in liShares)
                    {
                        iCurrTotal += s1.Length;
                        if (iCurrMax < s1.Length)
                        {
                            iCurrMax = s1.Length;
                        }
                    }
                    Single siCurrAvg = iCurrTotal / liShares.Count;

                    if ((siCurrAvg < siBestAvg) && (iCurrMax <= iBestMaxLen))
                    {
                        siBestAvg    = siCurrAvg;
                        iBestMaxLen  = iCurrMax;
                        liBestShares = liShares;
                    }
                }
            });

            for (int i1 = 0; i1 < liBestShares.Count; i1++)
            {
                string  sShare = liBestShares[i1];
                ucShare uc1    = new ucShare(i1 + 1, sShare);
                lstSplitShares.Items.Add(uc1);
            }
            btnDoSplit.Content  = "Do Split";
            btnDoSplit.ToolTip  = $"Tried:{iTried} Avg:{siBestAvg} MaxLen={iBestMaxLen}";
            gridSplit.IsEnabled = true;
            btnCopySharesToClipboard.IsEnabled = true;
        }