• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ReadOnlyObservableCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ReadOnlyObservableCollection的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyObservableCollection类的具体用法?C# ReadOnlyObservableCollection怎么用?C# ReadOnlyObservableCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReadOnlyObservableCollection类属于命名空间,在下文中一共展示了ReadOnlyObservableCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RecipesViewModel

        public RecipesViewModel()
        {
            // initialize commands
            m_addNewRecipeCommand = new RelayCommand(AddNewRecipe);
            m_deleteRecipeCommand = new RelayCommand<RecipeDataModel>(DeleteRecipe);
            m_addHopsIngredientToRecipeCommand = new RelayCommand<Hops>(AddHopsIngredient);
            m_addFermentableIngredientToRecipeCommand = new RelayCommand<Fermentable>(AddFermentableIngredient);
            m_changeYeastCommand = new RelayCommand<Yeast>(ChangeYeast);
            m_deleteHopsIngredientCommand = new RelayCommand<IHopsIngredient>(DeleteHopsIngredient);
            m_deleteFermentableIngredientCommand = new RelayCommand<IFermentableIngredient>(DeleteFermentableIngredient);

            // get available ingredients
            List<IngredientTypeBase> allAvailableIngredients = RecipeUtility.GetAvailableIngredients().OrderBy(ingredient => ingredient.Name).ToList();
            m_availableHops = allAvailableIngredients.OfType<Hops>().ToReadOnlyObservableCollection();
            m_availableFermentables = allAvailableIngredients.OfType<Fermentable>().ToReadOnlyObservableCollection();
            m_availableYeasts = allAvailableIngredients.OfType<Yeast>().ToReadOnlyObservableCollection();

            List<Style> beerStyles = RecipeUtility.GetAvailableBeerStyles().OrderBy(style => style.Name).ToList();
            m_availableBeerStyles = beerStyles.ToReadOnlyObservableCollection();
            m_savedRecipes = new ObservableCollection<RecipeDataModel>(RecipeUtility.GetSavedRecipes(beerStyles));

            GetSettings();

            // set the current recipe to the first in the collection
            CurrentRecipe = m_savedRecipes.FirstOrDefault();
        }
开发者ID:jlafshari,项目名称:Homebrewing,代码行数:26,代码来源:RecipesViewModel.cs


示例2: UserVM

 public UserVM(User user, bool innerAvatarOnly)
 {
     Model = user;
       avatar = new AvatarVM(user.Avatar, innerAvatarOnly);
       commands = new ObservableCollection<MenuCommand>();
       Commands = new ReadOnlyObservableCollection<MenuCommand>(commands);
 }
开发者ID:sunoru,项目名称:PBO,代码行数:7,代码来源:UserVM.cs


示例3: UserRateListViewModel

 public UserRateListViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher, BaseEntityDTO entity)
     : base(userInterop, controllerInterop, dispatcher)
 {
     this.entity = entity;
     rates = new ObservableCollection<UserRateItemDTO>();
     Rates = new ReadOnlyObservableCollection<UserRateItemDTO>(rates);
 }
开发者ID:ZuTa,项目名称:StudyingController,代码行数:7,代码来源:UserRateListViewModel.cs


示例4: MainWindowViewModel

 public MainWindowViewModel(
     IAssigmentsCache assigmentsCache, 
     ITagsCache tagsCache,
     IAddAssigmentService addAssigmentService,
     Func<IAssigment, IAssigmentViewModel> assigmentViewModelFactory,
     Func<ITag, ISelectableTagViewModel> tagViewModelFactory)
 {
     ApplicationTitle = "ToDo";
     Assigments = new ReadOnlyObservableCollection<IAssigmentViewModel>(_assigments);
     AvalibleTags = new ReadOnlyObservableCollection<ISelectableTagViewModel>(_avalibleTags);
     AddAssigment = new AddAssigmentCommand(this);
     _addAssigmentService = addAssigmentService;
     _assigmentViewModelFactory = assigmentViewModelFactory;
     _tagViewModelFactory = tagViewModelFactory;
     foreach (var assigment in assigmentsCache.Items)
     {
         _assigments.Add(assigmentViewModelFactory(assigment));
     }
     assigmentsCache.AssimentAdded += OnAssimentAdded;
     foreach (var tag in tagsCache.Items)
     {
         _avalibleTags.Add(_tagViewModelFactory(tag));
     }
     tagsCache.TagAdded += OnTagAdded;
 }
开发者ID:holyslon,项目名称:ToDotNext,代码行数:25,代码来源:MainWindowViewModel.cs


示例5: Select_ReadOnlyObservableCollection_InputContentsMatchOutputContents

 public void Select_ReadOnlyObservableCollection_InputContentsMatchOutputContents()
 {
     var readOnlySource = new ReadOnlyObservableCollection<Person>(_source);
     ReadOnlyContinuousCollection<Person> output = from person in readOnlySource
                                                   select person;
     Assert.AreEqual(readOnlySource, output);
 }
开发者ID:ismell,项目名称:Continuous-LINQ,代码行数:7,代码来源:SelectTest.cs


示例6: SessionsViewModel

        public SessionsViewModel()
        {
            r_Sessions = new ObservableCollection<Session>();
            Sessions = new ReadOnlyObservableCollection<Session>(r_Sessions);

            KanColleGame.Current.Proxy.NewSession += r => DispatcherUtil.UIDispatcher.BeginInvoke(new Action<Session>(r_Sessions.Add), r);
        }
开发者ID:XHidamariSketchX,项目名称:ProjectDentan,代码行数:7,代码来源:SessionsViewModel.cs


示例7: RecentFilesViewModel

        public RecentFilesViewModel(IRecentFileCollection recentFileCollection, ISchedulerProvider schedulerProvider)
        {
            _recentFileCollection = recentFileCollection;
            if (recentFileCollection == null) throw new ArgumentNullException(nameof(recentFileCollection));
            if (schedulerProvider == null) throw new ArgumentNullException(nameof(schedulerProvider));
            
            ReadOnlyObservableCollection<RecentFileProxy> data;
            var recentLoader = recentFileCollection.Items
                .Connect()
                .Transform(rf => new RecentFileProxy(rf, toOpen =>
                                                            {
                                                                _fileOpenRequest.OnNext(new FileInfo(toOpen.Name));
                                                            },
                                                            recentFileCollection.Remove))
                .Sort(SortExpressionComparer<RecentFileProxy>.Descending(proxy => proxy.Timestamp))
                .ObserveOn(schedulerProvider.MainThread)
                .Bind(out data)
                .Subscribe();

            Files = data;

            _cleanUp = Disposable.Create(() =>
            {
                recentLoader.Dispose();
                _fileOpenRequest.OnCompleted();
            }) ;
        }
开发者ID:ckarcz,项目名称:TailBlazer,代码行数:27,代码来源:RecentFilesViewModel.cs


示例8: DesktopStartMenuContext

        private DesktopStartMenuContext()
        {
            IsApplicationActive = true;
            Entries = _programsModel.Entry.Childs;

            SidePanelEntries = new ReadOnlyObservableCollection<StartPanelEntry>(_sidePanelEntries);
        }
开发者ID:4kingRAS,项目名称:DesktopStartMenu,代码行数:7,代码来源:DesktopStartMenuContext.cs


示例9: FilterRulePanelController

 /// <summary>
 /// Initializes a new instance of the FilterRulePanelController class.
 /// </summary>
 public FilterRulePanelController()
 {
     this.filterRulePanelItems = 
         new ObservableCollection<FilterRulePanelItem>();
     this.readOnlyFilterRulePanelItems = 
         new ReadOnlyObservableCollection<FilterRulePanelItem>(this.filterRulePanelItems);
 }
开发者ID:40a,项目名称:PowerShell,代码行数:10,代码来源:FilterRulePanelController.cs


示例10: StorageServicesAdapter

 public StorageServicesAdapter(PortableDevice device)
 {
     this.device = device;
     portableDeviceClass = device.PortableDeviceClass;
     storages = new ObservableCollection<PortableDeviceFunctionalObject>(ExtractStorageServices());
     Storages = new ReadOnlyObservableCollection<PortableDeviceFunctionalObject>(storages);
 }
开发者ID:naixx,项目名称:PortableDeviceLib,代码行数:7,代码来源:StorageServicesAdapter.cs


示例11: SerializationViewModel

        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="modelTreeView">Diagram tree view.</param>
        public SerializationViewModel(ViewModelStore viewModelStore, SerializationModel serializationModel)
            : base(viewModelStore)
        {
            this.allVMs = new ObservableCollection<SerializedDomainModelViewModel>();
            this.serializationModel = serializationModel;
            this.selectedVMS = new Collection<object>();

            this.rootVMs = new ObservableCollection<SerializedDomainModelViewModel>();
            this.rootVMsRO = new ReadOnlyObservableCollection<SerializedDomainModelViewModel>(this.rootVMs);

            this.selectRelationshipCommand = new DelegateCommand(SelectRelationshipCommand_Executed);
            this.moveUpCommand = new DelegateCommand(MoveUpCommand_Executed, MoveUpCommand_CanExecute);
            this.moveDownCommand = new DelegateCommand(MoveDownCommand_Executed, MoveDownCommand_CanExecute);

            if (this.serializationModel.SerializedDomainModel != null)
            {
                this.rootVMs.Add(new SerializedDomainModelViewModel(this.ViewModelStore, this.serializationModel.SerializedDomainModel));
            }
            if (this.serializationModel != null)
            {
                foreach (SerializationClass c in this.serializationModel.Children)
                    if (c is SerializedDomainClass)
                        this.AddChild(c as SerializedDomainClass);

                this.EventManager.GetEvent<ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationModelHasChildren.DomainClassId),
                    true, this.serializationModel.Id, new System.Action<ElementAddedEventArgs>(OnChildAdded));
                this.EventManager.GetEvent<ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationModelHasChildren.DomainClassId),
                    true, this.serializationModel.Id, new System.Action<ElementDeletedEventArgs>(OnChildRemoved));
                
            }
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:36,代码来源:SerializationViewModel.cs


示例12: MiniMapWindow

        public MiniMapWindow(Route route, Region region)
        {
            InitializeComponent();
            Region = region;

            var waypoints = new List<Waypoint>();
            var connections = new List<Connection>();

            foreach (var conn in route.Path)
            {
                if (conn.Source.Region == region)
                    waypoints.Add(conn.Source);

                if (conn.Target.Region == region)
                    waypoints.Add(conn.Target);

                if (conn.Source.Region == region && conn.Target.Region == region)
                    connections.Add(conn);
            }

            Waypoints = new ReadOnlyObservableCollection<Waypoint>(new ObservableCollection<Waypoint>(waypoints));
            Connections = new ReadOnlyObservableCollection<Connection>(new ObservableCollection<Connection>(connections));

            DataContext = this;
        }
开发者ID:Garfield-Chen,项目名称:mabicommerce,代码行数:25,代码来源:MiniMapWindow.xaml.cs


示例13: MainWindowViewModel

        public MainWindowViewModel() {
            Pokemons = new ReadOnlyObservableCollection<SniperInfoModel>(GlobalVariables.PokemonsInternal);
            SettingsComand = new ActionCommand(ShowSettings);
            StartStopCommand = new ActionCommand(Startstop);
            DebugComand = new ActionCommand(ShowDebug);

            Settings.Default.DebugOutput = "Debug stuff in here!";
            //var poke = new SniperInfo {
            //    Id = PokemonId.Missingno,
            //    Latitude = 45.99999,
            //    Longitude = 66.6677,
            //    ExpirationTimestamp = DateTime.Now
            //};
            //var y = new SniperInfoModel {
            //    Info = poke,
            //    Icon = new BitmapImage(new Uri(Path.Combine(iconPath, $"{(int) poke.Id}.png")))
            //};
            //GlobalVariables.PokemonsInternal.Add(y);

            GlobalSettings.Output = new Output();
            Program p = new Program();
            Thread a = new Thread(p.Start) { IsBackground = true};
            //Start(); p
            a.Start();
        }
开发者ID:XFirstlight,项目名称:PogoLocationFeeder,代码行数:25,代码来源:MainWindowViewModel.cs


示例14: NotificationInfoContainer

 public NotificationInfoContainer(PlatformClient client, bool isReadedItemOnly)
     : base(client)
 {
     _isReadedItemOnly = isReadedItemOnly;
     _notifications = new ObservableCollection<NotificationInfo>();
     Notifications = new ReadOnlyObservableCollection<NotificationInfo>(_notifications);
 }
开发者ID:namoshika,项目名称:SnkLib.Web.GooglePlus,代码行数:7,代码来源:NotificationInfoContainer.cs


示例15: ChatRoom

 public ChatRoom(ChatServerImpl server)
 {
     _server = server;
     _users = new ObservableCollection<IChatUser>();
     Users = new ReadOnlyObservableCollection<IChatUser>(_users);
     RoomId = Guid.NewGuid().ToString("N");
 }
开发者ID:christal1980,项目名称:wingsoa,代码行数:7,代码来源:ChatRoom.cs


示例16: Message

 public Message()
 {
     textCollection = new ObservableCollection<string>();
     keyCollection = new ObservableCollection<KeyPress>();
     Text = new ReadOnlyObservableCollection<string>(textCollection);
     Keys = new ReadOnlyObservableCollection<KeyPress>(keyCollection);
 }
开发者ID:redreamality,项目名称:carnac,代码行数:7,代码来源:Message.cs


示例17: SelectProviderPage

        public SelectProviderPage()
        {
            InitializeComponent();
            DataContext = this;

            readonlyChildren = new ReadOnlyObservableCollection<IWizardPage>(children);

            // Register to self so that we can handler user interactions.
            PropertyChanged += PropertyChangedHandler;

            providerManager = ServiceLocator.Instance.Get<IProviderManager>();
            if (providerManager != null)
            {
                foreach (var guid in providerManager)
                {
                    providers.Add(providerManager.GetInformation(guid));

                    // If any additional page, we shall cache them with the
                    // same index, so make sure the collection matches providers.
                    additionalPages.Add(null);
                }
            }

            LoggerName = "Untitled";
        }
开发者ID:Irmanster,项目名称:mngSentinel,代码行数:25,代码来源:SelectProviderPage.xaml.cs


示例18: MainSurfaceViewModel

        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        public MainSurfaceViewModel(ViewModelStore viewModelStore)
            : base(viewModelStore)
        {
            this.rootNodeVMs = new ObservableCollection<ModelContextViewModel>();
            this.rootNodeVMsRO = new ReadOnlyObservableCollection<ModelContextViewModel>(this.rootNodeVMs);

            if (this.ModelData.MetaModel != null)
            {
                foreach (BaseModelContext mc in this.ModelData.MetaModel.ModelContexts)
                    AddModelContext(mc);

                // subscribe
                this.EventManager.GetEvent<ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(MetaModelHasModelContexts.DomainClassId),
                    true, this.ModelData.MetaModel.Id, new Action<ElementAddedEventArgs>(OnModelContextAdded));

                this.EventManager.GetEvent<ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(MetaModelHasModelContexts.DomainClassId),
                    true, this.ModelData.MetaModel.Id, new Action<ElementDeletedEventArgs>(OnModelContextRemoved));

                if (this.ModelContextVMs.Count > 0)
                    this.selectedItem = this.ModelContextVMs[0];
            }


           this.EventManager.GetEvent<SelectionChangedEvent>().Subscribe(new Action<SelectionChangedEventArgs>(OnSelectionChanged));
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:29,代码来源:MainSurfaceViewModel.cs


示例19: EmbeddingDiagramNodeViewModel

        /// <summary>
        /// Constructor. This view model constructed with 'bHookUpEvents=true' does react on model changes.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="embeddingDiagramNode">Element represented by this view model.</param>
        public EmbeddingDiagramNodeViewModel(ViewModelStore viewModelStore, EmbeddingDiagramNode embeddingDiagramNode, EmbeddingDiagramNodeViewModel parent)
            : base(viewModelStore, embeddingDiagramNode)
        {
            this.parent = parent;

            this.embeddingNodeVMs = new ObservableCollection<EmbeddingDiagramNodeViewModel>();
            this.embeddingNodeVMsRO = new ReadOnlyObservableCollection<EmbeddingDiagramNodeViewModel>(this.embeddingNodeVMs);

            if (this.EmbeddingDiagramNode != null)
            {
                foreach (EmbeddingDiagramNode node in this.EmbeddingDiagramNode.EmbeddingDiagramNodes)
                    this.AddEmbeddingDiagramNode(node);

                this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.EmbeddingDiagramNode.Id, new Action<ElementPropertyChangedEventArgs>(OnElementPropertyChanged));

                this.EventManager.GetEvent<ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(EmbeddingDiagramNodeHasEmbeddingDiagramNodes.DomainClassId),
                    true, this.EmbeddingDiagramNode.Id, new Action<ElementAddedEventArgs>(OnEmbeddingDiagramNodeAdded));

                this.EventManager.GetEvent<ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(EmbeddingDiagramNodeHasEmbeddingDiagramNodes.DomainClassId),
                    true, this.EmbeddingDiagramNode.Id, new Action<ElementDeletedEventArgs>(OnEmbeddingDiagramNodeRemoved));

                this.EventManager.GetEvent<ModelRolePlayerMovedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(EmbeddingDiagramNodeHasEmbeddingDiagramNodes.DomainClassId),
                    this.EmbeddingDiagramNode.Id, new Action<RolePlayerOrderChangedEventArgs>(OnEmbeddingDiagramNodeMoved));

                this.EventManager.GetEvent<ModelRolePlayerChangedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRole(EmbeddingDiagramNodeHasEmbeddingDiagramNodes.SourceEmbeddingDiagramNodeDomainRoleId),
                    new Action<RolePlayerChangedEventArgs>(OnEmbeddingDiagramNodeChanged));
            }

            expandCollapseTreeCommand = new DelegateCommand(ExpandCollapseTreeCommand_Executed);
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:35,代码来源:EmbeddingDiagramNodeViewModel.cs


示例20: PersonEntry

        public PersonEntry(ILocationService locationService, IAddress address)
        {
            _locationService = locationService;
            _address = address;

            _roAvailableCountries = new ReadOnlyObservableCollection<ICountry>(_availableCountries);
        }
开发者ID:LeeCampbell,项目名称:DDDMVVM,代码行数:7,代码来源:PersonEntry.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ReadOnlySpan类代码示例发布时间:2022-05-24
下一篇:
C# ReadOnlyList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap