public Common.Model.Wallpaper Insert(WallpaperInformation information, Guid idOfRawValue, WallpaperFileWithData[] files) { information.Created = DateTime.Now; var entity = new Common.Model.Wallpaper { Information = information, RawInformations = idOfRawValue }; foreach (var file in files) { file.FileDto.FileId = Guid.NewGuid(); entity.Files.Add(file.FileDto); _dataRepository.Insert(new WallpaperData { Data = file.Data, WallpaperId = entity.Id, Id = file.FileDto.FileId }); } var result = _repository.Insert(entity); if (result) { EventService.Publish(new EntityInsertedMessage(typeof(Common.Model.Wallpaper), entity.Id)); } return(entity); }
public WallpaperLoadResult(WallpaperInformation information, WorkItem rawValues, WallpaperFileWithData[] data) { Information = information; RawValues = rawValues; Data = data; }
public WallpaperItemViewModel(DisplayOrientations orientation, WallpaperInformation source) { this.Orientation = orientation; this.Source = source; this.FileSelectCommand = new ReactiveCommand().AddTo(this.unsubscribers); this.FileSelectCommand.Subscribe(x => { //ファイルを選択しパスを取得 OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.FilterIndex = 1; openFileDialog.Filter = "Image File(*.bmp, *.png, *.jpg, *.jpeg, *.gif)|*.bmp;*.png;*.jpg;*.jpeg;*.gif|All Files (*.*)|*.*"; var result = openFileDialog.ShowDialog(); if (result.Value) { this.Source.Path = openFileDialog.FileName; } }).AddTo(this.unsubscribers); if (_positionsList == null) { //壁紙表示方法の一覧をenumから生成 _positionsList = Enum.GetValues(typeof(DesktopWallpaperPosition)) .AsEnumerable <DesktopWallpaperPosition>() .Select(x => new WallpaperPositionItem(x.ToString(), x)) .ToList(); } this.PositionIndex = this.Source .ToReactivePropertyAsSynchronized(x => x.Position, x => this.PositionsList.FindIndex(y => y.Position == x), x => this.PositionsList.ContainsIndex(x) ? this.PositionsList[x].Position : DesktopWallpaperPosition.Fill) .AddTo(this.unsubscribers); }