コード例 #1
0
        private void btAddBook_Click(object sender, RoutedEventArgs e)
        {
            string title  = tbTitle.Text;
            string author = tbAuthor.Text;

            // Minimalistic input validation
            if ((title == "") || (author == ""))
            {
                MessageBox.Show("Title and author must not be empty");
                return;
            }
            int yop;

            if (!Int32.TryParse(tbYop.Text, out yop))
            {
                MessageBox.Show("Year must be an integer");
                return;
            }
            //
            proxy.AddBook(title, author, yop);
            //Reset the filter
            filter        = "";
            tbFilter.Text = "";
            RefreshListView();
        }
コード例 #2
0
        private void btAddBook_Click(object sender, RoutedEventArgs e)
        {
            string title  = tbTitle.Text;
            string author = tbAuthor.Text;
            int    yop;

            Int32.TryParse(tbYop.Text, out yop);
            //FIXME: Validate input
            proxy.AddBook(title, author, yop);
            //Reset the filter
            filter        = "";
            tbFilter.Text = "";
            RefreshListView();
        }