当前位置: 首页>>代码示例>>C#>>正文


C# ListCollectionView.Refresh方法代码示例

本文整理汇总了C#中System.Windows.Data.ListCollectionView.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# ListCollectionView.Refresh方法的具体用法?C# ListCollectionView.Refresh怎么用?C# ListCollectionView.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Data.ListCollectionView的用法示例。


在下文中一共展示了ListCollectionView.Refresh方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogicalTreeViewModel

 /// <summary>
 /// Initializes a new instance of the <see cref="VisualTreeViewModel"/> class.
 /// </summary>
 public LogicalTreeViewModel()
 {
     _selectedTreeItemService = ServiceLocator.Resolve<SelectedTreeItemService>();
     var treeElementService = ServiceLocator.Resolve<LogicalTreeService>();
     Elements = new ListCollectionView(treeElementService.Elements);
     Elements.CurrentChanged += CurrentElementChanged;
     treeElementService.ElementsChanged += (s, e) => Elements.Refresh();
 }
开发者ID:bdurrani,项目名称:WPF-Inspector,代码行数:11,代码来源:LogicalTreeViewModel.cs

示例2: ResourcesViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="ResourcesViewModel"/> class.
        /// </summary>
        public ResourcesViewModel()
        {
            var selectedObjectService = ServiceLocator.Resolve<SelectedTreeItemService>();
            selectedObjectService.SelectedTreeItemChanged += OnSelectedObjectChanged;

            var resourcesService = ServiceLocator.Resolve<ResourcesService>();
            var resources = new ListCollectionView(resourcesService.ResourceItems);
            resources.CustomSort = new ResourceComparer();
            resources.Filter = ResourceFilter;
            Resources = resources;
            resourcesService.ResourcesListChanged += (s, e) => resources.Refresh();

            _updateTrigger.UpdateAction = () => resourcesService.UpdateResourceList(_selectedTreeItem);
        }
开发者ID:bdurrani,项目名称:WPF-Inspector,代码行数:17,代码来源:ResourcesViewModel.cs

示例3: CharItemData

        //-------------------------------------------------------------------------------
        public CharItemData(string path)
        {
            ReadSkillCastTimes();
            ReadItemsData(path);
            attribList.Clear();
            NonLocalMods.Clear();
            AttribCollectionView = new ListCollectionView(attribList);
            SetAttributes();

            PropertyGroupDescription pgd = new PropertyGroupDescription("Group");
            AttribCollectionView.GroupDescriptions.Add(pgd);
            AttribCollectionView.CustomSort = new NumberLessStringComparer();

            AttribCollectionView.Refresh();
        }
开发者ID:sebflex,项目名称:build-optimizer,代码行数:16,代码来源:CharItemData.cs

示例4: EventsViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="EventsViewModel"/> class.
        /// </summary>
        public EventsViewModel()
        {
            var selectedTreeItemService = ServiceLocator.Resolve<SelectedTreeItemService>();
            selectedTreeItemService.SelectedTreeItemChanged += OnSelectedTreeItemChanged;

            _eventTrackingService = ServiceLocator.Resolve<RoutedEventTrackingService>();

            // Event Handlers
            EventHandlers = new ListCollectionView(_eventTrackingService.RoutedEvents);
            EventHandlers.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            EventHandlers.GroupDescriptions.Add(new PropertyGroupDescription("Type"));
            _eventTrackingService.EventHandlersChanged += (s, e) => EventHandlers.Refresh();

            // Events
            Events = new ListCollectionView(_eventTrackingService.EventItems);
            _eventTrackingService.EventsChanged += (s, e) => Events.Refresh();

            _updateTrigger.UpdateAction = () => _eventTrackingService.UpdateRoutedEvents(_selectedTreeItem);
        }
开发者ID:bdurrani,项目名称:WPF-Inspector,代码行数:22,代码来源:EventsViewModel.cs

示例5: ItemAttributes


//.........这里部分代码省略.........
                }
                if (id == "Offhand")
                {
                    AddItem(jobj, Item.ItemClass.OffHand);
                }
                if (id == "Helm")
                {
                    AddItem(jobj, Item.ItemClass.Helm);
                }
                if (id == "Boots")
                {
                    AddItem(jobj, Item.ItemClass.Boots);
                }
                if (id == "Amulet")
                {
                    AddItem(jobj, Item.ItemClass.Amulet);
                }
                if (id == "Belt")
                {
                    AddItem(jobj, Item.ItemClass.Belt);
                }
            }

            #endregion

            aList.Clear();
            NonLocalMods.Clear();
            Attributes = new ListCollectionView(aList);
            foreach (Item item in Equip)
            {
                foreach (var attr in item.Attributes)
                {
                    if (attr.Key == "Quality: #") continue;
                    aList.Add(new Attribute(attr.Key, attr.Value, item.Class.ToString()));
                }

                foreach (ItemMod mod in item.Mods)
                {
                    Attribute attTo = null;
                    attTo =
                        aList.Find(
                            ad =>
                                ad.TextAttribute == mod.Attribute &&
                                ad.Group == (mod.isLocal ? item.Class.ToString() : "Independent"));
                    if (attTo == null)
                    {
                        aList.Add(new Attribute(mod.Attribute, mod.Value,
                            (mod.isLocal ? item.Class.ToString() : "Independent")));
                    }
                    else
                    {
                        attTo.Add(mod.Attribute, mod.Value);
                    }
                }

                foreach (var attr in item.Attributes)
                {
                    if (attr.Key == "Quality: +#%") continue;
                    if (attr.Key == "Attacks per Second: #") continue;
                    if (attr.Key == "Critical Strike Chance: #%") continue;
                    if (attr.Key.ToLower().Contains("damage")) continue;
                    if (attr.Key.Contains("Weapon Class")) continue;
                    if (attr.Key.Contains("Elemental Damage")) continue;
                    Attribute attTo = null;
                    attTo = NonLocalMods.Find(ad => ad.TextAttribute == attr.Key);
                    if (attTo == null)
                    {
                        NonLocalMods.Add(new Attribute(attr.Key, attr.Value, ""));
                    }
                    else
                    {
                        attTo.Add(attr.Key, attr.Value);
                    }
                }

                foreach (ItemMod mod in item.Mods)
                {
                    if (mod.isLocal) continue;
                    Attribute attTo = null;
                    attTo = NonLocalMods.Find(ad => ad.TextAttribute == mod.Attribute);
                    if (attTo == null)
                    {
                        NonLocalMods.Add(new Attribute(mod.Attribute, mod.Value, ""));
                    }
                    else
                    {
                        attTo.Add(mod.Attribute, mod.Value);
                    }
                }
            }

            var pgd = new PropertyGroupDescription("");
            pgd.PropertyName = "Group";
            Attributes.GroupDescriptions.Add(pgd);
            Attributes.CustomSort = new NumberLessStringComparer();

            var itemsBinding = new Binding();

            Attributes.Refresh();
        }
开发者ID:RabidCicada,项目名称:PoESkillTree,代码行数:101,代码来源:ItemAttributes.cs

示例6: KStudioService

        public KStudioService()
        {
            DebugHelper.AssertUIThread();

            KStudio.KStudioObjectInitializer = ObjectInitializer;

            this.settings = new KStudioServiceSettings();
            this.settings.PropertyChanged += (source, e) =>
            {
                if ((e != null) && (e.PropertyName == "AdvancedModeObscureStreams"))
                {
                    this.RaisePropertyChanged("TargetMonitorableStreamsTitle");
                    this.RaisePropertyChanged("TargetMonitorableStreamsToolTip");
                    this.RaisePropertyChanged("TargetRecordableStreamsTitle");
                    this.RaisePropertyChanged("TargetRecordableStreamsToolTip");
                    this.RaisePropertyChanged("PlaybackableStreamsTitle");
                    this.RaisePropertyChanged("PlaybackableStreamsToolTip");
                }
            };

            this.monitorTimer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromMilliseconds(250),
            };
            this.monitorTimer.Tick += MonitorTimer_Tick;

            this.targetAddress = IPAddress.Loopback;
            this.targetAlias = Environment.MachineName;

            this.client = KStudio.CreateClient(KStudioClientFlags.ProcessNotifications);
            this.client.PropertyChanged += this.Client_PropertyChanged;
            this.client.EventDataAvailable += this.Client_EventDataAvailable;

            // recordable streams

            ListCollectionView targetRecordableStreams = new ListCollectionView(client.EventStreams);
            targetRecordableStreams.Filter = (object item) =>
            {
                KStudioEventStream stream = item as KStudioEventStream;
                Debug.Assert(stream != null);

                return stream.IsRecordable && stream.IsFromService;
            };
            targetRecordableStreams.SortDescriptions.Clear();
            targetRecordableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
            targetRecordableStreams.Refresh();

            this.targetRecordableStreams = targetRecordableStreams;

            // playbackable streams

            ListCollectionView targetPlaybackableStreams = new ListCollectionView(client.EventStreams);
            targetPlaybackableStreams.Filter = (object item) =>
            {
                KStudioEventStream stream = item as KStudioEventStream;
                Debug.Assert(stream != null);

                return stream.IsPlaybackable && stream.IsFromService;
            };
            targetPlaybackableStreams.SortDescriptions.Clear();
            targetPlaybackableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
            targetPlaybackableStreams.Refresh();

            this.targetPlaybackableStreams = targetPlaybackableStreams;

            // monitorable streams

            ListCollectionView targetMonitorableStreams = new ListCollectionView(client.EventStreams);
            targetMonitorableStreams.Filter = (object item) =>
            {
                KStudioEventStream stream = item as KStudioEventStream;
                Debug.Assert(stream != null);

                return stream.IsMonitor && stream.IsFromService;
            };
            targetMonitorableStreams.SortDescriptions.Clear();
            targetMonitorableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
            targetMonitorableStreams.Refresh();

            this.targetMonitorableStreams = targetMonitorableStreams;
        }
开发者ID:UnaNancyOwen,项目名称:Kinect-Studio-Sample,代码行数:81,代码来源:KStudioService.cs

示例7: RefreshItemAttributes

        private void RefreshItemAttributes()
        {
            NonLocalMods = (from item in Equip
                            from mod in SelectNonLocalMods(item)
                            group mod by mod.Attribute into modsForAttr
                            select modsForAttr.Aggregate((m1, m2) => m1.Sum(m2))
                           ).ToList();
            var aList = new List<Attribute>();
            var independent = new List<Attribute>();
            foreach (var item in Equip)
            {
                LoadItemAttributes(item, aList, independent);
            }
            aList.AddRange(independent);
            Attributes = new ListCollectionView(aList);

            var pgd = new PropertyGroupDescription("Group", new HeaderConverter());
            Attributes.GroupDescriptions.Add(pgd);

            Attributes.Refresh();
        }
开发者ID:mihailim,项目名称:PoESkillTree,代码行数:21,代码来源:ItemAttributes.cs

示例8: RefreshItemAttributes

        private void RefreshItemAttributes()
        {
            aList.Clear();
            NonLocalMods.Clear();
            Attributes = new ListCollectionView(aList);
            foreach (Item item in Equip)
            {
                LoadItem(item, aList, NonLocalMods);
            }

            var pgd = new PropertyGroupDescription("");
            pgd.PropertyName = "Group";
            Attributes.GroupDescriptions.Add(pgd);
            Attributes.CustomSort = new NumberLessStringComparer();

            Attributes.Refresh();
        }
开发者ID:Bovanos,项目名称:PoESkillTree,代码行数:17,代码来源:ItemAttributes.cs

示例9: SetupForPlayback

        public void SetupForPlayback(ReadOnlyObservableCollection<KStudioEventStream> clientEventStreams)
        {
            DebugHelper.AssertUIThread();

            if ((this.livePlaybackStreams == null) && (clientEventStreams != null))
            {
                ListCollectionView targetPlaybackableStreams = new ListCollectionView(clientEventStreams);
                targetPlaybackableStreams.Filter = (object item) =>
                    {
                        KStudioEventStream s = item as KStudioEventStream;
                        Debug.Assert(s != null);

                        return s.IsPlaybackable && s.IsFromService && (s.DataTypeId == this.stream.DataTypeId);
                    };
                targetPlaybackableStreams.SortDescriptions.Clear();
                targetPlaybackableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
                targetPlaybackableStreams.Refresh();

                this.livePlaybackStreams = targetPlaybackableStreams;
                this.RaisePropertyChanged("LivePlaybackStreams");
            }
        }
开发者ID:UnaNancyOwen,项目名称:Kinect-Studio-Sample,代码行数:22,代码来源:EventStreamState.cs

示例10: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            this.SourceInitialized += new EventHandler(MainWindow_SourceInitialized);

            SlideFade.StartAnimationIn(this);

            view = new ListCollectionView(App.Instance.OpenChats);
            view.SortDescriptions.Add(new System.ComponentModel.SortDescription("LastMessage", System.ComponentModel.ListSortDirection.Descending));
            view.SortDescriptions.Add(new System.ComponentModel.SortDescription("NewMessages", System.ComponentModel.ListSortDirection.Descending));
            view.SortDescriptions.Add(new System.ComponentModel.SortDescription("NickName", System.ComponentModel.ListSortDirection.Ascending));
            view.Refresh();

            this.listbox1.ItemsSource = view;
            //listbox1.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("NewMessages", System.ComponentModel.ListSortDirection.Descending));
            //listbox1.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("NickName", System.ComponentModel.ListSortDirection.Ascending));

            dialog = new Microsoft.Win32.OpenFileDialog();
            dialog.Filter = "Image Files|*.png;*.jpg;*.bmp;*.jpeg";
            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            dialog.FileOk += new CancelEventHandler(dialog_FileOk);

            try
            {
                int Width = Convert.ToInt32(ConfigManager.Instance.GetString("WndWidth", this.Width.ToString()));
                int Height = Convert.ToInt32(ConfigManager.Instance.GetString("WndHeight", this.Height.ToString()));

                if (Width >= SystemParameters.WorkArea.Width || Height >= SystemParameters.WorkArea.Height)
                    return;

                this.Width = Width;
                this.Height = Height;
            }
            catch { }
        }
开发者ID:astorks,项目名称:BlazeIM,代码行数:36,代码来源:MainWindow.xaml.cs

示例11: MediaFileStateCollectionView

        public MediaFileStateCollectionView(MediaFileState mediaState = null) :
            base(mediaState)
        {           
            Filter = filterFunc;
            InfoIconsCache = InfoIconsCacheStatic;

            MediaFilter = MediaFilterMode.None;           

            SortFunc = MediaFileSortFunctions.getSortFunction(MediaFileSortMode.Name);
            SortMode = MediaFileSortMode.Name;
            
            FilterModes = new ListCollectionView(Enum.GetValues(typeof(MediaFilterMode)));

            SortItemCollection<MediaFileSortItem, MediaFileSortMode> mediaFileSortItemCollection = new SortItemCollection<MediaFileSortItem,MediaFileSortMode>();
            mediaFileSortItemCollection.ItemSortDirectionChanged += mediaFileSortItemCollection_ItemSortDirectionChanged;

            foreach(MediaFileSortMode mode in Enum.GetValues(typeof(MediaFileSortMode))) {

                mediaFileSortItemCollection.Add(new MediaFileSortItem(mode));
            }

            SortModes = new ListCollectionView(mediaFileSortItemCollection);
         
            SortModes.CurrentChanged += (s, e) =>
            {
                MediaFileSortItem sortItem = (MediaFileSortItem)SortModes.CurrentItem;

                SortMode = sortItem.SortMode;
                SortDirection = sortItem.SortDirection;

                SortFunc = MediaFileSortFunctions.getSortFunction(SortMode);

                refresh();
            };

            SortModes.Filter = mediaStateSortModeCollectionViewFilter;

            FilterModes.CurrentChanged += (s, e) =>
            {
                MediaFilter = (MediaFilterMode)FilterModes.CurrentItem;
                              
                SortModes.Refresh();

                bool isRefreshed = false;

                switch (MediaFilter)
                {
                    case MediaFilterMode.None:
                        if (!MediaFileSortFunctions.isAllSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    case MediaFilterMode.Video:
                        if (!MediaFileSortFunctions.isVideoSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    case MediaFilterMode.Images:
                        if (!MediaFileSortFunctions.isImageSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    case MediaFilterMode.Audio:
                        if (!MediaFileSortFunctions.isAudioSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    default:
                        break;
                }

                if (!isRefreshed)
                {
                    refresh();
                }
       
            };
                                    
            FilterModes.MoveCurrentTo(MediaFilterMode.None);
            
        }
开发者ID:iejeecee,项目名称:mediaviewer,代码行数:89,代码来源:MediaFileStateCollectionView.cs


注:本文中的System.Windows.Data.ListCollectionView.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。