コード例 #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            RadDataBoundListBox list = this.GetTemplateChild("listBox") as RadDataBoundListBox;
            if (list == null)
                throw new Exception("tag list control is null");

            listBox = list;
            list.ItemTap += list_ItemTap;
        }
コード例 #2
0
        /// <summary>
        /// Selects the current element.
        /// </summary>
        public void Select()
        {
            RadDataBoundListBox listbox = this.ListBoxItemOwner.typedOwner;

            if (this.IsSelected || listbox == null)
            {
                return;
            }

            this.SetSelection(listbox, false, true);
        }
コード例 #3
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            RadDataBoundListBox list = this.GetTemplateChild("listBox") as RadDataBoundListBox;

            if (list == null)
            {
                throw new Exception("tag list control is null");
            }

            listBox       = list;
            list.ItemTap += list_ItemTap;
        }
コード例 #4
0
        public void ConnectionSelected(RadDataBoundListBox list)
        {
            var global = App.Instance;
            var connection = list.SelectedValue as Connection;

            if (connection == null || global == null) return;

            global.SearchSelection = connection;

            _navigationService
                .UriFor<CheckinViewModel>()
                .Navigate();
        }
コード例 #5
0
        public void RemoveFromSelection()
        {
            if (!IsEnabled())
            {
                throw new ElementNotEnabledException();
            }

            RadDataBoundListBox listbox = this.ListBoxItemOwner.typedOwner;

            if (listbox != null)
            {
                this.SetSelection(listbox, true, false);
            }
        }
コード例 #6
0
        private void SetSelection(RadDataBoundListBox listBox, bool oldValue, bool newValue)
        {
            if (listBox.IsCheckModeEnabled)
            {
                listBox.HandleItemCheckStateChange(this.ListBoxItemOwner);
                this.ListBoxItemOwner.UpdateCheckedState();
            }
            else
            {
                listBox.SelectedItem             = newValue ? this.ListBoxItemOwner.DataContext : null;
                this.ListBoxItemOwner.IsSelected = newValue;
            }

            this.RaisePropertyChangedEvent(SelectionItemPatternIdentifiers.IsSelectedProperty, oldValue, newValue);
        }
コード例 #7
0
        private void ChangeCheckModeAction(bool onOff, RadDataBoundListBox listBox, object item)
        {
            if (onOff)
            {
                if (item != null)
                {
                    listBox.CheckedItems.Add(item);
                }

                if (_sharedItemsViewModel.ActiveSharedFolderView.CurrentDisplayMode != DriveDisplayMode.MultiSelect)
                {
                    _sharedItemsViewModel.ActiveSharedFolderView.PreviousDisplayMode = _sharedItemsViewModel.ActiveSharedFolderView.CurrentDisplayMode;
                }
                _sharedItemsViewModel.ActiveSharedFolderView.CurrentDisplayMode = DriveDisplayMode.MultiSelect;
            }
            else
            {
                listBox.CheckedItems.Clear();
                _sharedItemsViewModel.ActiveSharedFolderView.CurrentDisplayMode = _sharedItemsViewModel.ActiveSharedFolderView.PreviousDisplayMode;
            }
        }
コード例 #8
0
        private void ChangeCheckModeAction(bool onOff, RadDataBoundListBox listBox, object item)
        {
            if (onOff)
            {
                if (item != null && !listBox.CheckedItems.Contains(item))
                {
                    try { listBox.CheckedItems.Add(item); }
                    catch (InvalidOperationException) { /* Item already checked. Do nothing. */ }
                }

                if (_savedForOfflineViewModel.SavedForOffline.CurrentDisplayMode != DriveDisplayMode.MultiSelect)
                {
                    _savedForOfflineViewModel.SavedForOffline.PreviousDisplayMode = _savedForOfflineViewModel.SavedForOffline.CurrentDisplayMode;
                }
                _savedForOfflineViewModel.SavedForOffline.CurrentDisplayMode = DriveDisplayMode.MultiSelect;
            }
            else
            {
                listBox.CheckedItems.Clear();
                _savedForOfflineViewModel.SavedForOffline.CurrentDisplayMode = _savedForOfflineViewModel.SavedForOffline.PreviousDisplayMode;
            }
        }
コード例 #9
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            Grid root = this.GetTemplateChild("LayoutRoot") as Grid;
            RadAutoCompleteBox  racb = this.GetTemplateChild("autoComplete") as RadAutoCompleteBox;
            RadDataBoundListBox list = this.GetTemplateChild("listBox") as RadDataBoundListBox;

            if (list == null)
            {
                throw new InvalidOperationException("smiley control list is null");
            }

            this.listBox        = list;
            list.ItemTap       += list_ItemTap;
            list.DataRequested += SmileyDataRequested;

            SmileyViewModel    = new SmileyListViewModel();
            racb.DataContext   = SmileyViewModel;
            list.DataContext   = SmileyViewModel;
            SmileyAutoComplete = racb;
            InitializeSmilieyAutoComplete();
        }
コード例 #10
0
 public static void DisableVirtualization(RadDataBoundListBox listbox)
 {
     listbox.DataVirtualizationMode = DataVirtualizationMode.None;
 }
コード例 #11
0
 protected void InitializePage(DrawerLayout drawerLayout, RadDataBoundListBox listBox, HamburgerMenuItemType currentType)
 {
     this.PageDrawerLayout         = drawerLayout;
     this.HamburgerMenuListBox     = listBox;
     this.CurrentHamburgerMenuItem = currentType;
 }
コード例 #12
0
 /// <summary>
 ///  Initializes a new instance of the <see cref="RadDataBoundListBoxAutomationPeer"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="RadDataBoundListBox"/> that is associated with this <see cref="RadDataBoundListBoxAutomationPeer"/>.</param>
 public RadDataBoundListBoxAutomationPeer(RadDataBoundListBox owner) : base(owner)
 {
 }
コード例 #13
0
ファイル: General.cs プロジェクト: hsynlms/Creatalk
 public static void DisableVirtualization(RadDataBoundListBox listbox)
 {
     listbox.DataVirtualizationMode = DataVirtualizationMode.None;
 }
コード例 #14
0
ファイル: ThreadList.xaml.cs プロジェクト: bootlegrobot/awful
 void OnPageLoaded(object sender, EventArgs e)
 {
     this._defaultAppBar.SetButton(RELOADBUTTON_INDEX, "reload", this._reloadUri);
     if (this._reloadingListBox != null)
     {
         this._reloadingListBox.StopPullToRefreshLoading(true);
         this._reloadingListBox = null;
     }
 }
コード例 #15
0
ファイル: ThreadList.xaml.cs プロジェクト: bootlegrobot/awful
 private void ThreadsList_RefreshRequested(object sender, EventArgs e)
 {
     var listBox = sender as RadDataBoundListBox;
     if (listBox != null)
     {
         this._reloadingListBox = listBox;
         this.GoToPage(this.context.CurrentPage);
     }
 }
コード例 #16
0
        public void Execute(object parameter)
        {
            RadDataBoundListBox listBox = ElementTreeHelper.FindVisualAncestor <RadDataBoundListBox>(parameter as DependencyObject);
            RadContextMenu      menu    = RadContextMenu.GetContextMenu(listBox);

            RadDataBoundListBoxItem item = ElementTreeHelper.FindVisualAncestor <RadDataBoundListBoxItem>(parameter as DependencyObject);

            int    chapterNo = 0;
            int    verseNo   = 0;
            string quranText = "";
            string verseText = "";

            if (item.Content is Verse)
            {
                Verse verse = (item.Content as Verse);

                int result = (Application.Current as App).db.SetLastRead(verse.chapter_id, verse.verse_id);

                if (result == 0)
                {
                    MessageBox.Show("Last Read upadate Failed.");
                }
                else
                {
                    //MessageBox.Show("Last Read Saved.");
                }
            }

            if (menu.Name == "menuVerse")
            {
                Verse verse = (item.Content as Verse);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.verse_text;
            }
            else if (menu.Name == "menuVerseCompare")
            {
                VerseCompare verse = (item.Content as VerseCompare);

                chapterNo = verse.SuraID;
                verseNo   = verse.VerseID;
                //quranText = verse.AyahText;
                verseText = verse.AyahText;
            }
            else if (menu.Name == "menuIndexItem")
            {
                IndexItem verse = (item.Content as IndexItem);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.VerseText;
            }
            else if (menu.Name == "menuTopicItem")
            {
                TopicItem verse = (item.Content as TopicItem);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.VerseText;
            }
            else if (menu.Name == "menuBookMark")
            {
            }
            else if (menu.Name == "menuSearchTerm")
            {
            }
            else
            {
                Verse verse = (item.Content as Verse);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.verse_text;
            }

            if (this.Name == "CopyCompleteCommand")
            {
                string shareTextArabTrans = quranText + " | '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                //string shareTextTrans = "'"+verseText+"' (" + chapterNo + ":" + verseNo + ")";

                Clipboard.SetText(shareTextArabTrans);
                //MessageBox.Show("Copied to Clipboard: " + shareTextArabTrans);
            }
            else if (this.Name == "CopyCommand")
            {
                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                Clipboard.SetText(shareTextTrans);
                //MessageBox.Show("Copied to Clipboard: " + shareTextTrans);
            }
            else if (this.Name == "ShareCommand")
            {
                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                ShareStatusTask shareStatusTask = new ShareStatusTask();
                shareStatusTask.Status = shareTextTrans;
                shareStatusTask.Show();
            }
            else if (this.Name == "TweetCommand")
            {
                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                //http://web.quran360.com/site/verse/tr/26/ch/1/v/1

                shareTextTrans = shareTextTrans.Substring(0, 90);
                shareTextTrans = shareTextTrans + "... (cont) http://web.quran360.com/site/verse/tr/" + AppSettings.TransSetting + "/ch/" + chapterNo + "/v/" + verseNo;

                ShareStatusTask shareStatusTask = new ShareStatusTask();
                shareStatusTask.Status = shareTextTrans;
                shareStatusTask.Show();
            }
            else if (this.Name == "EmailCommand")
            {
                string shareSubject = "Quran360 Share | Quran (" + chapterNo + ":" + verseNo + ")";

                string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                //string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                Microsoft.Phone.Tasks.EmailComposeTask email = new Microsoft.Phone.Tasks.EmailComposeTask();
                email.Subject = shareSubject;
                email.Body    = shareTextArabTrans;
                email.Show();
            }
            else if (this.Name == "SmsCommand")
            {
                string shareSubject = "Read Quran: (" + chapterNo + ":" + verseNo + ")";

                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                Microsoft.Phone.Tasks.SmsComposeTask sms = new Microsoft.Phone.Tasks.SmsComposeTask();
                sms.Body = shareTextTrans;
                sms.Show();
            }
            else if (this.Name == "SetCheckPointCommand")
            {
                try
                {
                    //int chapterNo = (item.Content as Verse).chapter_id;
                    //int verseNo = (item.Content as Verse).verse_id;
                    int result = (Application.Current as App).db.SetBookMark(chapterNo, verseNo, -1);

                    if (result == 0)
                    {
                        MessageBox.Show("ReadPoint Failed.");
                    }
                    else
                    {
                        //MessageBox.Show("ReadPoint Saved.");
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("SetCheckPointCommand failed: " + ex.StackTrace);
                }
            }
            else if (this.Name == "SetBookmarkCommand")
            {
                try
                {
                    //int chapterNo = (item.Content as Verse).chapter_id;
                    //int verseNo = (item.Content as Verse).verse_id;
                    int result = (Application.Current as App).db.SetBookMark(chapterNo, verseNo, (verseNo - 1));

                    if (result == 0)
                    {
                        MessageBox.Show("BookMark Failed.");
                    }
                    else
                    {
                        //MessageBox.Show("BookMark Saved.");
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("SetBookmarkCommand failed: " + ex.StackTrace);
                }
            }
            else if (this.Name == "PlayCommand")
            {
                Verse verse = (item.Content as Verse);

                String url = "http://web.quran360.com/audio/v_saad_al_ghaamidi/00" + verse.chapter_id + "/00" + verse.chapter_id + "00" + verse.verse_id + ".mp3";
            }
            else if (this.Name == "PauseCommand")
            {
            }
            else if (this.Name == "StopCommand")
            {
            }
            else if (this.Name == "DeleteBookMarkCommand")
            {
                BookMark bookMark = (item.Content as BookMark);
                int      result   = (Application.Current as App).db.DeleteBookMark(bookMark.id);

                if (result == 0)
                {
                    MessageBox.Show("Delete BookMark Failed.");
                }
                else if (result == 2)
                {
                    MessageBox.Show("Cannot Delete ReadPoint.");
                }
                else
                {
                    //MessageBox.Show("Delete BookMark Success.");
                }
            }
            else if (this.Name == "DeleteSearchTermCommand")
            {
                SearchTerm searchTerm = (item.Content as SearchTerm);
                int        result     = (Application.Current as App).db.DeleteSearchTerm(searchTerm.id);

                if (result == 0)
                {
                    MessageBox.Show("Delete Search Failed.");
                }
                else
                {
                    //MessageBox.Show("Delete Search Success.");
                }
            }
            //this.ScheduleNotification(menu, item);
        }
コード例 #17
0
        private void CreateNewTap(string header, int areaCodeMinusOne)
        {
            var tap = new PivotItem { Header = header };

            var list = new RadDataBoundListBox();
            list.SelectionChanged += OnDramaSelected;
            list.Tag = areaCodeMinusOne;
            list.ItemAddedAnimation = AddedAnimation;
            list.ItemAddedAnimationInterval = TimeSpan.FromMilliseconds(500);
            list.ItemTemplate = DramaButtonItemTemplate;
            list.VirtualizationStrategyDefinition = WrapDefinition;
            list.CacheMode = new BitmapCache();

            list.Tag = areaCodeMinusOne;
            tap.Content = list;
            PivotContainer.Items.Insert(areaCodeMinusOne, tap);
            listReferences.Add(list, new ObservableCollection<NewDramasInfo>());
        }