예제 #1
0
        private async void GetCoinsAndCurrencies()
        {
            DataFetcher rdf    = new DataFetcher();
            string      result = await rdf.GetThings();

            MyTextBox.AppendText(result);
        }
예제 #2
0
 private void ReadFromTxt()
 {
     // The easiest way is to just replace the whole text
     MyTextBox.Text = "";
     string[] lines = System.IO.File.ReadAllLines(@"D:\Log.txt");
     foreach (string line in lines)
     {
         MyTextBox.AppendText(line + Environment.NewLine);
     }
 }
예제 #3
0
        private void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            string      downloadedText = ReadTextFromUrl(@"https://akrzemi1.wordpress.com/feed/");
            XmlDocument xmlText        = new XmlDocument();

            xmlText.LoadXml(downloadedText);
            XmlNode     root     = xmlText.DocumentElement;
            XmlNodeList nodeList = root.SelectNodes("/rss/channel/item/title");

            MyTextBox.Clear();

            for (int i = 0; i < 5; i++)
            {
                MyTextBox.AppendText(nodeList[i].InnerText + "\n");
            }
        }
예제 #4
0
        private void InitCustomLayout()
        {
            var list = TupleList();

            foreach (Tuple <string, Grid> tuple in list)
            {
                // create a char array from string
                char[] charArray = tuple.Item1.ToCharArray();

                // add cells to the grid
                foreach (char a in charArray)
                {
                    tuple.Item2.ColumnDefinitions.Add(new ColumnDefinition());
                }

                // for loop - create button with all the properties and asign an [EventHandler]
                for (int i = 0; i < charArray.Length; i++)
                {
                    Button button = new Button();
                    button.Width   = 30.0;
                    button.Height  = 30.0;
                    button.Content = charArray[i].ToString();
                    button.Click  += new RoutedEventHandler(OnClick);

                    Grid.SetColumn(button, i);
                    tuple.Item2.Children.Add(button);
                }
            }

            void OnClick(object sender, RoutedEventArgs e)
            {
                Button button = (Button)sender;

                MyTextBox.AppendText((string)button.Content);
                MyTextBox.Focus();
            }
        }
예제 #5
0
 public void AppendText(string text)
 {
     textBox.AppendText(text);
 }
예제 #6
0
 // space button
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     MyTextBox.AppendText(" ");
     MyTextBox.Focus();
 }
예제 #7
0
 void Msg(string msg)
 {
     Log(msg);
     TXBmsg.AppendText($"{msg}\r\n");
 }