Exemplo n.º 1
0
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            var i = new MessageDialog("");

            if (Title.Text == "")
            {
                i.Content = "请填写标题!";
                i.ShowAsync();
            }

            else if (Details.Text == "")
            {
                i.Content = "请填写计划细节!";
                i.ShowAsync();
            }

            else if (Date.Date < DateTime.Now.Date)
            {
                i.Content = "时间设置不正确!";
                i.ShowAsync();
            }

            else
            {
                TodoItemViewModel.AddTodoItem(Title.Text, Details.Text, Date.Date.Date, Image.Source, "background.jpg");
                Title.Text   = "";
                Details.Text = "";
                Date.Date    = DateTime.Now.Date;
                TodoItemViewModel.SelectedItem = null;
                Update_Tile();
            }
        }
Exemplo n.º 2
0
        private void Query_Click(object sender, RoutedEventArgs e)
        {
            var       QueryString = QueryTextBox.Text;
            ArrayList items       = new ArrayList();

            items = TodoItemViewModel.getTodoItemsByKeywords(QueryString);
            var    msg     = new MessageDialog("");
            string content = "";

            foreach (var item in items)
            {
                var it = (Models.TodoItem)item;
                content += "Title: " + it.title + "; Description: " + it.description + "; Date: " + it.date.Date;
                content += "\n";
            }
            msg.Content = content == "" ? "未查询到相关信息!" : content;
            msg.ShowAsync();
        }
        private void CreateOrUpdateButton_Click(object sender, RoutedEventArgs e)
        {
            var i = new MessageDialog("");

            if (Title.Text == "")
            {
                i.Content = "请填写标题!";
                i.ShowAsync();
            }

            else if (Details.Text == "")
            {
                i.Content = "请填写计划细节!";
                i.ShowAsync();
            }

            else if (Date.Date < DateTime.Now.Date)
            {
                i.Content = "时间设置不正确!";
                i.ShowAsync();
            }


            else
            {
                if ((string)CreateOrUpdateButton.Content == "Create")
                {
                    TodoItemViewModel.AddTodoItem(Title.Text, Details.Text, Date.Date.Date, Image.Source, ImageName);
                }
                else
                {
                    TodoItemViewModel.UpdateTodoItem(TodoItemViewModel.SelectedItem.id, Title.Text, Details.Text, Date.Date.Date, Image.Source, ImageName);
                }
                Frame.Navigate(typeof(MainPage));
            }
        }
 private void AppBarButton_Click(object sender, RoutedEventArgs e)
 {
     TodoItemViewModel.RemoveTodoItem(TodoItemViewModel.SelectedItem.id);
     TodoItemViewModel.SelectedItem = null;
     Frame.Navigate(typeof(MainPage));
 }