private void populateSelectionList(MultiselectList list, IEnumerable <Item> storage, IEnumerable <Item> selected)
 {
     foreach (Item item in selected)
     {
         ItemViewModel viewModel = new ItemViewModel(item);
         list.SelectedItems.Add(viewModel);
         items.Add(viewModel);
     }
     foreach (string item in storage)
     {
         bool found = false;
         foreach (Item select in selected)
         {
             if (select == item)
             {
                 found = true;
                 break;
             }
         }
         if (!found)
         {
             ItemViewModel viewModel = new ItemViewModel(item);
             items.Add(viewModel);
         }
     }
 }
Ejemplo n.º 2
0
        private MultiselectList FindActiveListBox()
        {
            MultiselectList result = null;

            int index = commentsPivot.SelectedIndex;

            switch (index)
            {
            case 0:
                result = allCommentsListBox;
                break;

            case 1:
                result = approvedCommentsListBox;
                break;

            case 2:
                result = unapprovedCommentsListBox;
                break;

            case 3:
                result = spamCommentsListBox;
                break;
            }
            return(result);
        }
Ejemplo n.º 3
0
        private void LongTasks_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            target = (MultiselectList)sender;

            if (target.IsSelectionEnabled)
            {
                if (target.SelectedItems.Count > 1)
                {
                    selectTaskBtn.IsEnabled  = true;
                    deleteTaskBtn.IsEnabled  = true;
                    invoiceTaskBtn.IsEnabled = false;
                }
                else if (target.SelectedItems.Count == 1)
                {
                    selectTaskBtn.IsEnabled  = true;
                    deleteTaskBtn.IsEnabled  = true;
                    invoiceTaskBtn.IsEnabled = true;

                    App.AppInvoiceViewModel.InvoiceTask = target.SelectedItems[0] as MyTask;
                }
            }
            else
            {
                deleteTaskBtn.IsEnabled  = false;
                invoiceTaskBtn.IsEnabled = false;
            }
        }
Ejemplo n.º 4
0
        private void multiselectList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MultiselectList activeListBox = (MultiselectList)sender;

            // when all items are unselected the selection mode automatically turns off
            if (activeListBox.SelectedItems.Count == 0)
            {
                activeListBox.IsSelectionEnabled = true;
            }
        }
Ejemplo n.º 5
0
        private void ToggleCommentSelection(Object category)
        {
            MultiselectList activeListBox = FindActiveListBox();
            MultiselectItem container     = activeListBox.ItemContainerGenerator.ContainerFromItem(category) as MultiselectItem;

            if (null != container)
            {
                container.IsSelected = !container.IsSelected;
            }
        }
 public void Connect(Pivot pivot, HeaderControl headerOldTrainingDate, Action <EntryObjectDTO> ShowOldTraining, MultiselectList previewList)
 {
     this.pivot                             = pivot;
     pivot.SelectionChanged                -= new SelectionChangedEventHandler(pivot_SelectionChanged);
     pivot.SelectionChanged                += new SelectionChangedEventHandler(pivot_SelectionChanged);
     this.previewList                       = previewList;
     previewList.SelectionChanged          -= lstOldItems_SelectionChanged;
     previewList.IsSelectionEnabledChanged -= lstOldItems_IsSelectionEnabledChanged;
     previewList.SelectionChanged          += lstOldItems_SelectionChanged;
     previewList.IsSelectionEnabledChanged += lstOldItems_IsSelectionEnabledChanged;
     this.headerOldTrainingDate             = headerOldTrainingDate;
     this.ShowOldTraining                   = ShowOldTraining;
 }
Ejemplo n.º 7
0
        private void lstAccounts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MultiselectList          target = (MultiselectList)sender;
            ApplicationBarIconButton i      = (ApplicationBarIconButton)ApplicationBar.Buttons[0];

            if (target.IsSelectionEnabled)
            {
                if (target.SelectedItems.Count > 0)
                {
                    i.IsEnabled = true;
                }
                else
                {
                    i.IsEnabled = false;
                }
            }
            else
            {
                i.IsEnabled = true;
            }
        }
        private void lstOldItems_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MultiselectList target = (MultiselectList)sender;

            if (ApplicationBar.Buttons.Count == 0)
            {
                return;
            }
            ApplicationBarIconButton btnCopy = (ApplicationBarIconButton)ApplicationBar.Buttons[0];

            if (target.IsSelectionEnabled)
            {
                if (target.SelectedItems.Count > 0)
                {
                    btnCopy.IsEnabled = true;
                }
                else
                {
                    btnCopy.IsEnabled = false;
                }
            }
        }
        private void EmailList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MultiselectList          target = (MultiselectList)sender;
            ApplicationBarIconButton i      = (ApplicationBarIconButton)ApplicationBar.Buttons[0];

            if (target.IsSelectionEnabled)
            {
                ApplicationBarMenuItem j = (ApplicationBarMenuItem)ApplicationBar.MenuItems[0];
                ApplicationBarMenuItem k = (ApplicationBarMenuItem)ApplicationBar.MenuItems[1];

                if (target.SelectedItems.Count > 0)
                {
                    i.IsEnabled = j.IsEnabled = k.IsEnabled = true;
                }
                else
                {
                    i.IsEnabled = j.IsEnabled = k.IsEnabled = false;
                }
            }
            else
            {
                i.IsEnabled = true;
            }
        }
Ejemplo n.º 10
0
        private void OnListLoaded(object sender, EventArgs args)
        {
            MultiselectList activeListBox = (MultiselectList)sender; //set the IsSelectionEnabled = true on the first list. Don't know why but if set it in XAML an error is thrown.

            activeListBox.IsSelectionEnabled = true;
        }
Ejemplo n.º 11
0
        private void OnSpamIconButtonClick(object sender, EventArgs e)
        {
            MultiselectList activeListBox = FindActiveListBox();

            BatchSpamComments(activeListBox.SelectedItems);
        }