public TennisSnapIn() { InitializeComponent(); ViewModel = (TennisSnapInViewModel)this.DataContext; StateList = new Scoring.UndoStateList(new Scoring.V1.V1State()); StateList.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(StateListPropertyChanged); ViewModel.StateList = StateList; PluginInterfaces.PublicProviders.CasparServer.IsConnectedChanged += () => LoadTemplatesFromServer(); LoadTemplatesFromServer(); }
public TennisSnapInViewModel() : base(true) { _Player1ScoredCommand = new DelegateCommand(() => _StateList.Process(Scoring.ScoringStrategyAction.Player1Scored), () => _StateList != null && _StateList.CanProcess(Scoring.ScoringStrategyAction.Player1Scored)); _Player1ReducedCommand = new DelegateCommand(() => _StateList.Process(Scoring.ScoringStrategyAction.Player1Reduced), () => _StateList != null && _StateList.CanProcess(Scoring.ScoringStrategyAction.Player1Reduced)); _Player2ScoredCommand = new DelegateCommand(() => _StateList.Process(Scoring.ScoringStrategyAction.Player2Scored), () => _StateList != null && _StateList.CanProcess(Scoring.ScoringStrategyAction.Player2Scored)); _Player2ReducedCommand = new DelegateCommand(() => _StateList.Process(Scoring.ScoringStrategyAction.Player2Reduced), () => _StateList != null && _StateList.CanProcess(Scoring.ScoringStrategyAction.Player2Reduced)); _UndoCommand = new DelegateCommand(() => _StateList.Undo(), () => _StateList != null && _StateList.CanUndo); AddExternalPropertyDependency("CasparServerIsConnected", PluginInterfaces.PublicProviders.CasparServer, "IsConnected"); AddExternalPropertyDependency("AvailablePlayerNames", PlayerNames.PlayerNamesContainer.Instance, "Names"); TheOtherInsertsTextInputCount = 5; if (IsInDesignMode) { _StateList = new Scoring.UndoStateList(new Scoring.V1.V1State()); } }