/// <summary> /// Constructor using dependency injection /// </summary> public MainWindowViewModel( ICustomerRepository customerRepository, IProductRepository productRepository, IUpdateService updateService, IMessageBoxService messageBoxService, IAppDialogService appDialogService, IOpenFileDialogService openFileDialogService, ISaveFileDialogService saveFileDialogService, ILocalizationService localizationService) : base(localizationService) { _customerRepository = customerRepository; _productRepository = productRepository; _updateService = updateService; _messageBoxService = messageBoxService; _appDialogService = appDialogService; _openFileDialogService = openFileDialogService; _saveFileDialogService = saveFileDialogService; OpenFileCommand = new RelayCommand(OpenFileDialog); SaveFileCommand = new RelayCommand(SaveFileDialog); CloseCommand = new RelayCommand(OnRequestClose); OpenAboutCommand = new RelayCommand(OpenAboutDialog); OpenLanguageOptionsCommand = new RelayCommand(OpenLanguageOptions); UpdateCommand = new RelayCommand(Update); }
/// <summary> /// Initializes an instance of the FileDataUploaderViewModel class. /// </summary> /// <param name="openFileDialogService">File Dialog Service instance.</param> /// <param name="messageBoxService">Message Box Service instance.</param> /// <param name="configManager">Config Manager Service instance.</param> public FileDataUploaderViewModel(IOpenFileDialogService openFileDialogService, IMessageBoxService messageBoxService, IConfigurationManager configManager) { _openFileDialogService = openFileDialogService; _messageBoxService = messageBoxService; _configManager = configManager; InitializeBackgroundWorker(); }
public ProjectPageViewModel(IFrameNavigationService navigationService, IOpenFileDialogService openFileDialogService, ILogger loggerService, IDBService dBService) { _navigationService = navigationService; _openFileDialogService = openFileDialogService; _logService = loggerService; _dbService = dBService; OutputMessages = new ObservableCollection <OutputMessage>(); _project = ((NavigationServiceParameter)_navigationService.Parameter).ObjParam as Project; OutputMessages.Add(new OutputMessage { Message = _project.Name + " details", Level = "" }); ProjectName = _project.Name; Leader = _project.Leader; Goal = _project.Goal; Description = _project.Description; Plans = new ObservableCollection <byte[]>(); foreach (var item in _project.ProjectPlanByreArrays) { Plans.Add(item); } Reactions = new ObservableCollection <ReactionInfo>(); Modify = null; ConfigNavigationCommands(); Modify = new RelayCommand(ModifyCommand); AddPlan = new RelayCommand(AddPlanCommand); GetResources = new RelayCommand(GetResourcesCommand); ViewReaction = new RelayCommand <ReactionInfo>(ViewReactionCommand); DeleteReaction = new RelayCommand <ReactionInfo>(DeleteReactionCommand); SaveProject = new RelayCommand(SaveProjectCommand); }
public ReactionPageViewModel(IFrameNavigationService navigationService, IOpenFileDialogService openFileDialogService, ILogger loggerService, IDBService dBService) { _navigationService = navigationService; _openFileDialogService = openFileDialogService; _logService = loggerService; _dbService = dBService; // _reaction = (ReactionInfo)_navigationService.Parameter; _reaction = ((NavigationServiceParameter)_navigationService.Parameter).ObjParam as ReactionInfo; _reactionId = _reaction.ReactionID; ConfigNavigationCommands(); FinishSketchEnabled = null; FinishSketch = new RelayCommand(FinishSketchCommand); SketchAvailable = null; StartingMaterial = new ObservableCollection <StartingMaterial>(); Reagents = new ObservableCollection <Reagent>(); Solvents = new ObservableCollection <Solvent>(); Products = new ObservableCollection <Product>(); ObservationImgsByteArray = new ObservableCollection <byte[]>(); ObservationImgsFilePaths = new ObservableCollection <string>(); GetResources = new RelayCommand(GetResourcesCommand); SelectObservationImg = new RelayCommand(SelectObservationImgCommand); DeleteObservationImg = new RelayCommand <string>(DeleteObservationImgCommand); SaveReaction = new RelayCommand(SaveReactionCommandAsync); OutputMessages = new ObservableCollection <OutputMessage>(); }
public MainViewModel( IEventAggregator eventAggregator, ISaveDialogService saveDialogService, IOpenFileDialogService openFileDialogService, IAppConfigMapper appConfigMapper, IShowInfoMessage showInfoMessage) { InitializeCommands(); InitializeServices( eventAggregator, saveDialogService, openFileDialogService, appConfigMapper, showInfoMessage); if (!EnsureConfigurationsAreAvailable()) { return; } SubscribeToEvents(); InitializeMembers(); }
public MainWindowViewModel( MSBuildProject project, IDialogService <UnsavedChangesDialogViewModel> unsavedChangesDialogService, IOpenFileDialogService openFileDialogService, IThemeService themeService) { _project = project.Project; _propertyManager = new PropertyManager(_project); _unsavedChangesDialogService = unsavedChangesDialogService; _themeService = themeService; ClosingCommand = ReactiveCommand.Create <CancelEventArgs>(OnClosing); SaveCommand = ReactiveCommand.Create( _propertyManager.Save, Observable.FromEventPattern( handler => _propertyManager.IsDirtyChanged += handler, handler => _propertyManager.IsDirtyChanged -= handler) .Select(_ => _propertyManager.IsDirty)); ApplicationPage = new ApplicationPageViewModel(_propertyManager); BuildPage = new BuildPageViewModel(_propertyManager); BuildEventsPage = new BuildEventsPageViewModel(_propertyManager); PackagePage = new PackagePageViewModel(_propertyManager); SigningPage = new SigningPageViewModel(_propertyManager, openFileDialogService); }
public MainViewModel(ISoundFileValidator soundFileValidator, IOpenFileDialogService openFileDialogService) { _soundFileValidator = soundFileValidator; _openFileDialogService = openFileDialogService; _cmdHelper = new CommandHelper(this); _patternTimer.Elapsed += (sender, args) => { PatternPlayTime = PatternPlayTime.Add(_span); }; _patternTimer.Interval = (int)_span.TotalMilliseconds; _songTimer.Elapsed += (sender, args) => { SongPlayTime = SongPlayTime.Add(_span); }; _songTimer.Interval = (int)_span.TotalMilliseconds; NewProjectCommand = new DelegateCommand(NewProject, CanNewProject); OpenProjectCommand = new DelegateCommand(OpenProject, CanOpenProject); SaveProjectCommand = new DelegateCommand(SaveProject, CanSaveProject); AddInstrumentCommand = new DelegateCommand(AddInstrument, CanAddInstrument); PlayOrStopPatternCommand = new DelegateCommand(PlayOrStopPattern, CanPlayOrStopPattern); PlayOrStopSongCommand = new DelegateCommand(PlayOrStopSong, CanPlayOrStopSong); DeleteInstrumentCommand = new DelegateCommand <Instrument>(DeleteInstrument, CanDeleteInstrument); ExportPatternCommand = new DelegateCommand(ExportPattern, CanExportPattern); AddPatternCommand = new DelegateCommand(AddPattern, CanAddPattern); ExportSongCommand = new DelegateCommand(ExportSong, CanExportSong); DeletePatternCommand = new DelegateCommand(DeletePattern, CanDeletePattern); RenamePatternCommand = new DelegateCommand(RenamePattern, CanRenamePattern); PatternItemCheckCommand = new DelegateCommand(PatternItemCheck); PropertyChanged += ThisPropertyChanged; }
static void VerifyService(IOpenFileDialogService service) { if (service == null) { throw new ArgumentNullException("service"); } }
/// <summary> /// コンストラクター /// </summary> public MainWindowViewModel(IAppSettingsService appSettingsService, IOpenFileDialogService openFileDialogService, ITextReadService textReadService, ITalkService talkService, ITalkQueueService talkQueueService) { AppSettingsService = appSettingsService; OpenFileDialogService = openFileDialogService; TextReadService = textReadService; TalkService = talkService; TalkQueueService = talkQueueService; TextReadService.Subscribe(TalkQueueService.Enqueue); SelectedCast.Value = TalkService.Cast; SelectedCast.Subscribe(x => TalkService.Cast = x); Volume.Value = TalkService.Volume; Volume.Subscribe(x => TalkService.Volume = x); Speed.Value = TalkService.Speed; Speed.Subscribe(x => TalkService.Speed = x); Tone.Value = TalkService.Tone; Tone.Subscribe(x => TalkService.Tone = x); Alpha.Value = TalkService.Alpha; Alpha.Subscribe(x => TalkService.Alpha = x); ToneScale.Value = TalkService.ToneScale; ToneScale.Subscribe(x => TalkService.ToneScale = x); LoadSettingsCommand.Subscribe(LoadSettings); SaveSettingsCommand.Subscribe(SaveSettings); OpenCommand.Subscribe(Open); ToggleWatchCommand.Subscribe(ToggleWatch); }
public void DefaultValues() { OpenFileDialogService service = new OpenFileDialogService(); Assert.AreEqual(true, service.AddExtension); Assert.AreEqual(true, service.AutoUpgradeEnabled); Assert.AreEqual(true, service.CheckFileExists); Assert.AreEqual(true, service.CheckPathExists); Assert.AreEqual(true, service.DereferenceLinks); Assert.AreEqual(false, service.RestoreDirectory); Assert.AreEqual(false, service.ShowHelp); Assert.AreEqual(false, service.ShowReadOnly); Assert.AreEqual(false, service.SupportMultiDottedExtensions); Assert.AreEqual(string.Empty, service.Title); Assert.AreEqual(true, service.ValidateNames); Assert.AreEqual(string.Empty, service.Filter); Assert.AreEqual(1, service.FilterIndex); Assert.AreEqual(string.Empty, service.InitialDirectory); Assert.AreEqual(string.Empty, service.DefaultFileName); Assert.AreEqual(false, service.Multiselect); IOpenFileDialogService iService = service; Assert.IsNull(iService.File); Assert.AreEqual(0, iService.Files.Count()); }
/// <summary> /// Constructor. /// </summary> /// <param name="elManejadorDeVías">El manejador de Vías.</param> /// <param name="elEscuchadorDeEstatus">El escuchador de estatus.</param> /// <param name="elServicioDiálogoAbrirArchivos">El servicio de diálogo para abrir archivos.</param> public RemplazadorDeNombresDeVias( ManejadorDeVías elManejadorDeVías, IEscuchadorDeEstatus elEscuchadorDeEstatus, IOpenFileDialogService elServicioDiálogoAbrirArchivos) : base(elManejadorDeVías, elEscuchadorDeEstatus) { myOpenFileDialogService = elServicioDiálogoAbrirArchivos; MinimumDistanceInMeters = 100; }
public SigningPageViewModel( IPropertyManager propertyManager, IOpenFileDialogService openFileDialogService) : base(propertyManager) { _openFileDialogService = openFileDialogService; OpenKeyFileCommand = ReactiveCommand.Create(OpenKeyFile); }
public SettingsViewModel(IOpenFileDialogService openFileDialogService) { _openFileDialogService = openFileDialogService; _settings = new UserSettings(); ChooseSessionFileCommand = new RelayCommand(ChooseSessionFile); ChooseTournamentFileCommand = new RelayCommand(ChooseTournamentFile); SaveSettingsCommand = new RelayCommand(SaveSettings); CancelCommand = new RelayCommand(Cancel); }
public SettingsControlViewModel(IMtTranslationOptions options, IOpenFileDialogService openFileDialogService, bool isTellMeAction) { ViewModel = this; _options = options; IsTellMeAction = isTellMeAction; BrowseCommand = new RelayCommand(Browse); _openFileDialogService = openFileDialogService; SetSavedSettings(); }
public ValidatorViewModelFactory( IRecentFilesManager recentFiles, IPmmlValidator pmmlValidator, IOpenFileDialogService openFileDialogService, IGetFileNameService getFileNameService) { _recentFiles = recentFiles; _pmmlValidator = pmmlValidator; _openFileDialogService = openFileDialogService; _getFileNameService = getFileNameService; }
public CashGameViewModel(ICashGameService cashGameService, ISessionRepository sessionRepository, IOpenFileDialogService openFileDialogService, ISaveFileDialogService saveFileDialogService, IWaitDialogService waitDialogService, IFilterWindowService filterWindowService, IInfoDialogService infoDialogService) { _cashGameService = cashGameService; _sessionRepository = sessionRepository; _openFileDialogService = openFileDialogService; _saveFileDialogService = saveFileDialogService; _waitDialogService = waitDialogService; _filterWindowService = filterWindowService; _infoDialogService = infoDialogService; OpenFileCommand = new RelayCommand(OpenFile); FetchFromServerCommand = new RelayCommand(FetchFromServer); ClearCommand = new RelayCommand(() => UserSessionId = ""); SaveSessionsCommand = new RelayCommand(SaveSessions); ClearSessionsCommand = new RelayCommand(ClearSessions); ShowSessionsOnlyCommand = new RelayCommand <bool>(ShowSessionsOnly); FilterCommand = new RelayCommand(FilterSessions); UserSessionId = "Liitä wcusersessionid tähän"; Messenger.Default.Register <UserSessionIdChangedMessage>(this, message => { if (message.Sender != this && message.NewUserSessionId != _userSessionId) { UserSessionId = message.NewUserSessionId; } }); LoadStoredSessions(); if (_sessionRepository.GetAll().Count > 0) { StartDate = PlayingSessions.Max(s => s.StartTime); FilterViewModel = new FilterViewModel(_sessionRepository.GetAll().Min(s => s.StartTime), _sessionRepository.GetAll().Max(s => s.EndTime)); } else { StartDate = new DateTime(2010, 11, 1); FilterViewModel = new FilterViewModel(); } EndDate = DateTime.Now; Filter = new CashGameFilter(); }
/// <summary> /// Constructor. /// </summary> /// <param name="elEscuchadorDeEstatus">El escuchador de estatus.</param> /// <param name="elServicioDiálogoAbrirArchivos">El servicio de diálogo para abrir archivos.</param> public ManejadorDeMapa( IEscuchadorDeEstatus elEscuchadorDeEstatus, IOpenFileDialogService elServicioDiálogoAbrirArchivos) { Trace.WriteLine("Inicializando ManejadorDeMapa"); EscuchadorDeEstatus = elEscuchadorDeEstatus; ManejadorDeElementos = new ManejadorDeElementos(this, misElementos, elEscuchadorDeEstatus); ManejadorDePdis = new ManejadorDePdis(this, misPdis, elEscuchadorDeEstatus); ManejadorDeVías = new ManejadorDeVías(this, misVías, elEscuchadorDeEstatus, elServicioDiálogoAbrirArchivos); Polígonos = new List <Polígono>(); Polilíneas = new List <Polilínea>(); Ciudades = new List <Ciudad>(); NodosRuteables = new Dictionary <int, IList <Nodo> >(); }
public OpenModelService( Lazy <ILoadModelService> loadModelService, IModelMetadataService modelMetadataService, IOpenFileDialogService openFileDialogService, IExistingInstanceService existingInstanceService, IStartInstanceService startInstanceService, IApiManagerService apiManagerService) { this.loadModelService = loadModelService; this.modelMetadataService = modelMetadataService; this.openFileDialogService = openFileDialogService; this.existingInstanceService = existingInstanceService; this.startInstanceService = startInstanceService; this.apiManagerService = apiManagerService; }
public static string GetFullFileName(this IOpenFileDialogService service) { VerifyService(service); if (service.File == null) { return(string.Empty); } string directory = service.File.DirectoryName; if (!directory.EndsWith(@"\")) { directory += @"\"; } return(directory + service.File.Name); }
private void LoadBitmap() { IOpenFileDialogService openFileDialog = GetService <IOpenFileDialogService>(); if (openFileDialog.ShowDialog()) { _bitmap = (Bitmap)Image.FromFile(openFileDialog.GetFullFileName()); Bitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( _bitmap.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(_bitmap.Width, _bitmap.Height)); RaisePropertyChanged(nameof(Bitmap)); } }
protected static string GetFilePathAndNameFromUser() { using (IOpenFileDialogService dialogService = CommonUtility.Container.Resolve <IOpenFileDialogService>()) { dialogService.InitialDirectory = lastDialogDirectory; if (dialogService.ShowDialog() == DialogResult.Cancel) { return(null); } lastDialogDirectory = Path.GetDirectoryName(dialogService.FileName); return(dialogService.FileName); } }
public ExportExcelPageViewModel(IFrameNavigationService navigationService, ILogger logService, IExcelWriterService excelWriterService, IDBService dBService, IOpenFileDialogService openFileDialogService) { _navigationService = navigationService; _logService = logService; _excelwriterService = excelWriterService; _dbService = dBService; _openFileDialogService = openFileDialogService; ConfigNavigationCommands(); ExportExcelFile = new RelayCommand(ExportExcelFileCommand); SelectSaveLocation = new RelayCommand(SelectSaveLocationCommand); OutputMessages = new ObservableCollection <OutputMessage>(); }
public void AddFile(object param) { IOpenFileDialogService fbg = GetService <IOpenFileDialogService>(); if (fbg != null) { if (DialogResult.OK == fbg.Show("Please choose your awesome track", "Amazing Track", Helper.GetMultipleFilter("Supported Formats", musicFileFilters), true)) { string[] selectedPaths = fbg.SelectedPaths; foreach (string selectedPath in selectedPaths) { // Check if such directory exists, and check if such directory wasn't already introduced if (!string.IsNullOrEmpty(selectedPath) && Paths.All(folder => selectedPath != folder.Path)) { if (Directory.Exists(selectedPath)) { Paths.Add(new Item { Path = selectedPath, Count = -1, IsFolder = true }); } else if (File.Exists(selectedPath)) { Paths.Add(new Item { Path = selectedPath, Count = 1, IsFolder = false }); } } } } } if (param != null) { if (File.Exists(param as string)) { string extension = Path.GetExtension(param as string); if (musicFileFilters.Where(filter => extension != null).Any(filter => filter.Contains(extension))) { Paths.Add(new Item { Path = param as string, Count = 1, IsFolder = false }); } } } }
public MainWindowViewModel( IEventAggregator eventAggregator, ILoggerFacade logger, IExcelRepository excelRepository, IOpenFileDialogService openFileDialogService, ApplicationState applicationState) { _eventAggregator = eventAggregator; _logger = logger; _excelRepository = excelRepository; _openFileDialogService = openFileDialogService; _applicationState = applicationState; FileOpenCommand = new DelegateCommand(FileOpen, CanFileOpen); SaveOpenCommand = new DelegateCommand(FileSave, CanFileSave); CancelCommand = new DelegateCommand(Cancel, CanCancel); RunCloudCommand = new DelegateCommand(RunCloud, CanRunCloud); }
public NewProjectPageViewModel(IFrameNavigationService navigationService, ILogger loggerService, IOpenFileDialogService openFileDialogService, IDBService dBService) { _navigationService = navigationService; _openFileDialogService = openFileDialogService; _logService = loggerService; _dbService = dBService; ConfigNavigationCommands(); SelectProjectPlan = new RelayCommand(SelectProjectPlanCommand); AddProject = new RelayCommand(AddProjectCommand); OutputMessages = new ObservableCollection <OutputMessage>(); _ProjectInfo = new Project(); GetResources = new RelayCommand(GetResourcesCommand); Users = new ObservableCollection <string>(); }
public TournamentViewModel(ITournamentService tournamentService, ITournamentRepository tournamentRepository, IOpenFileDialogService openFileDialogService, ISaveFileDialogService saveFileDialogService, IWaitDialogService waitDialogService, IInfoDialogService infoDialogService) { _tournamentService = tournamentService; _tournamentRepository = tournamentRepository; _openFileDialogService = openFileDialogService; _saveFileDialogService = saveFileDialogService; _waitDialogService = waitDialogService; _infoDialogService = infoDialogService; FetchFromServerCommand = new RelayCommand(FetchFromServer); ClearTournamentsCommand = new RelayCommand(ClearTournaments); ClearCommand = new RelayCommand(() => UserSessionId = ""); SaveTournamentsCommand = new RelayCommand(SaveTournaments); UserSessionId = "Liitä wcusersessionid tähän"; Messenger.Default.Register <UserSessionIdChangedMessage>(this, message => { if (message.Sender != this && message.NewUserSessionId != _userSessionId) { UserSessionId = message.NewUserSessionId; } }); LoadStoredTournaments(); if (_tournamentRepository.GetAll().Count > 0) { StartDate = Tournaments.Max(t => t.StartTime); } else { StartDate = new DateTime(2010, 11, 1); } EndDate = DateTime.Now; }
/// <summary> /// Constructor. /// </summary> /// <param name="elManejadorDeMapa">El Manejador de Mapa.</param> /// <param name="lasVías">Las Vías.</param> /// <param name="elEscuchadorDeEstatus">El escuchador de estatus.</param> /// <param name="elServicioDiálogoAbrirArchivos">El servicio de diálogo para abrir archivos.</param> public ManejadorDeVías( ManejadorDeMapa elManejadorDeMapa, IList <Vía> lasVías, IEscuchadorDeEstatus elEscuchadorDeEstatus, IOpenFileDialogService elServicioDiálogoAbrirArchivos) : base(elManejadorDeMapa, lasVías, elEscuchadorDeEstatus) { // Crea los procesadores. ArregladorDeIndicesDeCiudad = new ArregladorDeIndicesDeCiudad(this, elEscuchadorDeEstatus); ArregladorGeneral = new ArregladorGeneral(this, elEscuchadorDeEstatus); BuscadorDeErrores = new BuscadorDeErrores(this, elEscuchadorDeEstatus); BuscadorDeAlertas = new BuscadorDeAlertas(this, elEscuchadorDeEstatus); BuscadorDePosiblesErroresDeRuteo = new BuscadorDePosiblesErroresDeRuteo(this, elEscuchadorDeEstatus); BuscadorDePosiblesNodosDesconectados = new BuscadorDePosiblesNodosDesconectados(this, elEscuchadorDeEstatus); RemplazadorDeNombresDeVias = new RemplazadorDeNombresDeVias(this, elEscuchadorDeEstatus, elServicioDiálogoAbrirArchivos); // Escucha eventos. elManejadorDeMapa.VíasModificadas += EnElementosModificados; }
/// <summary>コンストラクタ。</summary> /// <param name="dialogService">Prismのダイアログサービスを表すIDialogService。</param> public MainWindowViewModel(IDialogService dialogService, IOpenFileDialogService fileDialogService) { this.dlgService = dialogService; this.character = new BleachCharacter(); this.openFileDialogService = fileDialogService; this.ShowMessageButtonCommand = new ReactiveCommand() .WithSubscribe(this.onShowMessageButtonCommand); this.DialogMessage = new ReactivePropertySlim <string>(string.Empty); this.ShowBleachDialogCommand = new ReactiveCommand() .WithSubscribe(() => this.showBleachDialog()); this.BlearchCharacterCode = this.character.Code; this.BlearchCharacterCode.Where(v => v.Length == 3) .Subscribe(v => this.onCharacterCode(v)); this.BleachCharacterName = this.character.Name .ToReadOnlyReactiveProperty(); }
public ValidatorViewModel(ITabViewModelManager tabViewModelManager, IRecentFilesManager recentFiles, IPmmlValidator pmmlValidator, IOpenFileDialogService openFileDialogService, IGetFileNameService getFileNameService) { _tabViewModelManager = tabViewModelManager; _pmmlValidator = pmmlValidator; _openFileDialogService = openFileDialogService; _getFileNameService = getFileNameService; _recentFiles = recentFiles; BrowseFileCommand = new SimpleDelegateCommand(BrowseFile); ValidateCommand = new SimpleDelegateCommand(ValidateFile, CanValidate); _errorMessages = new ObservableCollection <IErrorMessage>(); ErrorMessages = new ReadOnlyObservableCollection <IErrorMessage>(_errorMessages); _outputWindowMessages = new ObservableCollection <string>(); OutputWindowMessages = new ReadOnlyObservableCollection <string>(_outputWindowMessages); }
/// <summary> /// コンストラクタ。 /// </summary> /// <param name="canModify"> /// 再生や音声保存に関わる設定値の変更可否状態値。 /// </param> /// <param name="config">設定値。</param> /// <param name="appConfig">アプリ設定値。</param> /// <param name="uiConfig">UI設定値。</param> /// <param name="lastStatus">直近のアプリ状態値の設定先。</param> /// <param name="openFileDialogService">ファイル選択ダイアログサービス。</param> public ExoConfigViewModel( IReadOnlyReactiveProperty <bool> canModify, IReadOnlyReactiveProperty <ExoConfig> config, IReadOnlyReactiveProperty <AppConfig> appConfig, IReadOnlyReactiveProperty <UIConfig> uiConfig, IReactiveProperty <IAppStatus> lastStatus, IOpenFileDialogService openFileDialogService) : base(canModify, config) { ValidateArgumentNull(appConfig, nameof(appConfig)); ValidateArgumentNull(uiConfig, nameof(uiConfig)); ValidateArgumentNull(lastStatus, nameof(lastStatus)); ValidateArgumentNull(openFileDialogService, nameof(openFileDialogService)); this.AppConfig = appConfig; this.LastStatus = lastStatus; // 選択中タブインデックス this.SelectedTabIndex = this.MakeInnerPropertyOf(uiConfig, c => c.ExoConfigTabIndex); // 共通設定 this.Common = this.MakeConfigProperty(c => c.Common); // キャラ別スタイル設定コレクション var charaStyles = this.MakeReadOnlyConfigProperty( c => c.CharaStyles, notifyOnSameValue: true); // 表示状態のキャラ別スタイル設定コレクション this.VisibleCharaStyles = Observable .CombineLatest( appConfig.ObserveInnerProperty(c => c.VoiceroidVisibilities), charaStyles.Select(s => s.Count()).DistinctUntilChanged(), (vv, _) => vv.SelectVisibleOf(charaStyles.Value)) .ToReadOnlyReactiveProperty() .AddTo(this.CompositeDisposable); // キャラ別スタイル設定選択コマンド実行可能状態 // 表示状態のキャラ別スタイル設定が2つ以上あれば選択可能 this.IsSelectCharaStyleCommandExecutable = this.VisibleCharaStyles .Select(vcs => vcs.Count >= 2) .ToReadOnlyReactiveProperty() .AddTo(this.CompositeDisposable); // キャラ別スタイル設定選択コマンドのチップテキスト this.SelectCharaStyleCommandTip = this.VisibleCharaStyles .Select(_ => this.MakeSelectCharaStyleCommandTip()) .ToReadOnlyReactiveProperty() .AddTo(this.CompositeDisposable); // 最適表示列数 // 6キャラ単位で列数を増やす this.VisibleCharaStylesColumnCount = this.VisibleCharaStyles .Select(vp => Math.Min(Math.Max(1, (vp.Count + 5) / 6), 3)) .ToReadOnlyReactiveProperty() .AddTo(this.CompositeDisposable); // 選択中キャラ別スタイル this.SelectedCharaStyle = new ReactiveProperty <ExoCharaStyle>(this.VisibleCharaStyles.Value.First()) .AddTo(this.CompositeDisposable); // UI設定周りのセットアップ this.SetupUIConfig(uiConfig); // 選択中キャラ別スタイル ViewModel 作成 this.SelectedCharaStyleViewModel = new ExoCharaStyleViewModel( this.CanModify, this.SelectedCharaStyle, uiConfig, this.LastStatus, openFileDialogService) .AddTo(this.CompositeDisposable); // ファイル作成設定有効化コマンド表示状態 this.IsFileMakingCommandInvisible = this.MakeInnerReadOnlyPropertyOf(this.AppConfig, c => c.IsExoFileMaking); this.IsFileMakingCommandVisible = this.IsFileMakingCommandInvisible .Inverse() .ToReadOnlyReactiveProperty() .AddTo(this.CompositeDisposable); // ファイル作成設定有効化コマンド this.FileMakingCommand = this.MakeCommand( this.ExecuteFileMakingCommand, this.CanModify, this.IsFileMakingCommandVisible); // キャラ別スタイル設定選択コマンドコレクション(要素数 10 固定) this.SelectCharaStyleCommands = new ReadOnlyCollection <ICommand>( Enumerable.Range(0, 10) .Select( index => this.MakeCommand( () => this.ExecuteSelectCharaStyleCommand(index), this.IsSelectCharaStyleCommandExecutable, this.VisibleCharaStyles .Select(vcs => index < vcs.Count) .DistinctUntilChanged())) .ToArray()); // 前方/後方キャラ別スタイル設定選択コマンド this.SelectPreviousCharaStyleCommand = this.MakeCommand( this.ExecuteSelectPreviousCharaStyleCommand, this.IsSelectCharaStyleCommandExecutable); this.SelectNextCharaStyleCommand = this.MakeCommand( this.ExecuteSelectNextCharaStyleCommand, this.IsSelectCharaStyleCommandExecutable); }
static void VerifyService(IOpenFileDialogService service) { if(service == null) throw new ArgumentNullException("service"); }
public LoadCommand(IOpenFileDialogService openFileDialogService) { Contract.Requires(openFileDialogService != null); this.openFileDialogService = openFileDialogService; }
private void InitializeServices( IEventAggregator eventAggregatorArg, ISaveDialogService saveDialogServiceArg, IOpenFileDialogService openFileDialogServiceArg, IAppConfigMapper configMapper, IShowInfoMessage showMessage) { if (eventAggregatorArg == null) { throw new ArgumentNullException("eventAggregatorArg"); } if (saveDialogServiceArg == null) { throw new ArgumentNullException("saveDialogServiceArg"); } if (openFileDialogServiceArg == null) { throw new ArgumentNullException("openFileDialogServiceArg"); } if (configMapper == null) { throw new ArgumentNullException("configMapper"); } if (showMessage == null) { throw new ArgumentNullException("showMessage"); } showInfoMessage = showMessage; saveDialogService = saveDialogServiceArg; openFileDialogService = openFileDialogServiceArg; eventAggregator = eventAggregatorArg; appConfigMapper = configMapper; }
public static string GetFullFileName(this IOpenFileDialogService service) { VerifyService(service); return(service.File.Return(x => x.GetFullName(), () => string.Empty)); }