private void MenuVMStartGameRequested(object sender, StartGameEventArgs e) { _gameVM = _gameVMFactory.CreateInstance(e.Difficulty); _gameVM.GameCompleted += GameVMGameCompleted; Content = _gameVM; }
/// <summary> /// Initializes a new instance of the <see cref="PopupWindowViewModel"/> class. /// </summary> /// <param name="contentViewModel"> /// The content View Model. /// </param> /// <param name="title"> /// The title. /// </param> /// <param name="subText"> /// The sub Text. /// </param> public PopupWindowViewModel(IViewModelBase contentViewModel, string title, string subText) { this.ContentViewModel = contentViewModel; this.WindowTitle = title; this.Title = title; this.SubText = subText; }
public MainViewModel(IViewModelBase vmbase) { if (vmbase is LoginViewModel) Main.Login = (vmbase as LoginViewModel).Login; FindDevice(); }
//Create new ViewModel or select ViewModel from ViewModelList to SelectedViewModel private void ChangeViewModel(Type viewModelType) { foreach (var viewModel in ViewModelList) { if (viewModelType != viewModel.GetType()) continue; SelectedViewModel = viewModel; return; } var newViewModel = (ViewModelBase) Activator.CreateInstance(viewModelType, new ViewModelMetadata(ChangeViewModel)); ViewModelList.Add(newViewModel); SelectedViewModel = newViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="WindowViewBase"/> class. /// </summary> /// <param name="viewModel">The view model.</param> protected WindowViewBase(IViewModelBase viewModel) { if (viewModel == null) throw new ArgumentNullException("viewModel"); _viewModel = viewModel; DataContext = _viewModel; PreviewKeyDown += WindowViewBase_PreviewKeyDown; Closed += WindowViewBase_Closed; HandleEscape = true; ShowInTaskbar = false; WindowStartupLocation = WindowStartupLocation.CenterOwner; FontFamily = new FontFamily("Segoe UI"); FontSize = 11.0d; Background = (Brush)Application.Current.Resources["WindowBackground"]; _viewModel.ShowMessageBox += viewModel_ShowMessageBox; _viewModel.ShowDialogWindow += viewModel_ShowDialogWindow; _viewModel.ShowOpenFile += viewModel_ShowOpenFile; }
protected ViewBase(IViewModelBase viewModel) { DataContext = viewModel; }
public NavigatedEventMessage(NavigationInfo navigationInfo, IViewModelBase viewModel) : base(navigationInfo) { ViewModel = viewModel; }
/// <summary> /// Initializes a new instance of the <see cref="ActualFiniteStateRowViewModel"/> class /// </summary> /// <param name="actualFiniteState">The <see cref="ActualFiniteState"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase"/> that is the container of this <see cref="IRowViewModelBase"/></param> public ActualFiniteStateRowViewModel(ActualFiniteState actualFiniteState, ISession session, IViewModelBase <Thing> containerViewModel) : base(actualFiniteState, session, containerViewModel) { this.UpdateColumnValues(); }
/// <summary> /// Initializes a new instance of the <see cref="ParticipantPermissionRowViewModel"/> class /// </summary> /// <param name="participantPermission">The <see cref="ParticipantPermission"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> public ParticipantPermissionRowViewModel(ParticipantPermission participantPermission, ISession session, IViewModelBase <Thing> containerViewModel) : base(participantPermission, session, containerViewModel) { this.UpdateProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="ParameterComponentValueRowViewModel"/> class /// </summary> /// <param name="parameterBase"> /// The associated <see cref="ParameterBase"/> /// </param> /// <param name="valueIndex"> /// The index of this component in the <see cref="CompoundParameterType"/> /// </param> /// <param name="session"> /// The associated <see cref="ISession"/> /// </param> /// <param name="actualOption"> /// The <see cref="Option"/> of this row if any /// </param> /// <param name="actualState"> /// The <see cref="ActualFiniteState"/> of this row if any /// </param> /// <param name="containerRow"> /// the row container /// </param> /// <param name="isDialogReadOnly"> /// A value indicating whether the dialog is read-only /// </param> public ParameterComponentValueRowViewModel(ParameterBase parameterBase, int valueIndex, ISession session, Option actualOption, ActualFiniteState actualState, IViewModelBase <Thing> containerRow, bool isDialogReadOnly = false) : base(parameterBase, session, actualOption, actualState, containerRow, valueIndex, isDialogReadOnly) { var compoundParameterType = this.Thing.ParameterType as CompoundParameterType; if (compoundParameterType == null) { throw new InvalidOperationException("This row shall only be used for CompoundParameterType."); } if (valueIndex >= compoundParameterType.Component.Count) { throw new IndexOutOfRangeException(string.Format("The compoundParameterType {0} has only {1} components", compoundParameterType.Name, compoundParameterType.Component.Count)); } if (containerRow == null) { throw new ArgumentNullException("containerRow", "The container row is mandatory"); } // reset the classkind of this row to match the component classkind this.ParameterTypeClassKind = ((CompoundParameterType)this.ParameterType).Component[this.ValueIndex].ParameterType.ClassKind; this.Scale = ((CompoundParameterType)this.ParameterType).Component[this.ValueIndex].Scale; this.ParameterType = ((CompoundParameterType)this.ParameterType).Component[this.ValueIndex].ParameterType; this.Name = compoundParameterType.Component[valueIndex].ShortName; this.Option = this.ActualOption; this.State = (this.ActualState != null) ? this.ActualState.Name : string.Empty; this.WhenAnyValue(rowViewModel => rowViewModel.Switch).Skip(1).Subscribe(switchKind => { var valueBaseRow = this.ContainerViewModel as ParameterValueBaseRowViewModel; if (valueBaseRow != null) { foreach (ParameterComponentValueRowViewModel row in valueBaseRow.ContainedRows) { row.Switch = switchKind; } return; } var parameterBaseRow = this.ContainerViewModel as ParameterOrOverrideBaseRowViewModel; if (parameterBaseRow != null) { foreach (ParameterComponentValueRowViewModel row in parameterBaseRow.ContainedRows) { row.Switch = switchKind; } return; } var subscriptionRow = this.ContainerViewModel as ParameterSubscriptionRowViewModel; if (subscriptionRow != null) { foreach (ParameterComponentValueRowViewModel row in subscriptionRow.ContainedRows) { row.Switch = switchKind; } } }); }
/// <summary> /// Initializes a new instance of the <see cref="TopContainerRowViewModel{T}"/> class /// </summary> /// <param name="topContainer">The <see cref="TopContainer"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> protected TopContainerRowViewModel(T topContainer, ISession session, IViewModelBase <Thing> containerViewModel) : base(topContainer, session, containerViewModel) { this.UpdateProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="EnumerationParameterTypeRowViewModel"/> class /// </summary> /// <param name="enumerationParameterType">The <see cref="EnumerationParameterType"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> public EnumerationParameterTypeRowViewModel(EnumerationParameterType enumerationParameterType, ISession session, IViewModelBase <Thing> containerViewModel) : base(enumerationParameterType, session, containerViewModel) { this.UpdateProperties(); }
public void SubscribeToViewModel(IViewModelBase viewModel) { viewModel.ChangeNotificationRequested += ChangeNotificationRequested; viewModels.Add(viewModel); }
/// <summary> /// Initializes a new instance of the <see cref="ElementUsageRowViewModel"/> class /// </summary> /// <param name="elementUsage">The <see cref="ElementUsage"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> public ElementUsageRowViewModel(ElementUsage elementUsage, ISession session, IViewModelBase <Thing> containerViewModel) : base(elementUsage, session, containerViewModel) { this.UpdateProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="RuleVerificationListRowViewModel"/> class /// </summary> /// <param name="ruleVerificationList">The <see cref="RuleVerificationList"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> public RuleVerificationListRowViewModel(RuleVerificationList ruleVerificationList, ISession session, IViewModelBase <Thing> containerViewModel) : base(ruleVerificationList, session, containerViewModel) { this.UpdateProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="EngineeringModelSetupRowViewModel"/> class /// </summary> /// <param name="engineeringModelSetup"> /// The engineering Model Setup. /// </param> /// <param name="session"> /// The session. /// </param> /// <param name="containerViewModel"> /// The container <see cref="IViewModelBase{T}"/> /// </param> public EngineeringModelSetupRowViewModel(EngineeringModelSetup engineeringModelSetup, ISession session, IViewModelBase <Thing> containerViewModel) : base(engineeringModelSetup, session, containerViewModel) { this.participantFolderRow = new FolderRowViewModel("Participants", "Participants", this.Session, this); this.iterationSetupFolderRow = new FolderRowViewModel("Iterations", "Iterations", this.Session, this); this.activeDomainFolderRow = new FolderRowViewModel("Active Domains", "Active Domains", this.Session, this); this.ContainedRows.Add(this.participantFolderRow); this.ContainedRows.Add(this.iterationSetupFolderRow); this.ContainedRows.Add(this.activeDomainFolderRow); this.UpdateProperties(); }
/// <summary> /// Update the <see cref="ContainerViewModel"/> /// </summary> /// <param name="containerViewModel">The new <see cref="ContainerViewModel"/></param> public void UpdateContainerViewModel(IViewModelBase <Thing> containerViewModel) { this.ContainerViewModel = containerViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="FolderRowViewModel"/> class. /// </summary> /// <param name="folder"> /// The <see cref="Folder"/> associated with this row /// </param> /// <param name="session"> /// The session /// </param> /// <param name="containerViewModel"> /// The <see cref="IViewModelBase<Thing>"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/> /// </param> public FolderRowViewModel(Folder folder, ISession session, IFileStoreRow containerViewModel) : base(folder, session, (IViewModelBase <Thing>)containerViewModel) { this.fileStoreRow = (IViewModelBase <Thing>)containerViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="CommonFileStoreRowViewModel"/> class /// </summary> /// <param name="commonFileStore">The <see cref="CommonFileStore"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> public CommonFileStoreRowViewModel(CommonFileStore commonFileStore, ISession session, IViewModelBase <Thing> containerViewModel) : base(commonFileStore, session, containerViewModel) { }
private void GameVMGameCompleted(object sender, EventArgs e) { _gameVM.GameCompleted -= GameVMGameCompleted; _gameVM = null; Content = _gameOverVM; }
/// <summary> /// Initializes a new instance of the <see cref="ParameterOrOverrideBaseRowViewModel"/> class /// </summary> /// <param name="parameterOrOverride">The <see cref="ParameterOrOverrideBase"/></param> /// <param name="option">The current <see cref="Option"/></param> /// <param name="session">The current <see cref="ISession"/></param> /// <param name="containerViewModel">The row that represents a <see cref="IViewModelBase{T}"/> that contains this row through <see cref="ParameterGroup"/>s or not.</param> protected ParameterOrOverrideBaseRowViewModel(ParameterOrOverrideBase parameterOrOverride, Option option, ISession session, IViewModelBase <Thing> containerViewModel) : base(parameterOrOverride, session, containerViewModel) { // initialize the current group this.actualFiniteStateListener = new List <IDisposable>(); this.currentGroup = this.Thing.Group; this.IsOptionDependent = this.Thing.IsOptionDependent; this.Option = option; this.StateDependence = this.Thing.StateDependence; this.UpdateModelCode(); this.UpdateProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="SiteReferenceDataLibraryRowViewModel"/> class /// </summary> /// <param name="siteReferenceDataLibrary">The <see cref="SiteReferenceDataLibrary"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase"/> that is the container of this <see cref="IRowViewModelBase"/></param> public SiteReferenceDataLibraryRowViewModel(SiteReferenceDataLibrary siteReferenceDataLibrary, ISession session, IViewModelBase <Thing> containerViewModel) : base(siteReferenceDataLibrary, session, containerViewModel) { this.UpdateColumnValues(); }
private void GameOverVMMenuRequested(object sender, EventArgs e) { Content = _menuVM; }
/// <summary> /// Initializes a new instance of the <see cref="PrefixedUnitRowViewModel"/> class /// </summary> /// <param name="prefixedUnit">The <see cref="PrefixedUnit"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> public PrefixedUnitRowViewModel(PrefixedUnit prefixedUnit, ISession session, IViewModelBase <Thing> containerViewModel) : base(prefixedUnit, session, containerViewModel) { this.UpdateProperties(); }
/// <summary> /// Initializes a new instance of the <see cref="ActualFiniteStateRowViewModel"/> class /// </summary> /// <param name="actualFiniteState">The <see cref="ActualFiniteState"/> represented</param> /// <param name="session">The <see cref="ISession"/></param> /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param> public ActualFiniteStateRowViewModel(ActualFiniteState actualFiniteState, ISession session, IViewModelBase <Thing> containerViewModel) : base(actualFiniteState, session, containerViewModel) { this.IsDefault = this.Thing.IsDefault; }
/// <summary> /// Initializes a new instance of the <see cref="MeasurementUnitRowViewModel"/> class. /// </summary> /// <param name="measurementUnit"> /// The <see cref="MeasurementUnit"/> that is represented by the current view-model /// </param> /// <param name="session"> /// The session /// </param> /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param> public MeasurementUnitRowViewModel(MeasurementUnit measurementUnit, ISession session, IViewModelBase <Thing> containerViewModel) : base(measurementUnit, session, containerViewModel) { this.UpdateProperties(); }
/// <summary> /// Registers the new view model in pool. /// </summary> /// <param name="viewModel">The view model.</param> public static void RegisterNewViewModelInPool(IViewModelBase viewModel) { viewModelPool.Add(viewModel); }
/// <summary> /// Initializes a new instance of the <see cref="MeasurementScaleRowViewModel{T}"/> class /// </summary> /// <param name="measurementScale">The <see cref="MeasurementScale"/> associated with this row</param> /// <param name="session">The session</param> /// <param name="containerViewModel">The <see cref="IViewModelBase{Thing}"/> that is the container of this <see cref="IRowViewModelBase{Thing}"/></param> protected MeasurementScaleRowViewModel(T measurementScale, ISession session, IViewModelBase <Thing> containerViewModel) : base(measurementScale, session, containerViewModel) { this.UpdateProperties(); }