Skip to content

Commit

Permalink
view model
Browse files Browse the repository at this point in the history
  • Loading branch information
michasacuer committed Nov 4, 2019
1 parent 391cf47 commit 73c760c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
17 changes: 16 additions & 1 deletion WPF/Thinning.UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Caliburn.Micro;
using Thinning.UI.Helpers;
using Thinning.UI.Helpers.Interfaces;
using Thinning.UI.Views;

public class MainWindowViewModel : Conductor<IScreen>.Collection.AllActive
{
Expand All @@ -31,10 +32,24 @@ public MainWindowViewModel(IMainWindowViewModelHelper helper)

public string ImageInfo { get; set; }

public int SelectedIterationsCount { get; set; }
public int SelectedIterationsCount { get; set; } = 10;

public List<int> IterationsList { get; set; } = new List<int>(new int[] { 10, 20, 30, 40, 50, 70, 80 });

public List<int> ZoomPicker { get; set; } = new List<int>(new int[] { 2, 3, 4, 5 });

private int selectedZoomPicker = 2;

public int SelectedZoomPicker
{
get => selectedZoomPicker;
set
{
selectedZoomPicker = value;
ViewBoxTracking.ZoomFactor = value;
}
}

public void LoadImage() => this.helper.LoadImage();

public async void RunAlgorithms() => this.helper.RunAlgorithms();
Expand Down
11 changes: 10 additions & 1 deletion WPF/Thinning.UI/Views/MainWindowView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<TextBlock
Margin="10"
FontSize="14"
Text="Iterations:"
Text="Iterations: Zoom:"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Style="{DynamicResource MaterialDesignTitleTextBlock}">
Expand All @@ -72,6 +72,15 @@
Width="50"
FontSize="14"
Grid.Row="1"
Margin="-120, 0, 0, -240">
</ComboBox>

<ComboBox
x:Name="ZoomPicker"
SelectedValue="{Binding Path=SelectedZoomPicker, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Width="50"
FontSize="14"
Grid.Row="1"
Margin="270, 0, 0, -240">
</ComboBox>

Expand Down
2 changes: 1 addition & 1 deletion WPF/Thinning.UI/Views/ViewBoxTracking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class ViewBoxTracking

public static UIElement GetSource(TileBrush brush) => (UIElement)brush.GetValue(SourceProperty);

private const int ZoomFactor = 3;
public static int ZoomFactor = 3;

private static void SourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs ea)
{
Expand Down

0 comments on commit 73c760c

Please sign in to comment.