Пример #1
0
        public ItemPage()
        {
            InitializeComponent();

            (ApplicationBar.Buttons[0] as ApplicationBarIconButton).Text = AppResources.But_Save;
            (ApplicationBar.Buttons[1] as ApplicationBarIconButton).Text = AppResources.But_Cancel;

            if (AppData.edit_id >= 0)
            {
                Item = AppData.DB.Items.FirstOrDefault(i => i.Item_ID == AppData.edit_id);
            }

            if (Item != null)
            {
                label_title.Text            = AppResources.Item_Title_Edit;
                text_task.Text              = Item.Item_Text;
                toggle_end.IsChecked        = Item.Item_End;
                stack_end.Visibility        = (Item.Item_End) ? Visibility.Visible : Visibility.Collapsed;
                toggle_alert.IsChecked      = Item.Item_Alert;
                stack_alert.Visibility      = (Item.Item_Alert) ? Visibility.Visible : Visibility.Collapsed;
                toggle_alert_icon.IsChecked = Item.Item_AlertIcon;
                toggle_alert_push.IsChecked = Item.Item_AlertPush;
                date_end.Value              = DateTime.FromBinary(Item.Item_TimeEnd);
                if (date_end.Value.Equals(new DateTime(0)))
                {
                    date_end.Value = DateTime.Now.AddDays(7);
                    time_end.Value = DateTime.Now.Subtract(new TimeSpan(0, DateTime.Now.Minute, DateTime.Now.Second));
                }
                else
                {
                    TimeSpan TimeTmp = date_end.Value.Value.Subtract(DateTime.FromBinary(Item.Item_TimeAlert));
                    time_end.Value = new DateTime(1, 1, 1, date_end.Value.Value.Hour, date_end.Value.Value.Minute, 0);
                    date_end.Value = date_end.Value.Value.Subtract(new TimeSpan(time_end.Value.Value.Hour, time_end.Value.Value.Minute, 0));

                    int tmpi = TimeTmp.Hours + (TimeTmp.Days * 24);
                    foreach (ListPickerItem item in list_alert_time.Items)
                    {
                        if (item.Tag.Equals(tmpi.ToString()))
                        {
                            list_alert_time.SelectedItem = item;
                            break;
                        }
                    }
                }
            }
            else
            {
                label_title.Text = AppResources.Item_Title_Add;
                date_end.Value   = DateTime.Now.AddDays(7);
                time_end.Value   = DateTime.Now.Subtract(new TimeSpan(0, DateTime.Now.Minute, DateTime.Now.Second));
            }
        }
Пример #2
0
 public void AddToTasks(TasksItem tasksItem)
 {
     base.AddObject("Tasks", tasksItem);
 }
Пример #3
0
 public static TasksItem CreateTasksItem(int ID)
 {
     TasksItem tasksItem = new TasksItem();
     tasksItem.Id = ID;
     return tasksItem;
 }