diff --git a/SlimViewer/MainWindow.xaml b/SlimViewer/MainWindow.xaml index 053cb21..b938b5d 100644 --- a/SlimViewer/MainWindow.xaml +++ b/SlimViewer/MainWindow.xaml @@ -292,7 +292,7 @@ - Autoplay Gif + Autoplay Gif @@ -312,7 +312,7 @@ - @@ -330,8 +330,8 @@ IsTabStop="True" ItemsSource="{Binding Bmp}" ImageGifPath="{Binding GifPath}" - Name="ImageZoom" - SelectionTool="{Binding ImageZoomTool, Mode=TwoWay}" + x:Name="ImageControl" + SelectionTool="{Binding ImageZoomTool}" SelectedFrameCommand="{Binding SelectedFrameCommand}" SelectedPointCommand="{Binding SelectedPointCommand}" /> diff --git a/SlimViewer/MainWindow.xaml.cs b/SlimViewer/MainWindow.xaml.cs index f09c22f..66e2912 100644 --- a/SlimViewer/MainWindow.xaml.cs +++ b/SlimViewer/MainWindow.xaml.cs @@ -40,12 +40,13 @@ private void Window_Loaded(object sender, RoutedEventArgs e) SlimViewerRegister.SetRegister(obj); + //TODO rework and set: View = new ImageView(obj.MainSubFolders, obj.MainCompressCif, obj.MainSimilarity, - obj.MainAutoClean) { Main = this, Thumb = Thumbnail, Picker = ColorPick, ImageZoom = ImageZoom }; + obj.MainAutoClean, ImageControl) { Main = this, Thumb = Thumbnail, Picker = ColorPick }; DataContext = View; - ImageZoom.AutoplayGifImage = obj.MainAutoPlayGif; + ImageControl.AutoplayGifImage = obj.MainAutoPlayGif; } /// diff --git a/SlimViews/ImageView.cs b/SlimViews/ImageView.cs index 5242558..a089069 100644 --- a/SlimViews/ImageView.cs +++ b/SlimViews/ImageView.cs @@ -453,12 +453,14 @@ public ImageView() /// if set to true [compress cif]. /// The similarity. /// if set to true [automatic clean]. - public ImageView(bool subFolders, bool compressCif, int similarity, bool autoClean) + /// + public ImageView(bool subFolders, bool compressCif, int similarity, bool autoClean, ImageZoom imageZoom) { SubFolders = subFolders; Compress = compressCif; Similarity = similarity; AutoClean = autoClean; + ImageZoomControl = imageZoom; Initialize(); } @@ -1273,7 +1275,7 @@ public ImageZoomTools ImageZoomTool /// /// The image zoom. /// - public ImageZoom ImageZoom { get; init; } + public ImageZoom ImageZoomControl { get; set; } /// /// Initializes this instance. @@ -1301,6 +1303,7 @@ private void Initialize() { Key.Right, NextCommand } }; + PropertyChanged += OnPropertyChanged; } @@ -1339,7 +1342,7 @@ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) CurrentFilter = Translator.GetFilterFromString(SelectedFilter); break; case nameof(SelectedToolType): - ImageZoomTool = Translator.GetToolsFromString(SelectedToolType); + if (ImageZoomControl != null) ImageZoomControl.SelectionTool = Translator.GetToolsFromString(SelectedToolType); break; } } @@ -1436,7 +1439,7 @@ private void ColorChangedAction(ColorHsv colorHsv) private void CloseAction(object obj) { var config = SlimViewerRegister.GetRegister(); - config.MainAutoPlayGif = ImageZoom.AutoplayGifImage; + config.MainAutoPlayGif = ImageZoomControl.AutoplayGifImage; Config.SetConfig(config); if (AutoClean) CleanTempAction(true);