Пример #1
0
        public MainWindowViewModel(IAppStore store, IAppActions actions)
        {
            this.Store   = store;
            this.Actions = actions;

            this.EnableAutoPropertyChangedEvent(store);
            this.EnableAutoCanExecuteChangedEvent(store);

            this.CompositeDisposable.Add(new PropertyChangedWeakEventListener(
                                             store,
                                             (_, e) =>
            {
                switch (e.PropertyName)
                {
                case nameof(IAppStore.VoiceAnalysisResult):
                    // 結果が更新されたら NoteBlockViewModel を作り直す
                    this.NoteBlocks = this.Store.VoiceAnalysisResult == null
                                ? ImmutableArray <NoteBlockViewModel> .Empty
                                : ImmutableArray.CreateRange(
                        this.Store.VoiceAnalysisResult.NoteBlocks,
                        x => new NoteBlockViewModel(x, this.Store)
                        );
                    break;

                case nameof(IAppStore.CorrectNoteBlocks):
                    // 正解データも同様に
                    this.CorrectNoteBlocks = ImmutableArray.CreateRange(
                        this.Store.CorrectNoteBlocks,
                        x => new CorrectNoteBlockViewModel(x, this.Store)
                        );
                    break;
                }
            }
                                             ));
        }
Пример #2
0
        static IPlatformAppActions AsPlatform(this IAppActions appActions)
        {
            if (appActions is not IPlatformAppActions platform)
            {
                throw new PlatformNotSupportedException("This implementation of IAppActions does not implement IPlatformAppActions.");
            }

            return(platform);
        }
        public EditCorrectScoreWindowViewModel(IAppStore store, IAppActions actions)
        {
            this.Store   = store;
            this.Actions = actions;

            this.EnableAutoPropertyChangedEvent(store);
            this.EnableAutoCanExecuteChangedEvent(store);
            this.EnableValidation();

            this._startPosition = store.CorrectScoreStartPositionInAnalysisUnits.ToString();

            this.TempoSettings = ViewModelHelper.CreateReadOnlyDispatcherCollection(
                store.TempoSettings, x => new TempoSettingViewModel(x), DispatcherHelper.UIDispatcher);
        }
 public void SetCallbacks(IAppActions instance)
 {
     if (m_Wrapper.m_AppActionsCallbackInterface != null)
     {
         @Exit.started   -= m_Wrapper.m_AppActionsCallbackInterface.OnExit;
         @Exit.performed -= m_Wrapper.m_AppActionsCallbackInterface.OnExit;
         @Exit.canceled  -= m_Wrapper.m_AppActionsCallbackInterface.OnExit;
     }
     m_Wrapper.m_AppActionsCallbackInterface = instance;
     if (instance != null)
     {
         @Exit.started   += instance.OnExit;
         @Exit.performed += instance.OnExit;
         @Exit.canceled  += instance.OnExit;
     }
 }
Пример #5
0
        public MainWindowViewModel()
        {
            var model = new AppModel();

            this.Store   = model.Store;
            this.Actions = model;

            this.EnableAutoPropertyChangedEvent(this.Store);

            this.CompositeDisposable.Add(new PropertyChangedWeakEventListener(
                                             this.Store,
                                             (_, e) =>
            {
                switch (e.PropertyName)
                {
                case nameof(IAppStore.RecoderProviders):
                    this.RecoderProviders = ImmutableArray.CreateRange(this.Store.RecoderProviders, x => x.DisplayName);
                    break;
                }
            }
                                             ));
        }
Пример #6
0
 public static void OnResume(this IAppActions appActions, Android.Content.Intent?intent) =>
 appActions.AsPlatform().OnResume(intent);
Пример #7
0
 public static void PerformActionForShortcutItem(this IAppActions appActions, UIKit.UIApplication application, UIKit.UIApplicationShortcutItem shortcutItem, UIKit.UIOperationHandler completionHandler) =>
 appActions.AsPlatform().PerformActionForShortcutItem(application, shortcutItem, completionHandler);
Пример #8
0
 public static Task OnLaunched(this IAppActions appActions, UI.Xaml.LaunchActivatedEventArgs e) =>
 appActions.AsPlatform().OnLaunched(e);