本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}) ;
}
示例8: DesktopStartMenuContext
private DesktopStartMenuContext()
{
IsApplicationActive = true;
Entries = _programsModel.Entry.Childs;
SidePanelEntries = new ReadOnlyObservableCollection<StartPanelEntry>(_sidePanelEntries);
}
示例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);
}
示例10: StorageServicesAdapter
public StorageServicesAdapter(PortableDevice device)
{
this.device = device;
portableDeviceClass = device.PortableDeviceClass;
storages = new ObservableCollection<PortableDeviceFunctionalObject>(ExtractStorageServices());
Storages = new ReadOnlyObservableCollection<PortableDeviceFunctionalObject>(storages);
}
示例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));
}
}
示例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;
}
示例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();
}
示例14: NotificationInfoContainer
public NotificationInfoContainer(PlatformClient client, bool isReadedItemOnly)
: base(client)
{
_isReadedItemOnly = isReadedItemOnly;
_notifications = new ObservableCollection<NotificationInfo>();
Notifications = new ReadOnlyObservableCollection<NotificationInfo>(_notifications);
}
示例15: ChatRoom
public ChatRoom(ChatServerImpl server)
{
_server = server;
_users = new ObservableCollection<IChatUser>();
Users = new ReadOnlyObservableCollection<IChatUser>(_users);
RoomId = Guid.NewGuid().ToString("N");
}