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


C# ReadOnlyObservableCollection类代码示例

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


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


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