Beispiel #1
0
        private async void Create_Update(object sender, RoutedEventArgs e)
        {
            string message = "";

            if (title.Text == "")
            {
                message += "Title";
            }
            if (detail.Text == "")
            {
                if (message != "")
                {
                    message += ",Detail";
                }
                else
                {
                    message += "Detail";
                }
            }
            if (message != "")
            {
                message += "不得为空\n";
            }

            if (datePicker.Date < DateTimeOffset.Now.LocalDateTime.AddDays(-1))
            {
                message += "时间不得小于当前日期";
            }

            if (message != "")
            {
                await new MessageDialog(message).ShowAsync();
            }
            else if (create_update.Content.ToString() == "Create")
            {
                Frame rootFrame = Window.Current.Content as Frame;
                //Debug.WriteLine(datePicker.Date.LocalDateTime);
                ViewModel1.AddListItem(pic.Source, GetSelectPicture.picPath, slider.Value, title.Text, detail.Text, datePicker.Date);

                rootFrame.Navigate(typeof(MainPage));
                TileService.UpdateTile();
                ToastService.CreateNotify();
                await new MessageDialog("Create successfully!").ShowAsync();
            }
            else
            {
                Frame rootFrame = Window.Current.Content as Frame;
                ViewModel1.UpdateListItem(pic.Source, GetSelectPicture.picPath, slider.Value, title.Text, detail.Text, datePicker.Date);
                rootFrame.Navigate(typeof(MainPage));
                ViewModel1.SelectedItem = null;
                TileService.UpdateTile();
                ToastService.UpdateNotify();
                await new MessageDialog("Update successfully!").ShowAsync();
            }
        }
Beispiel #2
0
 async private void CheckBox_Click(object sender, RoutedEventArgs e)
 {
     var s    = sender as FrameworkElement;
     var item = (Models.ListItem)s.DataContext;
     await ViewModel.UpdateListItem(item.GetID());
 }