Ejemplo n.º 1
0
 private void TextMaker_Load(object sender, EventArgs e)
 {
     tabControlMain.TabPages.Clear();
     MyTextBox.Clear();
     DefinedItems      = LoadDefinedItems(@"FixedDefinitionXML.xml");
     MyTextDataAdapter = new TextDataAdapter(DefinedItems);
     MakeControls(DefinedItems);
 }
Ejemplo n.º 2
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            string userInput = MyTextBox.Text;

            _bm.Add(userInput);
            MyTextBox.Clear();
            ListBoxBlogs.ItemsSource = _bm.ReadBlog();
            //ListBoxPosts.ItemsSource = _bm.ReadPost();
        }
Ejemplo n.º 3
0
        private void ButtonEditBlog_Click(object sender, RoutedEventArgs e)
        {
            string userInput = MyTextBox.Text;

            _bm.Edit(userInput);
            MyTextBox.Clear();

            ListBoxBlogs.SelectedItem = _bm.SelectedBlog;
            ListBoxBlogs.ItemsSource  = _bm.ReadBlog();
        }
        /// <summary>
        /// Runs when a user clicks the 'Scan' button. This method will run the input through the methods from the PointOfSaleTerminalLibrary.
        /// It will return the output into labels to be displayed on screen back for the user.
        /// </summary>
        /// <param name="sender">Contains a reference to the button 'Scan' that raises this event</param>
        /// <param name="e">Contains the event data</param>
        public void Scan(object sender, RoutedEventArgs e)
        {
            RunMethods run    = new RunMethods();
            decimal    result = run.RunCode(MyTextBox.Text);

            Label1.Content = MyTextBox.Text + " Totals to: $" + result;
            Label2.Content = "Overall Total: $" + CalculateOverallTotal(result) + "                            " +
                             "Overall Savings: $" + CalculateOverallSavings(run.savings);
            MyTextBox.Clear();//clear the input box so the next input can be entered
        }
Ejemplo n.º 5
0
        private void ButtonAddPost_Click(object sender, RoutedEventArgs e)
        {
            string userTitle   = PostTitle.Text;
            string userContent = PostContent.Text;

            _bm.Update(userTitle, userContent);
            MyTextBox.Clear();

            ListBoxBlogs.SelectedItem = _bm.SelectedBlog;
            ListBoxPosts.ItemsSource  = _bm.ReadPost(_bm.SelectedBlog.BlogId);
        }
Ejemplo n.º 6
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            tabControlMain.TabPages.Clear();
            MyTextBox.Clear();
            var dataFilePath = OpenFileDialogShow();

            if (string.IsNullOrWhiteSpace(dataFilePath))
            {
                return;
            }
            DefinedItems      = LoadDefinedItems(dataFilePath);
            MyTextDataAdapter = new TextDataAdapter(DefinedItems);
            MakeControls(DefinedItems);
        }
Ejemplo n.º 7
0
        private void OpenFile(string fileName)   //Abrir arquivo
        {
            string linha = null;
            string text  = "";

            try {
                using (var arquivo = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
                    using (var leitor = new StreamReader(arquivo)) {
                        leitor.BaseStream.Seek(0, SeekOrigin.Begin);
                        myText.Clear();
                        linha = leitor.ReadLine();
                        while (linha != null)
                        {
                            //myText.Text+=linha+"\n"; - RichTextBox
                            text += linha + "\n";
                            linha = leitor.ReadLine();
                        }
                        myText.Text = text.Replace("\n", "\r\n"); //Substituindo \n por \r\n, porque o TextBox não suporta o \n comum por algum motivo...
                    }
                }
            } catch (Exception ex) {
                MessageBox.Show("Não foi possível abrir o arquivo\n" + ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 8
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");
            }
        }
Ejemplo n.º 9
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     MyLabel.Content = ((VkViewModel)DataContext).Find_User(MyTextBox.Text);
     MyTextBox.Clear();
 }