Esempio n. 1
0
        private void CardContentListView_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
        {
            CardContent        dragCardContent     = e.Items[0] as CardContent;
            CardTitleViewModel originalCardTitleVM = this.cardTitleVM;

            ListViewChangeItemEvent(originalCardTitleVM, dragCardContent);
        }
Esempio n. 2
0
        private void SubmitAction(object sender, RoutedEventArgs e)
        {
            if (titleTextBox.Text.Length > 0 && contentTextBox.Text.Length > 0)
            {
                if (selectedAlarmTime != null)
                {
                    DateTime        dt           = DateTime.Parse(selectedAlarmTime);
                    System.DateTime startTime    = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
                    long            timeStamp    = (long)(dt - startTime).TotalMilliseconds / 1000;
                    DateTime        nowDateTime  = DateTime.Now;
                    long            nowTimeStamp = (long)(nowDateTime - startTime).TotalMilliseconds / 1000;
                    if (timeStamp <= nowTimeStamp)
                    {
                        FlyoutBase.ShowAttachedFlyout((FrameworkElement)alarmTime);
                        return;
                    }
                }


                //back
                SolidColorBrush brush = new SolidColorBrush();
                brush.Color = mycolor;
                //noti
                string toastId = null;
                if (selectedAlarmTime != null)
                {
                    ToastUtil toastUtil = new ToastUtil();
                    toastId = toastUtil.showToast(selectedAlarmTime, titleTextBox.Text, contentTextBox.Text);
                }
                if (this.editCardContent != null)
                {
                    if (this.editCardContent.ToastId != null)
                    {
                        //remove old toast
                        ToastUtil toastUtil = new ToastUtil();
                        toastUtil.removeToast(this.editCardContent);
                    }
                    int index = this.model.Contents.IndexOf(this.editCardContent);
                    this.editCardContent = new CardContent {
                        ContentTitle = titleTextBox.Text, ContentDetail = contentTextBox.Text, AlarmTime = selectedAlarmTime, StatusColor = brush, ToastId = toastId
                    };;
                    this.model.Contents.RemoveAt(index);
                    this.model.Contents.Insert(index, this.editCardContent);
                }
                else
                {
                    this.model.Contents.Add(new CardContent {
                        ContentTitle = titleTextBox.Text, ContentDetail = contentTextBox.Text, AlarmTime = selectedAlarmTime, StatusColor = brush, ToastId = toastId
                    });
                }

                Frame.GoBack();
            }
            else
            {
                FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
            }
        }
Esempio n. 3
0
        private void CardContentListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            ListView    clickListView           = sender as ListView;
            CardContent clickContent            = e.ClickedItem as CardContent;
            Frame       root                    = Window.Current.Content as Frame;
            ObservableCollection <Object> lists = new ObservableCollection <Object>()
            {
                this.cardTitleVM, clickContent
            };

            root.Navigate(typeof(AddCardContentPage), lists, new DrillInNavigationTransitionInfo());
        }
Esempio n. 4
0
        public void removeToast(CardContent content)
        {
            IReadOnlyList <ScheduledToastNotification> scheduled =
                ToastNotificationManager.CreateToastNotifier().GetScheduledToastNotifications();

            foreach (ScheduledToastNotification notify in scheduled)
            {
                if (notify.Id == content.ToastId)
                {
                    ToastNotificationManager.CreateToastNotifier().RemoveFromSchedule(notify);
                }
            }
        }
Esempio n. 5
0
 private void SingleCardUC_ListViewChangeItemEvent(CardTitleViewModel exchangeCardTitleVM, CardContent exchangeContent)
 {
     if (exchangeContent != null)
     {
         this.dragCardContent     = exchangeContent;
         this.originalCardTitleVM = exchangeCardTitleVM;
     }
     else
     {
         //complete
         this.originalCardTitleVM.Contents.Remove(this.dragCardContent);
         exchangeCardTitleVM.Contents.Insert(0, this.dragCardContent);
     }
 }
Esempio n. 6
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (e.Parameter is CardTitleViewModel)
     {
         this.model = e.Parameter as CardTitleViewModel;
     }
     if (e.Parameter is ObservableCollection <object> )
     {
         ObservableCollection <object> lists = e.Parameter as ObservableCollection <object>;
         this.model           = lists[0] as CardTitleViewModel;
         this.editCardContent = lists[1] as CardContent;
     }
 }
Esempio n. 7
0
        private void MenuFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            MenuFlyoutItem item = sender as MenuFlyoutItem;
            //delete
            CardContent clickVM = item.DataContext as CardContent;

            this.cardTitleVM.Contents.Remove(clickVM);
            //remove toast
            if (clickVM.AlarmTime != null && clickVM.AlarmTime.Length > 0)
            {
                ToastUtil toastUtil = new ToastUtil();
                toastUtil.removeToast(clickVM);
            }
        }