Exemplo n.º 1
0
 public void UpdateText()
 {
     TextSettings    = TextTools.RetrieveStringFromResource("Main_Menu_Settings");
     TextLanguage    = TextTools.RetrieveStringFromResource("Main_Menu_Language");
     TextCurrency    = TextTools.RetrieveStringFromResource("Main_Menu_Currency");
     TextColorScheme = TextTools.RetrieveStringFromResource("Main_Menu_ColorScheme");
     // COLORS
     TextRed        = TextTools.RetrieveStringFromResource("Main_Menu_Red");
     TextPink       = TextTools.RetrieveStringFromResource("Main_Menu_Pink");
     TextPurple     = TextTools.RetrieveStringFromResource("Main_Menu_Purple");
     TextDeepPurple = TextTools.RetrieveStringFromResource("Main_Menu_DeepPurple");
     TextIndigo     = TextTools.RetrieveStringFromResource("Main_Menu_Indigo");
     TextBlue       = TextTools.RetrieveStringFromResource("Main_Menu_Blue");
     TextLightBlue  = TextTools.RetrieveStringFromResource("Main_Menu_LightBlue");
     TextCyan       = TextTools.RetrieveStringFromResource("Main_Menu_Cyan");
     TextTeal       = TextTools.RetrieveStringFromResource("Main_Menu_Teal");
     TextGreen      = TextTools.RetrieveStringFromResource("Main_Menu_Green");
     TextLightGreen = TextTools.RetrieveStringFromResource("Main_Menu_LightGreen");
     TextLimeGreen  = TextTools.RetrieveStringFromResource("Main_Menu_LimeGreen");
     TextYellow     = TextTools.RetrieveStringFromResource("Main_Menu_Yellow");
     TextAmber      = TextTools.RetrieveStringFromResource("Main_Menu_Amber");
     TextOrange     = TextTools.RetrieveStringFromResource("Main_Menu_Orange");
     TextDeepOrange = TextTools.RetrieveStringFromResource("Main_Menu_DeepOrange");
     TextBrown      = TextTools.RetrieveStringFromResource("Main_Menu_Brown");
     TextBlueGrey   = TextTools.RetrieveStringFromResource("Main_Menu_BlueGrey");
 }
Exemplo n.º 2
0
 public static List <SearchListItem> ParseAlbums(string json)
 {
     try
     {
         List <SearchListItem> results = new List <SearchListItem>();
         JObject obj   = JObject.Parse(json);
         JArray  array = obj["results"] as JArray;
         for (int i = 0; i < array.Count; i++)
         {
             JObject        itemObject = array[i] as JObject;
             SearchListItem item       = new SearchListItem();
             item.Name        = TextTools.GetTidyText(itemObject["collectionName"].ToString());
             item.Info        = TextTools.GetTidyText(itemObject["artistName"].ToString());
             item.ImageSource = new ImageSource()
             {
                 Sizex30  = itemObject["artworkUrl30"].ToString(),
                 Sizex60  = itemObject["artworkUrl60"].ToString(),
                 Sizex100 = itemObject["artworkUrl100"].ToString()
             };
             item.Type = "Album";
         }
         return(results);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 3
0
            private void ExecuteRecoverWallet()
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.InitialDirectory = App.WalletsDir;
                ofd.Filter           = "Wallet files (*.jet)|*.jet|All files (*.*)|*.*";
                Nullable <bool> result = ofd.ShowDialog();

                if (result.Value)
                {
                    if (ofd.FileName.EndsWith(".recover.jet"))
                    {
                        Messenger.Default.Send <string>(ofd.FileName, "OpenRecoverWalletView");
                    }
                    else if (ofd.FileName.EndsWith(".jet"))
                    {
                        //User attempted to recover a regular .jet file
                        string message = TextTools.RetrieveStringFromResource("Error_A502");
                        Messenger.Default.Send <string>(message, "OpenSimpleDialogView");
                    }
                    else
                    {
                        string message = TextTools.RetrieveStringFromResource("Error_A503");
                        Messenger.Default.Send <string>(message, "OpenSimpleDialogView");
                    }
                }
            }
Exemplo n.º 4
0
    private IEnumerator ResetCardVisualData()
    {
        yield return(new WaitForSeconds(2.5f));


        int tempAtk = _creatureData.attack;

        attack = tempAtk;

        int tempSize = _creatureData.size;

        size = tempSize;

        int tempHealth = _creatureData.health;

        health = tempHealth;

        maxHealth = health;

        //Debug.Log("Reseting card data visual");

        cardAttackText.text = _creatureData.attack.ToString();
        cardSizeText.text   = _creatureData.size.ToString();
        cardHealthText.text = _creatureData.health.ToString();

        TextTools.SetTextColor(cardAttackText, Color.white);
        TextTools.SetTextColor(cardSizeText, Color.white);
        TextTools.SetTextColor(cardHealthText, Color.white);

        battleToken.UpdateBattleTokenTokenText(Constants.CardStats.Attack, attack);
        battleToken.UpdateBattleTokenTokenText(Constants.CardStats.Size, size);
        battleToken.UpdateBattleTokenTokenText(Constants.CardStats.Health, health);
    }
Exemplo n.º 5
0
        public IActionResult Index([Bind("UserEmail,UserPassworld,roleId,PageNumber")] UserAdminPanelViewModel userAdminPanelViewModel)
        {
            string error = CheckUserInfo(userAdminPanelViewModel);

            if (!string.IsNullOrEmpty(error))
            {
                ModelState.AddModelError("UserEmail", error);
                return(View(GetUserInfo(userAdminPanelViewModel.PageNumber)));
            }
            var user = new DataLayer.Entities.User.User()
            {
                UserImage    = "Defult.jpg",
                UserIsActive = true,
                UserEmailConfigurationCode     = TextTools.GenerateUniqCode(),
                UserEmailConfigurationDateTime = DateTime.Now,
                UserDateTime           = DateTime.Now,
                UserPassword           = userAdminPanelViewModel.UserPassworld.ToEncodePasswordMd5(),
                UserEmail              = userAdminPanelViewModel.UserEmail.TextFix(),
                UserLastUpdateDateTime = DateTime.Now,
                UserDescription        = "ثبت نام توسط مدیر",
            };
            int userId = _userRepository.InsertUser(user);

            if (userId <= 0)
            {
                ModelState.AddModelError("UserEmail", "خطا در ثبت اطلاعات");
                return(View(GetUserInfo(userAdminPanelViewModel.PageNumber)));
            }
            _userRepository.InsertRolesToUser(userId, userAdminPanelViewModel.roleId);
            _userRepository.SaveUser();
            return(View(GetUserInfo(userAdminPanelViewModel.PageNumber)));
        }
Exemplo n.º 6
0
        private void UpdateLanguage(string s)
        {
            Lang      = s;
            TextTitle = "JetWallet - " + Lang;

            this.TextNoWallet = TextTools.RetrieveStringFromResource("Main_NoWallet");
            this.TextSend     = TextTools.RetrieveStringFromResource("Main_Send");
            this.TextReceive  = TextTools.RetrieveStringFromResource("Main_Receive");

            if (WalletNotNull)
            {
                MainWallet.UpdateTxListLanguage();
                InfoTag = TextTools.RetrieveStringFromResource("Main_Info_Active");
            }
            else
            {
                InfoTag = TextTools.RetrieveStringFromResource("Main_Info_Inactive");
            }

            this.FileTab.UpdateText();
            this.SettingsTab.UpdateText();
            this.ResourceTab.UpdateText();

            this.StatusBarComp.UpdateText();
        }
Exemplo n.º 7
0
        private async void ExecuteRecoverWallet()
        {
            try
            {
                string      recoverPhraseHash = Generators.GenerateRecPhraseHash(RecoverPhrase);
                WalletModel recoveredWallet   = FileTools.DecryptWallet(_path, recoverPhraseHash);

                // Decrypting the File was a success
                // We set the recovered wallet as the active wallet and then
                // prompt the user to set a new password for the recovered wallet
                string title   = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Success_Title");
                string message = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Success_Message").Replace("*name*", _walletname);
                await _rwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                Messenger.Default.Send <WalletModel>(recoveredWallet, "OpenSetPasswordView");
                this.ExecuteCloseView();
                Messenger.Default.Send <WalletModel>(recoveredWallet, "ChangeActiveWallet");
            }
            catch
            {
                string title   = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Incorrect_Title");
                string message = TextTools.RetrieveStringFromResource("RecoverWallet_Dialog_Incorrect_Message");
                await _rwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);
            }
        }
Exemplo n.º 8
0
    public void UpdateBattleTokenTokenText(Constants.CardStats statToUpdate, int value)
    {
        //Debug.Log(_parentCard.gameObject.name + " :: " + _parentCard.cardData.cardName + " is updating its battle token");

        switch (statToUpdate)
        {
        case Constants.CardStats.Attack:
            TextTools.AlterTextColor(value, _creatureData.attack, attack);
            if (value < 0)
            {
                attack.text = 0.ToString();
            }
            else
            {
                attack.text = value.ToString();
            }
            break;

        case Constants.CardStats.Size:
            TextTools.AlterTextColor(value, _creatureData.size, size);
            size.text = value.ToString();
            break;

        case Constants.CardStats.Health:
            TextTools.AlterTextColor(value, _parentCard.maxHealth, health);
            health.text = value.ToString();
            break;

        case Constants.CardStats.MaxHealth:
            TextTools.AlterTextColor(value, _creatureData.health, health);
            health.text = value.ToString();
            break;
        }
    }
Exemplo n.º 9
0
        private bool PasswordCorrect()
        {
            if (PassAttempt.Length == 0)
            {
                string title = TextTools.RetrieveStringFromResource("Send_Dialog_EmptyPass_Title");
                string message = TextTools.RetrieveStringFromResource("Send_Dialog_EmptyPass_Message");
                _sview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);
                return false;
            }
            
                string _walletfile = Global.ActiveWallet.FileLocation;

                string passHash = Generators.GenerateHash(PassAttempt);

                var correct = FileTools.CheckPasswordAttempt(_walletfile, passHash); 
                if (correct)
                {
                    return true;
                }
                else
                {
                    string title = TextTools.RetrieveStringFromResource("Send_Dialog_IncorrectPass_Title");
                    string message = TextTools.RetrieveStringFromResource("Send_Dialog_IncorrectPass_Message");
                    _sview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);
                    return false;
                }                
           
            
        }
Exemplo n.º 10
0
        public static List <NamedColor> SearchByName(string search, bool anywhere = false)
        {
            List <NamedColor> output = new List <NamedColor>();

            search = TextTools.NoSpace(search.ToLower());

            foreach (var nc in catalog)
            {
                if (anywhere)
                {
                    if (nc.nidxstr.Contains(search))
                    {
                        if (!output.Contains(nc))
                        {
                            output.Add(nc);
                        }
                    }
                }
                else
                {
                    if (nc.nidxstr.StartsWith(search))
                    {
                        if (!output.Contains(nc))
                        {
                            output.Add(nc);
                        }
                    }
                }
            }

            return(output);
        }
 private void TextBlock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (RecordTextBlock.IsVisible)
     {
         RecordTextBlock.Text = TextTools.GetRecordsText();
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Strips the units from a number, returns both, cleaned.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="unit"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static string StripUnit(string text, ref string unit)
        {
            var ch = text.ToCharArray();
            int i;
            int c = ch.Count() - 1;

            unit = null;

            for (i = c; i >= 0; i -= 1)
            {
                if (TextTools.IsNumber(ch[i]))
                {
                    if (i == c)
                    {
                        return(text.Trim());
                    }

                    unit = text.Substring(i + 1).Trim();
                    text = text.Substring(0, i + 1).Trim();

                    break;
                }
            }

            return(text);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Print friendly device information, including friendly name, mount points and the device's friendly size.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public override string ToString()
        {
            string str = "";

            if (IsVolume)
            {
                if (VolumePaths is object && VolumePaths.Count() > 0)
                {
                    string slist = string.Join(", ", VolumePaths);
                    str = "[" + slist + "] ";
                }
                else
                {
                    str = "";
                }

                str += FriendlyName + " (" + TextTools.PrintFriendlySize(Size) + ")";
            }
            else
            {
                str = "[" + Type.ToString() + "] " + FriendlyName + " (" + TextTools.PrintFriendlySize(Size) + ")";
            }

            return(str);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Displays drive information.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public override string ToString()
        {
            string ToStringRet = default;

            ToStringRet = TextTools.PrintFriendlySize(Size) + " Virtual Drive [" + (Attached ? "Attached" : "Not Attached") + "]";
            return(ToStringRet);
        }
Exemplo n.º 15
0
    protected override void OnVFXLanded(EventData data)
    {
        base.OnVFXLanded(data);

        CardVisual card = data.GetMonoBehaviour("Card") as CardVisual;
        CardVFX    vfx  = data.GetMonoBehaviour("VFX") as CardVFX;


        if (card != this)
        {
            return;
        }



        switch (lastStatAdjustment.stat)
        {
        case Constants.CardStats.SupportValue:

            cardSupportValueText.text = supportValue.ToString();
            supportToken.UpdateSupportText(lastStatAdjustment.stat, supportValue);
            TextTools.AlterTextColor(supportValue, _supportData.supportValue, cardSupportValueText);

            break;
        }

        Debug.Log(card.gameObject.name + " has been hit with a VFX: " + vfx.gameObject.name);



        Grid.EventManager.RemoveListener(Constants.GameEvent.VFXLanded, OnVFXLanded);
    }
Exemplo n.º 16
0
        static void Test2()
        {
            // From http://www.dotnetperls.com/regex-replace

            Console.WriteLine("\n== Program that uses Regex.Replace method");

            // This is the input string we are replacing parts from.
            string input = "Dot Net Not Perls";

            // Use Regex.Replace to replace the pattern in the input.
            // ... The pattern N.t indicates three letters, N, any character, and t.
            string output = Regex.Replace(input, "N.t", "NET");

            // Write the output.
            Console.WriteLine(input);
            Console.WriteLine(output);

            Console.WriteLine("\n== Program that capitalizes strings");
            // Input strings.
            const string s1 = "samuel allen";
            const string s2 = "dot net perls";
            const string s3 = "Mother teresa";

            // Write output strings.
            Console.WriteLine(TextTools.UpperFirst(s1));
            Console.WriteLine(TextTools.UpperFirst(s2));
            Console.WriteLine(TextTools.UpperFirst(s3));
        }
Exemplo n.º 17
0
            private void ImportWallet()
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.InitialDirectory = App.WalletsDir;
                ofd.Filter           = "Wallet files (*.jet)|*.jet|All files (*.*)|*.*";
                Nullable <bool> result = ofd.ShowDialog();

                if (result.Value)
                {
                    if (ofd.FileName.EndsWith(".recover.jet"))
                    {
                        // User attempting to import a .recover file
                        string message = TextTools.RetrieveStringFromResource("Error_A500");
                        Messenger.Default.Send <string>(message, "OpenSimpleDialogView");
                    }
                    else if (ofd.FileName.EndsWith(".jet"))
                    {
                        CheckPassword.InvokePasswordPrompt(ofd.FileName);
                    }
                    else
                    {
                        string message = TextTools.RetrieveStringFromResource("Error_A501");
                        Messenger.Default.Send <string>(message, "OpenSimpleDialogView");
                    }
                }
            }
Exemplo n.º 18
0
        public void AddStackText()
        {
            Database db = HostApplicationServices.WorkingDatabase;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                MText mtext = new MText
                {
                    Location = new Point3d(100, 40, 0) //位置
                };                                     //创建多行文本对象
                //创建水平分数形式的堆叠文字
                string firstLine = TextTools.StackText(TextSpecialSymbol.Diameter + "20", "H7", "P7", StackType.HorizontalFraction, 0.5);
                //创建斜分数形式的堆叠文字
                string secondLine = TextTools.StackText(TextSpecialSymbol.Diameter + "20", "H7", "P7", StackType.ItalicFraction, 0.5);
                //创建公差形式的堆叠文字
                string lastLine = TextTools.StackText(TextSpecialSymbol.Diameter + "20", "+0.020", "-0.010", StackType.Tolerance, 0.5);
                //将前面定义的堆叠文字合并,作为多行文本的内容
                mtext.Contents   = firstLine + MText.ParagraphBreak + secondLine + "\n" + lastLine;
                mtext.TextHeight = 5; //文本高度
                mtext.Width      = 0; //文本宽度,设为0表示不会自动换行
                //设置多行文字的对齐方式正中
                mtext.Attachment = AttachmentPoint.MiddleCenter;
                db.AddToModelSpace(mtext); //添加文本到模型空间中
                trans.Commit();            //提交事务处理
            }
        }
Exemplo n.º 19
0
        private async void ChangeActiveWallet(WalletModel wallet)
        {
            if (MainWallet == null)
            {
                this.SetupWallet(wallet);
                return;
            }
            else if (MainWallet.Equals(wallet))
            {
                string             titleSame   = TextTools.RetrieveStringFromResource("Main_Dialog_SameWallet_Title");
                string             messageSame = TextTools.RetrieveStringFromResource("Main_Dialog_SameWallet_Message");
                MessageDialogStyle styleSame   = MessageDialogStyle.Affirmative;
                await _mview.ShowMessageAsync(titleSame, messageSame, styleSame);

                return;
            }

            string             title   = TextTools.RetrieveStringFromResource("Main_Dialog_ActiveWallet_Title");
            string             message = TextTools.RetrieveStringFromResource("Main_Dialog_ActiveWallet_Message");
            MessageDialogStyle style   = MessageDialogStyle.AffirmativeAndNegative;

            var result = await _mview.ShowMessageAsync(title, message, style);

            if (result == MessageDialogResult.Affirmative)
            {
                this.CloseWallet();
                this.SetupWallet(wallet);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// This method shows the final score to the user, and store it in a file if it's a nre record.
        /// </summary>
        private void CheckScoreAndFinish()
        {
            string     newRecord  = "";
            List <int> recordList = TextTools.GetRecords();

            int[] records = recordList.ToArray();
            if (records != null && records.Count() > 0) // modify the array to include the new value if it's a record.
            {
                if (records.All(x => x < Score))
                {
                    recordList.Insert(0, Score);
                    TextTools.SaveRecords(recordList.ToArray());
                    newRecord = " You got a new record!";
                }
            }
            else
            {
                TextTools.SaveRecords(new int[] { Score });
                newRecord = " You got a new record!";
            }
            MessageBox.Show($"You finished the game with a score of: {Score}." + newRecord, "Congratulations!");
            Threading.Invoke(() =>
            {
                NavigationWindow mainWindow = Application.Current.MainWindow as NavigationWindow;
                mainWindow.NavigationService.Navigate(new StartView());
            });
        }
Exemplo n.º 21
0
        private async void ExecuteCreateWallet()
        {
            if (string.IsNullOrWhiteSpace(NewName) && Pass.Length < MIN_PASS_LENGTH)
            {
                string title   = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Invalid_Title");
                string message = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Invalid_Message")
                                 .Replace("*NUM*", MIN_PASS_LENGTH.ToString());
                await _cwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                return;
            }
            else if (string.IsNullOrWhiteSpace(NewName))
            {
                string title   = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_NameEmpty_Title");
                string message = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_NameEmpty_Message");
                await _cwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                return;
            }
            else if (Pass.Length < MIN_PASS_LENGTH)
            {
                string title   = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Insufficient_Title");
                string message = TextTools.RetrieveStringFromResource("CreateWallet_Dialog_Insufficient_Message")
                                 .Replace("*NUM*", MIN_PASS_LENGTH.ToString());
                await _cwview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

                return;
            }

            string  recPhrase = Generators.GenerateRecPhrase();
            Network net       = this.GetNetworkChoice();
            // WalletModel inherits from NBitcoin.SPV.Wallet which
            // requires a WalletCreation Class as a parameter
            WalletCreation create = Generators.GenerateWalletCreation(NewName, net);

            ExtKey           masterKey = Generators.GenerateMasterKey();
            BitcoinExtPubKey rootKey   = Generators.GenerateRootKey(masterKey, net);
            string           id        = TextTools.Base58Encode(NewName);

            string walletFolder = Path.Combine(App.WalletsDir, id);

            Directory.CreateDirectory(walletFolder);

            var newWallet = new WalletModel(id, NewName, rootKey, DateTimeOffset.Now, Description);

            newWallet.SetWalletPassword(Pass);
            newWallet.SetRecoveryPhrase(recPhrase);
            newWallet.SetMasterKey(masterKey);



            if (FileTools.SaveNewWallet(newWallet))
            {
                Messenger.Default.Send <string>(recPhrase, "OpenRecoveryPhraseView");
                // If a wallet is already active, lets ask the user to close
                // current active wallet and use the newly created one
                this.NewWalletPrompt(newWallet.FileLocation);
            }
        }
Exemplo n.º 22
0
        public void ut_170718_test_add_highlithing_html_code_to_latin_words_in_converted_string()
        {
            String arabicDarijaText = "بتوفيق لقرد .... وصل عمالك حسبان او تلتفت الجمهور يغرد خرج سرب او يفقه شيئا في قانون المناصر waghalibiyatohom تابعين المارق و زرق ... المناصر دور تشجع فقط ولا بغا تغير ينخرط flmaktab ويترشح";

            var arabicDarijaText2 = TextTools.HighlightExtractedLatinWords(arabicDarijaText);

            Assert.AreNotEqual(arabicDarijaText, arabicDarijaText2);
        }
Exemplo n.º 23
0
        public static async Task <List <SongSource> > GetSources(string query, int page = 1)
        {
            string          url      = string.Format(Constants.URLs.SongSources, TextTools.GetTidyText(query), page);
            HttpWebRequest  request  = HttpWebRequest.Create(url) as HttpWebRequest;
            HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse;

            return(SongResponse.GetSources(response));
        }
Exemplo n.º 24
0
        public void WriteLine(string format, params object[] args)
        {
            var line = TextTools.Format(format, args);

            //Logger.Trace("PUSH {0}", line);
            input.Push(line);
            //Logger.Trace("PUSHED {0}", line);
        }
Exemplo n.º 25
0
        public static async Task <List <SearchListItem> > GetPlaylists(string query)
        {
            string          url      = string.Format(Constants.URLs.SearchPlaylists, TextTools.GetSearchQuery(query));
            HttpWebRequest  request  = HttpWebRequest.Create(url) as HttpWebRequest;
            HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse;

            return(SearchResponse.GetPlaylists(response));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConflictInfoViewModel"/> class.
        /// </summary>
        /// <param name="conflict">The conflict information to create a viewmodel for.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="conflict"/> is null.</exception>
        public ConflictInfoViewModel(ConflictInfo conflict)
        {
            _conflict   = conflict ?? throw new ArgumentNullException(nameof(conflict));
            Description = TextTools.GetNumberDescriptionText(conflict.MemberCount, Strings.Member);
            var memberNames = _conflict.ConflictingMembers.Select(m => new MemberViewModel(in m)).ToList();

            MemberNames = memberNames;
            AnyMembers  = memberNames.Count > 0;
        }
Exemplo n.º 27
0
        /// <summary>
        /// Sends BTC to the receipient address, as long as the following conditions are met:
        /// 1. Entered amount is Valid
        /// 2. There are sufficient funds
        /// 3. Receipient address is valid
        /// 4. Password is correct
        /// </summary>
        private async void ExecuteSendBtc()
        {
            
            if (AddressValid() && AmountBtcOK() && EnoughFunds() && PasswordCorrect())
            {
                Money AmountToSend = Money.Parse(AmountBtc);
                                
                var readyTx = _wallet.BuildTransaction(ReceipientAddress, AmountToSend, AmountFee);
                var networkChoice = Network.GetNetworkFromBase58Data(ReceipientAddress);
                string titleConfirm;
                string messageConfirm;
                //PROMPT USER FOR CONFIRMATION
                if (networkChoice.Equals(Network.TestNet))
                {
                    
                    titleConfirm = TextTools.RetrieveStringFromResource("Send_Dialog_Confirm_Title");
                    messageConfirm = TextTools.RetrieveStringFromResource("Send_Dialog_Confirm_Message_Testnet")
                        .Replace("*btc_amount*", AmountBtc)
                        .Replace("*btc_symbol*", Global.VML.UiSettings.Symbol)
                        .Replace("*address*", ReceipientAddress);

                }
                else
                {

                    titleConfirm = TextTools.RetrieveStringFromResource("Send_Dialog_Confirm_Title");
                    messageConfirm = TextTools.RetrieveStringFromResource("Send_Dialog_Confirm_Message_Mainnet")
                        .Replace("*btc_amount*", AmountBtc)
                        .Replace("*btc_symbol*", Global.VML.UiSettings.Symbol)
                        .Replace("*symbol*", Global.VML.Currency.ActiveSymbol)
                        .Replace("*curr_amount*", AmountCurr)
                        .Replace("*curr*", Global.VML.Currency.ActiveCurrency)
                        .Replace("*address*", ReceipientAddress);
                }
                
                var result = await _sview.ShowMessageAsync(titleConfirm, messageConfirm, MessageDialogStyle.AffirmativeAndNegative);
                if (result.Equals(MessageDialogResult.Affirmative))
                {
                    var sendAttempt = await _wallet.SendBitcoin(readyTx);
                    if (sendAttempt.Equals(true))
                    {
                        string titleSuccess = TextTools.RetrieveStringFromResource("Send_Dialog_Success_Title");
                        string messageSuccess = TextTools.RetrieveStringFromResource("Send_Dialog_Success_Message");
                        await _sview.ShowMessageAsync(titleSuccess, messageSuccess, MessageDialogStyle.Affirmative);
                        _sview.Close();
                    }
                    else
                    {
                        string titleFailed = TextTools.RetrieveStringFromResource("Send_Dialog_Unsuccess_Title");
                        string messageFailed = TextTools.RetrieveStringFromResource("Send_Dialog_Unsuccess_Message");
                        await _sview.ShowMessageAsync(titleFailed, messageFailed, MessageDialogStyle.Affirmative);
                    }
                        
                }
            }

        }
Exemplo n.º 28
0
        private async void ShowErrorDialog()
        {
            //TODO insert into english string resource
            string title   = TextTools.RetrieveStringFromResource("TxInfo_Dialog_Fail_Title");
            string message = TextTools.RetrieveStringFromResource("TxInfo_Dialog_Fail_Message");
            await _tiview.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative);

            ExecuteCloseView();
        }
Exemplo n.º 29
0
        public void LogWallet()
        {
            string path = Path.Combine(_folder, "wallet.log");

            using (var fs = File.Create(path))
            {
                using (StreamWriter writer = new StreamWriter(fs))
                {
                    var numKeys = Keys.Count((k) => k.Consumed.Equals(true));
                    writer.WriteLine("Wallet Id: " + this.Name);
                    writer.WriteLine("Wallet Name: " + this.DisplayName);
                    writer.WriteLine("Wallet Balance: " + this.BalanceDisplay + " BTC");
                    writer.WriteLine("Wallet Network: " + this.NetworkChoice);
                    writer.WriteLine("Wallet Folder: " + _folder);
                    writer.WriteLine("Num. Private Keys: " + numKeys);
                    writer.WriteLine(Environment.NewLine);
                    writer.WriteLine("Public Keys");
                    writer.WriteLine("Num. Public Keys: " + numKeys);
                    writer.WriteLine("=========================");
                    writer.WriteLine(Environment.NewLine);
                    foreach (var key in Keys.Where((k) => k.Consumed.Equals(true)))
                    {
                        writer.WriteLine("Pub. Key: " + key.PublicKey.ToHex());
                        writer.WriteLine("Address: " + key.Address);
                        writer.WriteLine(Environment.NewLine);
                    }
                    writer.WriteLine("=========================");
                    writer.WriteLine(Environment.NewLine);
                    writer.WriteLine("Spendable Outputs");
                    writer.WriteLine("=========================");
                    writer.WriteLine(Environment.NewLine);
                    foreach (var output in _spendableOutputs)
                    {
                        writer.WriteLine("Amount: " + output.Amount.ToString() + " || " + "Address: " + output.ScriptPubKey.GetDestinationAddress(this.NetworkChoice));
                    }
                    writer.WriteLine("=========================");
                    writer.WriteLine(Environment.NewLine);
                    writer.WriteLine("Transactions");
                    writer.WriteLine("Num. Transactions: " + this.Txs.Count);
                    writer.WriteLine("Num. Sent Transactions: " + this.GetAllSentTransactions().Length);
                    writer.WriteLine("Num. Received Transactions: " + this.GetAllReceiveTransactions().Length);
                    writer.WriteLine("=========================");
                    writer.WriteLine(Environment.NewLine);
                    foreach (var tx in this.Txs)
                    {
                        writer.WriteLine("Tx. Hash: " + tx.Transaction.GetHash());
                        writer.WriteLine("Timestamp: " + TextTools.FormatFullDate(tx.UnconfirmedSeen));
                        writer.WriteLine("Value: " + tx.Balance.ToString() + " BTC");
                        writer.WriteLine(Environment.NewLine);
                    }
                    writer.WriteLine("=========================");
                    writer.WriteLine("END OF WALLET LOG");
                    writer.Close();
                }
            }
        }
Exemplo n.º 30
0
        private void OpenPassPromptView(string file)
        {
            _file       = file;
            _name       = TextTools.DecodeWalletName(file);
            PassAttempt = new SecureString();
            string message = TextTools.RetrieveStringFromResource("PromptPassword_Message").Replace("*name*", _name);

            this.SetPromptMessage(message);
            this.ShowView();
        }