Beispiel #1
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="executionService"></param>
 /// <param name="uriConversionService"></param>
 /// <param name="configJsonService"></param>
 public MylistIdCollectionService(
     IExecutionService executionService,
     IUriConversionService uriConversionService,
     IConfigJsonService configJsonService)
     : base(executionService, uriConversionService, configJsonService, conf => conf.MylistIds)
 {
 }
Beispiel #2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="configJsonService"></param>
        /// <param name="userSettingsService"></param>
        /// <param name="executionService"></param>
        public PresetControlViewModel(IConfigJsonService configJsonService, IUserSettingsService userSettingsService, IExecutionService executionService)
        {
            ConfigJsonService   = configJsonService;
            UserSettingsService = userSettingsService;
            ExecutionService    = executionService;

            // モデルのプロパティ更新イベントリスナ登録
            CompositeDisposable.Add(new PropertyChangedEventListener(UserSettingsService.UserSettings)
            {
                { nameof(UserSettings.PresetInfos), (_, __) => RaisePropertyChanged(nameof(Presets)) },
            });
            CompositeDisposable.Add(new PropertyChangedEventListener(ConfigJsonService)
            {
                {
                    nameof(IConfigJsonService.CurrentPreset),
                    (_, __) =>
                    {
                        RaisePropertyChanged(nameof(CurrentPreset));
                        RaisePropertyChanged(nameof(SaveEnable));
                        RaisePropertyChanged(nameof(DeleteEnable));
                    }
                },
                {
                    nameof(IConfigJsonService.ConfigJson), (_, __) => SetConfigJsonEventListenr()
                }
            });
            SetConfigJsonEventListenr();
        }
Beispiel #3
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="executionService"></param>
 /// <param name="uriConversionService"></param>
 /// <param name="configJsonService"></param>
 public NicovideoIdCollectionService(
     IExecutionService executionService,
     IUriConversionService uriConversionService,
     IConfigJsonService configJsonService)
     : base(executionService, uriConversionService, configJsonService, conf => conf.NicovideoIds)
 {
 }
Beispiel #4
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="executionService"></param>
 /// <param name="uriConversionService"></param>
 /// <param name="configJsonService"></param>
 /// <param name="selectFunc"></param>
 public TextCollectionService(
     IExecutionService executionService,
     IUriConversionService uriConversionService,
     IConfigJsonService configJsonService,
     Func <ConfigJson, ObservableCollection <string> > selectFunc)
     : base(executionService, uriConversionService, configJsonService, selectFunc)
 {
 }
Beispiel #5
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="uriConversionService"></param>
 /// <param name="configJsonService"></param>
 /// <param name="selectFunc"></param>
 public Nico3dIdCollectionService(
     IExecutionService executionService,
     IUriConversionService uriConversionService,
     IConfigJsonService configJsonService,
     Func <ConfigJson, ObservableCollection <int> > selectFunc)
     : base(executionService, uriConversionService, configJsonService, selectFunc)
 {
 }
Beispiel #6
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="executionService"></param>
 /// <param name="uriConversionService"></param>
 /// <param name="configJsonService"></param>
 /// <param name="selectFunc"></param>
 public DoubleImageCollectionService(
     IExecutionService executionService,
     IUriConversionService uriConversionService,
     IConfigJsonService configJsonService,
     Func <ConfigJson, ObservableCollection <ConfigJson.DoubleImageUrls> > selectFunc)
     : base(executionService, uriConversionService, configJsonService, selectFunc)
 {
 }
Beispiel #7
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="configJsonService"></param>
 public CollectionManageService(
     IExecutionService executionService,
     IUriConversionService uriConversionService,
     IConfigJsonService configJsonService,
     Func <ConfigJson, ObservableCollection <T> > selectFunc)
 {
     ExecutionService              = executionService;
     UriConversionService          = uriConversionService;
     ConfigJson                    = configJsonService.ConfigJson;
     SelectCollectionFunc          = selectFunc;
     Collection.CollectionChanged += Collection_CollectionChanged;
 }
Beispiel #8
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="configJsonService"></param>
        /// <param name="executionService"></param>
        public MainWindowViewModel(IConfigJsonService configJsonService, IExecutionService executionService, IUserSettingsService userSettingsService)
        {
            ConfigJsonService   = configJsonService;
            ExecutionService    = executionService;
            UserSettingsService = userSettingsService;

            CompositeDisposable.Add(new PropertyChangedEventListener(ConfigJsonService)
            {
                { nameof(ConfigJsonService.IsBusy), (_, __) => RaisePropertyChanged(nameof(IsBusy)) },
            });

            CompositeDisposable.Add(new EventListener <EventHandler <ConfigJsonErrorEventArgs> >(
                                        h => ConfigJsonService.ErrorOccurred += h,
                                        h => ConfigJsonService.ErrorOccurred -= h,
                                        (_, e) =>
            {
                if (!ConfigJsonErrorMessageMap.TryGetValue(e.ErrorCause, out var message))
                {
                    message = Resources.ErrorUnknown;
                }
                ShowErrorMessage(message, e.Exception, e.Path);
            }
                                        ));

            CompositeDisposable.Add(new EventListener <EventHandler <ExecutionErrorEventArgs> >(
                                        h => ExecutionService.ExecutionError += h,
                                        h => ExecutionService.ExecutionError -= h,
                                        (_, e) =>
            {
                if (!ExecutionErrorMessageMap.TryGetValue(e.ErrorCause, out var message))
                {
                    message = Resources.ErrorUnknown;
                }
                ShowErrorMessage(message, e.Exception, e.Path);
            }
                                        ));

            CompositeDisposable.Add(new EventListener <EventHandler>(
                                        h => ExecutionService.VirtualCastLaunched += h,
                                        h => ExecutionService.VirtualCastLaunched -= h,
                                        (_, e) =>
            {
                if (UserSettingsService.UserSettings.ExitWhenVirtulCastLaunched)
                {
                    Messenger.Raise(new WindowActionMessage(WindowAction.Close, "Close"));
                }
            }
                                        ));

            ImportJsonCommand      = new ViewModelCommand(ImportJson);
            ExportJsonCommand      = new ViewModelCommand(ExportJson);
            ShowAboutDialogCommand = new ViewModelCommand(() => Messenger.Raise(new TransitionMessage("AboutDialog")));
        }