Exemplo n.º 1
0
 private void RemoveBarItem(CatalogItemModel item)
 {
     if (BarItems.Contains(item))
     {
         BarItems.Remove(item);
     }
 }
Exemplo n.º 2
0
 private void AddBarItem(CatalogItemModel item)
 {
     if (!BarItems.Contains(item))
     {
         BarItems.Add(item);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BarLinksCollectionUIAdapter"/> class.
        /// </summary>
        /// <param name="linkCollection"></param>
        /// <param name="itemCollection"></param>
        public BarLinksCollectionUIAdapter(BarItemLinkCollection linkCollection, BarItems itemCollection)
        {
            Guard.ArgumentNotNull(itemCollection, "BarItems");
            this.itemCollection = itemCollection;

            Guard.ArgumentNotNull(linkCollection, "BarItemLinkCollection");
            this.linkCollection = linkCollection;
        }
Exemplo n.º 4
0
 internal MenuItemCollection(BarItems items, IMenuIndex menuIndex) :
     base(items, menuIndex)
 {
     _items = items;
     if (items == null)
     {
         throw new NullReferenceException("Bar items reference is null.");
     }
 }
Exemplo n.º 5
0
 private void SetBarItemEnabled(Dictionary <string, bool> dictionary, BarItems barItems)
 {
     foreach (BarItem barItem in barItems)
     {
         if (barItem.Tag != null)
         {
             string text = barItem.Tag.ToString();
             if (!string.IsNullOrWhiteSpace(text) && dictionary.ContainsKey(text))
             {
                 barItem.Enabled = dictionary[text];
             }
         }
     }
 }
Exemplo n.º 6
0
        public void SetupForBgUnderForm(bool isEnable)
        {
            if (this.lControl != null)
            {
                int index = 0;
                foreach (Object obj in lControl)
                {
                    List <bool> status = new List <bool>();

                    if (obj is Control)
                    {
                        if (!isEnable)
                        {
                            status.Add((obj as Control).Enabled);
                            (obj as Control).Enabled = isEnable;
                        }
                        else
                        {
                            (obj as Control).Enabled = statusControl[index][0];
                        }
                    }
                    else if (obj is BarManager)
                    {
                        int      col   = 0;
                        BarItems items = (obj as BarManager).Items;
                        foreach (BarItem item in items)
                        {
                            if (!isEnable)
                            {
                                status.Add(item.Enabled);
                                item.Enabled = isEnable;
                            }
                            else
                            {
                                item.Enabled = statusControl[index][col];
                            }
                            col++;
                        }
                    }

                    statusControl.Add(status);

                    index++;
                }
            }
        }
Exemplo n.º 7
0
        private async void OnDelete()
        {
            // MP! fixme: not yet implemented
            //ShellViewModel.Current.EnableView(false);

            bool?result = await _userNotificationService.ConfirmationDialogAsync("Confirm Delete", "Ok", "Cancel");

            //if (await DialogBox.ShowAsync("Confirm Delete", "Are you sure you want to delete selected items?", "Ok", "Cancel"))

            if (result == true)
            {
                _cancelOnSelectionChanged = true;
                try
                {
                    var selectedItems = Items.Where(r => r.IsSelected).ToArray();
                    foreach (var item in selectedItems)
                    {
                        await DataProvider.DeleteItemAsync(item);

                        Items.Remove(item);
                        BarItems.Remove(item);
                    }
                    SelectionMode = ListViewSelectionMode.None;
                    Mode          = GridCommandBarMode.Idle;

                    if (selectedItems.Length == 1)
                    {
                        var item = selectedItems[0];
                        // MP! fixme: not yet implemented
                        //ToastNotificationsService.Current.ShowToastNotification(Constants.NotificationDeletedItemTitleKey.GetLocalized(), item);
                    }
                }
                catch (Exception ex)
                {
                    //await DialogBox.ShowAsync("Error deleting files", ex);
                    await _userNotificationService.MessageDialogAsync("Error deleting files:", ex.Message);
                }
                _cancelOnSelectionChanged = false;
            }
            // MP! fixme: not yet implemented
            //ShellViewModel.Current.EnableView(true);

            IsCommandBarOpen = false;
            UpdateCommandBar();
        }
Exemplo n.º 8
0
        public void UpdateExternalSelection()
        {
            _cancelOnSelectionChanged = true;

            if (Items != null)
            {
                BarItems.Clear();
                foreach (var item in Items.Where(r => r.IsSelected))
                {
                    BarItems.Add(item);
                }

                int selectedCount = Items.Count(r => r.IsSelected);
                if (selectedCount > 0)
                {
                    // Set SelectionMode = Multiple before selecting items
                    SelectionMode = ListViewSelectionMode.Multiple;
                    if (selectedCount < Items.Count)
                    {
                        foreach (var item in Items)
                        {
                            if (ItemsControl.ContainerFromItem(item) is GridViewItem container)
                            {
                                container.IsSelected = item.IsSelected;
                            }
                        }
                    }
                    else
                    {
                        SelecteAll();
                    }
                }
                else
                {
                    Mode = GridCommandBarMode.Idle;
                    DeselectAll();
                }
                UpdateCommandBar();
            }

            _cancelOnSelectionChanged = false;
        }
Exemplo n.º 9
0
        public override void Dispose()
        {
            base.Dispose();

            BarItems?.ForEach(bBT => bBT.Dispose());
        }
 public BarLinksCollectionDynamicUIAdapter(BarItemLinkCollection linkCollection,
                                           BarItems itemCollection, WorkItem rootWorkItem)
     : base(linkCollection, itemCollection)
 {
     this.rootWorkItem = rootWorkItem;
 }
 public BarLinksCollectionDynamicUIAdapter(BarItemLinkCollection linkCollection,
     BarItems itemCollection, WorkItem rootWorkItem)
     : base(linkCollection, itemCollection)
 {
     this.rootWorkItem = rootWorkItem;
 }