/// <summary>モデルを読み込み、メイン動作を開始します。</summary> public static ModelCore LoadAndStart(IMainWindow mainWindow, ICharacterSelector characterSelector, INadeable nadenade) { var modelCore = new ModelCore(mainWindow, characterSelector, nadenade); modelCore.Initialize(mainWindow); return(modelCore); }
/// <summary>このモデルを適用するウィンドウを指定し、モデルを初期化します。</summary> /// <param name="mainWindow">キャラ表示に使うウィンドウ</param> /// <param name="characterSelector">キャラ変更通知を行う何か</param> /// <param name="nadenade">撫で値の取得</param> private ModelCore(IMainWindow mainWindow, ICharacterSelector characterSelector, INadeable nadenade) { _nadenade = nadenade; _timer = new MainTimer(TimerUpdateIntervalSec * 1000); _timer.Tick += OnTimerTick; Observable.FromEventPattern <CharacterSelectedEventArgs>(characterSelector, nameof(characterSelector.CharacterSelected)) .Take(1) .Subscribe(e => OnChangeCharacter(e.EventArgs.CharacterName)); _closeRequestObserving = Observable.FromEventPattern <EventArgs>(mainWindow, nameof(mainWindow.CloseRequested)) .Take(1) .Subscribe(_ => OnCloseRequested()); Observable.FromEventPattern <EventArgs>(mainWindow, nameof(mainWindow.Closing)) .Take(1) .Subscribe(_ => OnClosing()); }
/// <summary>このモデルを適用するウィンドウを指定し、モデルを初期化します。</summary> /// <param name="mainWindow">キャラ表示に使うウィンドウ</param> /// <param name="characterSelector">キャラ変更通知を行う何か</param> /// <param name="nadenade">撫で値の取得</param> private ModelCore(IMainWindow mainWindow, ICharacterSelector characterSelector, INadeable nadenade) { _nadenade = nadenade; _timer = new MainTimer(TimerUpdateIntervalSec * 1000); _timer.Tick += OnTimerTick; Observable.FromEventPattern<CharacterSelectedEventArgs>(characterSelector, nameof(characterSelector.CharacterSelected)) .Take(1) .Subscribe(e => OnChangeCharacter(e.EventArgs.CharacterName)); _closeRequestObserving = Observable.FromEventPattern<EventArgs>(mainWindow, nameof(mainWindow.CloseRequested)) .Take(1) .Subscribe(_ => OnCloseRequested()); Observable.FromEventPattern<EventArgs>(mainWindow, nameof(mainWindow.Closing)) .Take(1) .Subscribe(_ => OnClosing()); }
/// <summary>モデルを読み込み、メイン動作を開始します。</summary> public static ModelCore LoadAndStart(IMainWindow mainWindow, ICharacterSelector characterSelector, INadeable nadenade) { var modelCore = new ModelCore(mainWindow, characterSelector, nadenade); modelCore.Initialize(mainWindow); return modelCore; }