示例#1
0
        void appBarIconBtnSelect_Click(object sender, EventArgs e)
        {
            PivotItem             pivotItem = LockScreenPivot.SelectedItem as PivotItem;
            LongListMultiSelector selector  = GetSelectorByPivotName(pivotItem.Name);

            selector.EnforceIsSelectionEnabled = !selector.EnforceIsSelectionEnabled;
        }
示例#2
0
        private void WebPicture_ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {
            Image                 image    = sender as Image;
            WebPicture            picture  = image.DataContext as WebPicture;
            LongListMultiSelector selector = picture.SourceOrigin == SourceOrigin.BingToday ? BingTodayPictureSelector : (picture.SourceOrigin == SourceOrigin.Search ? WebPictureSelector : NasaTodayPictureSelector);

            WebImageLoadFailed(image, selector);
        }
示例#3
0
 public void Bind(LongListMultiSelector listbox)
 {
     Bound        = true;
     this.listbox = listbox;
     listbox.ManipulationStateChanged += listbox_ManipulationStateChanged;
     listbox.MouseMove      += listbox_MouseMove;
     listbox.ItemRealized   += OnViewportChanged;
     listbox.ItemUnrealized += OnViewportChanged;
 }
示例#4
0
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            base.OnBackKeyPress(e);

            PivotItem             pivotItem = LockScreenPivot.SelectedItem as PivotItem;
            LongListMultiSelector selector  = GetSelectorByPivotName(pivotItem.Name);

            if (selector != PhonePictureSelector && selector.EnforceIsSelectionEnabled)
            {
                selector.EnforceIsSelectionEnabled = false;
                e.Cancel = true;
            }
        }
示例#5
0
        private void appBarIconBtnAdd_Click(object sender, EventArgs e)
        {
            LongListMultiSelector selector = GetSelectorByPivotName((LockScreenPivot.SelectedItem as PivotItem).Name);

            if (selector != PhonePictureSelector && selector.SelectedItems.Count > 0)
            {
                if (LockscreenHelper.CurrentListCount + selector.SelectedItems.Count > Constants.LOCKSCREEN_MAX_COUNT)
                {
                    MessageBox.Show(string.Format(AppResources.MsgFailAddMaxCount, Constants.LOCKSCREEN_MAX_COUNT));
                    return;
                }
                PageHelper.SetDownloadImageList(selector.SelectedItems);
                NavigationService.Navigate(new Uri(string.Format("/View/ImageDownloadPage.xaml?searchKeyword={0}", searchQuery), UriKind.Relative));
            }
        }
示例#6
0
        private void ChangeAppbarIconButton(LongListMultiSelector selector, int addedCount, bool isPivotChanged)
        {
            if (selector.SelectedItems.Count == 0)
            {
                ApplicationBar.Buttons.Clear();
                ApplicationBar.Buttons.Add(appBarIconBtnSelect);
                ApplicationBar.Buttons.Add(appBarIconBtnSettings);
                return;
            }

            if (selector.SelectedItems.Count <= addedCount || isPivotChanged)
            {
                ApplicationBar.Buttons.Clear();
                ApplicationBar.Buttons.Add(appBarIconBtnAdd);
            }
        }
示例#7
0
        private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String pivotName = (e.AddedItems[0] as PivotItem).Name;

            ApplicationBar.IsVisible = false;

            LongListMultiSelector selector = GetSelectorByPivotName(pivotName);

            if (selector != PhonePictureSelector)
            {
                ApplicationBar.IsVisible = true;
                ChameleonAlbum album = selector.ItemsSource as ChameleonAlbum;
                ChangeAppbarIconButton(selector, 0, true);
                (ApplicationBar.Buttons[0] as ApplicationBarIconButton).IsEnabled = (album != null && album.Count > 0);
            }
        }
示例#8
0
        private void conversations_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            LongListMultiSelector list = (LongListMultiSelector)sender;

            if (list.SelectedItems.Count == 0)
            {
                ClearApplicationBar();
                SetupAppBarForEmptySelection();
            }
            else if (list.SelectedItems.Count >= 1 && !_usingSelectionAppBar) // Do it only once, when selection was empty and isn't anymore
            {
                _selection = list.SelectedItems.Cast <Conversation>();
                ClearApplicationBar();
                SetupAppBarForSelectedItems();
            }
        }
示例#9
0
        //웹이미지 로딩이 실패한 경우에 대한 처리
        private void WebImageLoadFailed(Image image, LongListMultiSelector selector)
        {
            BitmapImage img             = image.Source as BitmapImage;
            string      errorUrl        = img.UriSource.OriginalString;
            string      decodedErrorUrl = HttpUtility.UrlDecode(errorUrl);

            for (int i = 0; i < selector.ItemsSource.Count; i++)
            {
                WebPicture pic = (WebPicture)selector.ItemsSource[i];

                if (pic.Path == errorUrl || pic.Path == decodedErrorUrl)
                {
                    selector.ItemsSource.Remove(pic);//
                }
            }

            image.Source  = null;
            img.UriSource = null;
        }
示例#10
0
        private LongListMultiSelector GetSelectorBySourceOrigin(SourceOrigin source)
        {
            LongListMultiSelector selector = null;

            switch (source)
            {
            case SourceOrigin.BingToday:
                selector = BingTodayPictureSelector;
                break;

            case SourceOrigin.NasaToday:
                selector = NasaTodayPictureSelector;
                break;

            case SourceOrigin.Search:
                selector = WebPictureSelector;
                break;

            default:
                selector = PhonePictureSelector;
                break;
            }
            return(selector);
        }
示例#11
0
        private LongListMultiSelector GetSelectorByPivotName(string pivotName)
        {
            LongListMultiSelector selector = null;

            switch (pivotName)
            {
            case "Bing":
                selector = BingTodayPictureSelector;
                break;

            case "Nasa":
                selector = NasaTodayPictureSelector;
                break;

            case "Search":
                selector = WebPictureSelector;
                break;

            default:
                selector = PhonePictureSelector;
                break;
            }
            return(selector);
        }
示例#12
0
 public void Init(LongListMultiSelector selector, IApplicationBar bar)
 {
     this.selector = selector;
     this.bar      = bar;
     SetAppBarButtons(singleSelectButtons);
 }
示例#13
0
        public static void ProcessDownloadImageResult(ObservableCollection <DownloadItem> downloadList, LongListMultiSelector selector)
        {
            ChameleonAlbum album = selector.ItemsSource as ChameleonAlbum;

            //저장소에서 리턴값 삭제
            PhoneApplicationService.Current.State.Remove(Constants.DOWNLOAD_IMAGE_LIST);

            foreach (DownloadItem item in downloadList)
            {
                AbstractPicture pic = album.First(x => x.Guid == item.Guid) as AbstractPicture;
                if (pic.Guid == item.Guid)
                {
                    if (item.DownloadStatusCode == DownloadStatus.Completed)
                    {
                        //1. 해당 파일이 정상적으로 완료된 파일이라면 화면에서 삭제 처리
                        album.Remove(pic);
                    }
                    else if (item.DownloadStatusCode == DownloadStatus.DownloadFailed ||
                             item.DownloadStatusCode == DownloadStatus.SaveFailed)
                    {
                        //2. 해당 파일이 실패한 경우 이면
                        if (item.BlackListMode == BlackListMode.Domain)
                        {
                            //2.1 블랙리스트에 추가된 파일이라면 삭제
                            album.Remove(pic);
                        }
                        else
                        {
                            //2.2 아니면 실패 뱃지를 달아준다. 실패 원인을 표시한다.
                            pic.ProgressStatus = item.DownloadStatus.Replace(AppResources.MsgAddDomainFilter, string.Empty);
                        }
                    }
                }
            }
            //3. 선택 모드 해제 (여기서 즉시하면 에러가 발생하므로 딜레이 0.5초를 줘서 실행시킴)
            Deployment.Current.Dispatcher.BeginInvoke(async() =>
            {
                await Task.Delay(500);
                selector.EnforceIsSelectionEnabled = false;
            });
        }
        void Appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
        {
            try
            {
                List<Appointment> appointments = new List<Appointment>(e.Results);
                List<String> show = new List<String>();
                int i = 1;
                List<DateTime> alarmtimes = new List<DateTime>();
                DateTime temp = DateTime.Now;

                while (appointments.Count >= i || 8 > i)
                {
                    temp = temp.AddDays(1);

                    Appointment app = appointments.Find(item => item.StartTime.Hour != 0 && temp.Day == item.StartTime.Day);
                    if (app != null)
                    {
                        DateTime alarmtime = app.StartTime;
                        alarmtime = alarmtime.AddHours(-hour);
                        alarmtime = alarmtime.AddMinutes(-min);
                        alarmtimes.Add(alarmtime);
                        show.Add(alarmtime.ToString());

                        String AlarmName = System.Guid.NewGuid().ToString();
                        Alarm alarm = new Alarm(AlarmName);
                        alarm.Content = alarmtime.DayOfWeek + "! " + App.quotes.getQuote();
                        alarm.Sound = mediaplayer2.Source;
                        alarm.BeginTime = alarmtime;
                        alarm.ExpirationTime = alarmtime.AddSeconds(2);
                        alarm.RecurrenceType = RecurrenceInterval.None;
                        if (alarm.BeginTime.TimeOfDay > App.settings.DefaultLateTimeSetting.TimeOfDay)
                            lateAlarmsDisplay.Add(new ListItemAlarm(alarm.Name, alarm.BeginTime, alarm.Sound));
                        ScheduledActionService.Add(alarm);

                    }
                    i++;
                }
            }
            catch (System.Exception)
            {
                //That's okay, no results
            }
            if (lateAlarmsDisplay.Count() > 0)
            {
                messagePrompt = new MessagePrompt();
                messagePrompt.Background = (Brush)Application.Current.Resources["PhoneBackgroundBrush"];
                messagePrompt.IsCancelVisible = false;
                messagePrompt.Title = "Late Alarms";
                UserControl lateAlarms = new LateAlarmsPopup();
                ViolatingAlarms = lateAlarms.GetFirstLogicalChildByType<LongListMultiSelector>(true);
                lateAlarmsDisplay = new ObservableCollection<ListItemAlarm>(lateAlarmsDisplay.OrderBy(x => x.Date));
                ViolatingAlarms.ItemsSource = lateAlarmsDisplay;
                var result2 = lateAlarms.GetFirstLogicalChildByType<TextBlock>(true);
                result2.Text = "Alarms after " + App.settings.DefaultLateTimeSetting.ToShortTimeString();
                messagePrompt.Body = lateAlarms;
                RoundButton remove_btn = new RoundButton() {ImageSource = new BitmapImage(new Uri("Icons/appbar.delete.rest.png", UriKind.Relative)), Tag="remove"};
                remove_btn.Click += removeLate_Click;
                messagePrompt.ActionPopUpButtons.Add(remove_btn);
                messagePrompt.ActionPopUpButtons.ElementAt(0).Click += confirm_Click;
                messagePrompt.ActionPopUpButtons.ElementAt(0).Tag = "confirm";
                messagePrompt.ActionPopUpButtons.ElementAt(1).Tag = "cancel";
                ViolatingAlarms.SelectionChanged += ViolatingAlarms_SelectionChanged;
                foreach (ListItemAlarm alarm in lateAlarmsDisplay)
                {
                    ViolatingAlarms.SelectedItems.Add(alarm);
                }
                messagePrompt.Show();
            }
            else
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }