public SettingsViewModel(SettingModel settingModel, Action close) { AddImageCommand = new RelayCommand((obj) => { var dialog = new OpenFileDialog { Filter = "Image Files(*.BMP; *.JPG; *.GIF) | *.BMP; *.JPG; *.GIF | All files(*.*) | *.*", CheckFileExists = true, Multiselect = true }; if (dialog.ShowDialog() == true) { foreach (var name in dialog.FileNames) { ImagesPath.Add(name); } } }); SubmitCommand = new RelayCommand((obj) => { settingModel.IsTime = IsTime; settingModel.IsMouse = IsMouse; settingModel.IsViewPort = IsViewPort; settingModel.ImagesPath = ImagesPath; close(); }); }
public override bool Equals(object obj) { return(obj is LodgingModelForResponse response && Name == response.Name && Description == response.Description && QuantityOfStars == response.QuantityOfStars && Address == response.Address && ImagesPath.SequenceEqual(response.ImagesPath) && PricePerNight == response.PricePerNight && ReviewsAverageScore == response.ReviewsAverageScore && ReviewsForLodging.SequenceEqual(response.ReviewsForLodging) && LodgingTouristSpotModel.Equals(response.LodgingTouristSpotModel)); }
public ImagesPath ImagePathByArrange(BotArrange arrange, string subFolder = null, string fullPath = null) { string tmpCurrent; string path; var images = new ImagesPath(); //var rootDir = DirSwitcher.BotForecast.ToString(); var parts = _location.Split(Path.DirectorySeparatorChar); Array.Resize(ref parts, parts.Length - 1); var locStr = new StringBuilder(); foreach (var part in parts) { locStr.Append(part); //, Path.DirectorySeparatorChar.ToString()); locStr.Append(Path.DirectorySeparatorChar.ToString()); } var loc = locStr.ToString(); var time = fullPath.Split(Path.DirectorySeparatorChar); tmpCurrent = LastDirAuto(Path.Combine(loc)).Split(Path.DirectorySeparatorChar).Last(); path = Path.Combine(tmpCurrent, _botForecast); images.ForecastImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, path, time.Last(), arrange.ToString(), subFolder, Static.ForecastFile); images.ComponentsImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, path, time.Last(), arrange.ToString(), subFolder, Static.ComponentsFile); return(images); }
public ImagesPath ImagePath(DirSwitcher switcher, Indicator?indicator = null, string subFolder = null, string fullPath = null) { string tmpCurrent; string path; var images = new ImagesPath(); switch (switcher) { case DirSwitcher.Auto: var parts = _location.Split(Path.DirectorySeparatorChar); Array.Resize(ref parts, parts.Length - 1); var locStr = new StringBuilder(); foreach (var part in parts) { locStr.Append(part); //, Path.DirectorySeparatorChar.ToString()); locStr.Append(Path.DirectorySeparatorChar.ToString()); } var loc = locStr.ToString(); var time = fullPath.Split(Path.DirectorySeparatorChar); tmpCurrent = LastDirAuto(Path.Combine(loc)).Split(Path.DirectorySeparatorChar).Last(); path = Path.Combine(tmpCurrent, _automatic); images.ForecastImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, path, time.Last(), indicator.ToString(), subFolder, Static.ForecastFile); images.ComponentsImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, path, time.Last(), indicator.ToString(), subFolder, Static.ComponentsFile); break; case DirSwitcher.Manual: tmpCurrent = LastDir(Path.Combine(_location, _manual)).Split(Path.DirectorySeparatorChar).Last(); path = Path.Combine(_manual, tmpCurrent); images.ForecastImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, _todayDate, path, Static.ForecastFile); images.ComponentsImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, _todayDate, path, Static.ComponentsFile); break; case DirSwitcher.Instant: tmpCurrent = LastDir(Path.Combine(_location, _instant)).Split(Path.DirectorySeparatorChar).Last(); path = Path.Combine(_instant, tmpCurrent); images.ForecastImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, _todayDate, path, Static.ForecastFile); images.ComponentsImage = Path.Combine(Path.DirectorySeparatorChar.ToString(), _settings.ForecastDir, _todayDate, path, Static.ComponentsFile); break; default: throw new ArgumentOutOfRangeException(nameof(switcher), switcher, null); } return(images); }