diff --git a/SepidarSidebar/MainWindow.xaml b/SepidarSidebar/MainWindow.xaml
index 5e72247..b610267 100644
--- a/SepidarSidebar/MainWindow.xaml
+++ b/SepidarSidebar/MainWindow.xaml
@@ -43,7 +43,12 @@
-
+
+
+
+
+
+
diff --git a/SepidarSidebar/MainWindow.xaml.cs b/SepidarSidebar/MainWindow.xaml.cs
index d7343ef..4869794 100644
--- a/SepidarSidebar/MainWindow.xaml.cs
+++ b/SepidarSidebar/MainWindow.xaml.cs
@@ -20,9 +20,13 @@ namespace SG.SepidarSidebar
///
public partial class MainWindow : Window
{
+ private MainWindowViewModel _viewModel;
public MainWindow()
{
InitializeComponent();
+
+ _viewModel = new MainWindowViewModel();
+ this.DataContext = _viewModel;
}
protected override void OnMouseDown(MouseButtonEventArgs e)
@@ -32,5 +36,56 @@ protected override void OnMouseDown(MouseButtonEventArgs e)
if (e.LeftButton == MouseButtonState.Pressed && e.RightButton == MouseButtonState.Released)
this.DragMove();
}
+
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ base.OnKeyDown(e);
+
+ if (e.Key == Key.D0)
+ ResetTransforms();
+ else if (e.Key == Key.OemPlus)
+ {
+ double w = this.Width * 1.5;
+ double sw = SystemParameters.PrimaryScreenWidth, sh = SystemParameters.PrimaryScreenHeight;
+ if (w > sw || w > sh)
+ w = Math.Min(sw, sh);
+ this.Width = this.Height = w;
+ }
+ else if (e.Key == Key.OemMinus)
+ {
+ if (this.Width > 20)
+ {
+ this.Width = this.Height = this.Width / 1.5;
+ }
+ }
+ else if (e.Key == Key.Right)
+ {
+ if (_viewModel.VerticalRotationDegree < 50)
+ _viewModel.VerticalRotationDegree += 5;
+ }
+ else if (e.Key == Key.Left)
+ {
+ if (_viewModel.VerticalRotationDegree > -50)
+ _viewModel.VerticalRotationDegree -= 5;
+ }
+ else if (e.Key == Key.Down)
+ {
+ if (_viewModel.HorizontalRotationDegree < 50)
+ _viewModel.HorizontalRotationDegree += 5;
+ }
+ else if (e.Key == Key.Up)
+ {
+ if (_viewModel.HorizontalRotationDegree > -50)
+ _viewModel.HorizontalRotationDegree -= 5;
+ }
+ }
+
+ public void ResetTransforms()
+ {
+ _viewModel.HorizontalRotationDegree = 0;
+ _viewModel.VerticalRotationDegree = -17;
+ Width = 250;
+ Height = 250;
+ }
}
}
diff --git a/SepidarSidebar/MainWindowViewModel.cs b/SepidarSidebar/MainWindowViewModel.cs
new file mode 100644
index 0000000..d0d84b2
--- /dev/null
+++ b/SepidarSidebar/MainWindowViewModel.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace SG.SepidarSidebar
+{
+ public class MainWindowViewModel : ViewModelBase
+ {
+ private double _verticalRotationDegree = -17;
+ private double _horizontalRotationDegree = 0;
+
+ public double VerticalRotationDegree
+ {
+ get { return _verticalRotationDegree; }
+ set
+ {
+ if (_verticalRotationDegree != value)
+ {
+ _verticalRotationDegree = value;
+ OnPropertyChanged("VerticalRotationDegree");
+ }
+ }
+ }
+
+ public double HorizontalRotationDegree
+ {
+ get { return _horizontalRotationDegree; }
+ set
+ {
+ if (_horizontalRotationDegree != value)
+ {
+ _horizontalRotationDegree = value;
+ OnPropertyChanged("HorizontalRotationDegree");
+ }
+ }
+ }
+
+ }
+}
diff --git a/SepidarSidebar/SepidarSidebar.csproj b/SepidarSidebar/SepidarSidebar.csproj
index dfc4587..f3af600 100644
--- a/SepidarSidebar/SepidarSidebar.csproj
+++ b/SepidarSidebar/SepidarSidebar.csproj
@@ -54,6 +54,7 @@
MSBuild:Compile
Designer
+
Designer