|
@@ -28,7 +28,20 @@ namespace SketchAssistantWPF
|
|
|
{
|
|
|
public MainWindow()
|
|
|
{
|
|
|
+ bool InDebugMode = false;
|
|
|
+ String[] commArgs = Environment.GetCommandLineArgs();
|
|
|
InitializeComponent();
|
|
|
+ if (commArgs.Length > 1)
|
|
|
+ {
|
|
|
+ if (commArgs[1].Equals("-debug"))
|
|
|
+ {
|
|
|
+ InDebugMode = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!InDebugMode)
|
|
|
+ {
|
|
|
+ DebugMode.Visibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
ProgramPresenter = new MVP_Presenter(this);
|
|
|
|
|
|
dispatcherTimer = new DispatcherTimer(DispatcherPriority.Render);
|
|
@@ -66,6 +79,14 @@ namespace SketchAssistantWPF
|
|
|
|
|
|
|
|
|
Polyline currentLine;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ bool debugRunning = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ DebugData debugDat = new DebugData();
|
|
|
|
|
|
|
|
|
|
|
@@ -118,6 +139,7 @@ namespace SketchAssistantWPF
|
|
|
private void RightCanvas_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
{
|
|
|
ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Down);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -126,6 +148,7 @@ namespace SketchAssistantWPF
|
|
|
private void RightCanvas_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
{
|
|
|
ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Up);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -150,6 +173,7 @@ namespace SketchAssistantWPF
|
|
|
private void RightCanvas_MouseMove(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, e.GetPosition(RightCanvas));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -164,17 +188,20 @@ namespace SketchAssistantWPF
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
- private void DebugButton(object sender, RoutedEventArgs e)
|
|
|
+ private void DebugOne_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- dispatcherTimer.Stop();
|
|
|
- ProgramPresenter.NewCanvas(); Thread.Sleep(50); ProgramPresenter.Tick(); Thread.Sleep(200);
|
|
|
- ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, new Point(20,20)); Thread.Sleep(50); ProgramPresenter.Tick(); Thread.Sleep(50);
|
|
|
- ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Down); Thread.Sleep(50); ProgramPresenter.Tick(); Thread.Sleep(50);
|
|
|
- ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, new Point(200, 200)); Thread.Sleep(50); ProgramPresenter.Tick(); Thread.Sleep(50);
|
|
|
- ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, new Point(30, 80)); Thread.Sleep(50); ProgramPresenter.Tick(); Thread.Sleep(50);
|
|
|
- ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Up); Thread.Sleep(50); ProgramPresenter.Tick(); Thread.Sleep(50);
|
|
|
- dispatcherTimer.Start();
|
|
|
+ Debug(1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void DebugTwo_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ Debug(2);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -183,6 +210,7 @@ namespace SketchAssistantWPF
|
|
|
private void dispatcherTimer_Tick(object sender, EventArgs e)
|
|
|
{
|
|
|
ProgramPresenter.Tick();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -212,7 +240,9 @@ namespace SketchAssistantWPF
|
|
|
|
|
|
public bool IsMousePressed()
|
|
|
{
|
|
|
- return (Mouse.LeftButton.Equals(MouseButtonState.Pressed) || Mouse.RightButton.Equals(MouseButtonState.Pressed));
|
|
|
+ if (!debugRunning) {
|
|
|
+ return (Mouse.LeftButton.Equals(MouseButtonState.Pressed) || Mouse.RightButton.Equals(MouseButtonState.Pressed)); }
|
|
|
+ else return true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -461,5 +491,41 @@ namespace SketchAssistantWPF
|
|
|
canvas.Background = Brushes.SlateGray;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private async void Debug(int option)
|
|
|
+ {
|
|
|
+ Point[] points;
|
|
|
+ if (option == 1)
|
|
|
+ points = debugDat.debugPoints1;
|
|
|
+ else if (option == 2)
|
|
|
+ points = debugDat.debugPoints2;
|
|
|
+ else { return; }
|
|
|
+ dispatcherTimer.Stop();
|
|
|
+ debugRunning = true;
|
|
|
+ ProgramPresenter.Tick(); await Task.Delay(10);
|
|
|
+ ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, new Point(50, 50));
|
|
|
+ ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Down); await Task.Delay(10);
|
|
|
+ for (int x = 0; x < points.Length; x++)
|
|
|
+ {
|
|
|
+ ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, points[x]);
|
|
|
+ await Task.Delay(1);
|
|
|
+ if (x % 5 == 0)
|
|
|
+ {
|
|
|
+ ProgramPresenter.Tick();
|
|
|
+ await Task.Delay(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Up); await Task.Delay(1);
|
|
|
+ debugRunning = false;
|
|
|
+ dispatcherTimer.Start();
|
|
|
+ }
|
|
|
}
|
|
|
}
|