コード例 #1
0
        private void update_button_click(object sender, RoutedEventArgs e)
        {
            if (view_Module.Select_item != null)
            {
                if (title_block.Text == "")
                {
                    var messagedialog = new MessageDialog("title can not be empty").ShowAsync();
                }
                else if (detail_block.Text == "")
                {
                    var messagedialog = new MessageDialog("detail can not be empty").ShowAsync();
                }
                //view_Module.select_item.title = title_block.Text;
                //view_Module.select_item.detail = detail_block.Text;
                //view_Module.select_item.date = date;
                view_Module.update_item(title_block.Text, detail_block.Text, date.Date.DateTime, images.Source);


                using (var custstmt = App.conn.Prepare("UPDATE Item SET Title = ?, Detail = ?, Date = ? WHERE Id=?"))
                {         // NOTE when using anonymous parameters the first has an index of 1, not 0. 
                    custstmt.Bind(1, title_block.Text);
                    custstmt.Bind(2, detail_block.Text);
                    custstmt.Bind(3, date.Date.DateTime.ToString("u"));
                    custstmt.Bind(4, view_Module.Select_item.id);
                    custstmt.Step();
                }

                Frame.Navigate(typeof(MainPage), view_Module);
            }
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: xiongdajq/MAD_HW
 private void ud_click(object sender, RoutedEventArgs e)
 {
     if (view_Module.Select_item != null)
     {
         if (tb_t.Text == "")
         {
             var messagedialog = new MessageDialog("title can not be empty").ShowAsync();
         }
         else if (tb_d.Text == "")
         {
             var messagedialog = new MessageDialog("detail can not be empty").ShowAsync();
         }
         //view_Module.select_item.title = title_block.Text;
         //view_Module.select_item.detail = detail_block.Text;
         //view_Module.select_item.date = date;
         view_Module.update_item(tb_t.Text, tb_d.Text, dp.Date.DateTime, right_image.Source);
         Frame.Navigate(typeof(MainPage), view_Module);
     }
 }