Skip to content

Commit 8c2e9a0

Browse files
committed
some fix and refactoring
1 parent 05ba928 commit 8c2e9a0

File tree

14 files changed

+216
-412
lines changed

14 files changed

+216
-412
lines changed

SimpleStateMachineNodeEditor/Helpers/Logging/WithLogging.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

SimpleStateMachineNodeEditor/Helpers/MyPoint.cs

Lines changed: 0 additions & 179 deletions
This file was deleted.

SimpleStateMachineNodeEditor/View/MainWindow.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ private void ShowError()
185185
this.ErrorListExpander.IsExpanded = true;
186186
ErrorListExpanded();
187187
}
188-
//this.ErrorListExpander.RaiseEvent(new RoutedEventArgs(Expander.ExpandedEvent));
189-
//this.ErrorListExpander.IsExpanded = true;
190-
191188
}
192189

193190
private void ButtonMinClick(RoutedEventArgs e)

SimpleStateMachineNodeEditor/View/ViewNode.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ private void OnEventMouseUp(MouseButtonEventArgs e)
146146
}
147147
private void OnEventCollapse(bool isCollapse)
148148
{
149-
//bool visible = (this.NodeHeaderElement.ButtonRotate.Angle != 0);
150149
this.NodeHeaderElement.ButtonRotate.Angle = isCollapse ? 180 : 0;
151150
}
152151
#endregion Setup Events

SimpleStateMachineNodeEditor/View/ViewRightConnector.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ private void SetupEvents()
100100
this.TextBoxElement.Events().LostFocus.Subscribe(e => Validate(e)).DisposeWith(disposable);
101101
this.BorderElement.Events().PreviewMouseLeftButtonDown.Subscribe(e => ConnectorDrag(e)).DisposeWith(disposable);
102102
this.BorderElement.Events().PreviewDragEnter.Subscribe(e => ConnectorDragEnter(e)).DisposeWith(disposable);
103+
this.BorderElement.Events().PreviewDragOver.Subscribe(e => e.Handled = true).DisposeWith(disposable);
103104
this.BorderElement.Events().PreviewDrop.Subscribe(e => ConnectorDrop(e)).DisposeWith(disposable);
104105
});
105106
}
@@ -128,7 +129,7 @@ private void ConnectDrag(MouseButtonEventArgs e)
128129
this.ViewModel.CommandConnectPointDrag.ExecuteWithSubscribe();
129130
DataObject data = new DataObject();
130131
data.SetData("Node", this.ViewModel.Node);
131-
DragDrop.DoDragDrop(this, data, DragDropEffects.Link);
132+
DragDrop.DoDragDrop(this, data, DragDropEffects.Copy);
132133
this.ViewModel.CommandCheckConnectPointDrop.ExecuteWithSubscribe();
133134
e.Handled = true;
134135
}
@@ -143,7 +144,7 @@ private void ConnectorDrag(MouseButtonEventArgs e)
143144
this.ViewModel.CommandConnectorDrag.ExecuteWithSubscribe();
144145
DataObject data = new DataObject();
145146
data.SetData("Connector", this.ViewModel);
146-
DragDrop.DoDragDrop(this, data, DragDropEffects.Link);
147+
DragDrop.DoDragDrop(this, data, DragDropEffects.Copy);
147148
}
148149
else if (Keyboard.IsKeyDown(Key.LeftShift))
149150
{
@@ -168,9 +169,7 @@ private void ConnectorDragEnter(DragEventArgs e)
168169

169170
if (this.ViewModel.NodesCanvas.ConnectorPreviewForDrop == this.ViewModel)
170171
return;
171-
172172
this.ViewModel.CommandConnectorDragEnter.ExecuteWithSubscribe();
173-
174173
e.Handled = true;
175174
}
176175
private void ConnectorDrop(DragEventArgs e)

SimpleStateMachineNodeEditor/ViewModel/Connect/ViewModelConnect.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ private void Select(bool value)
7474
//this.StrokeDashArray = value ? new DoubleCollection() { 10, 3 } : null;
7575
this.Stroke = Application.Current.Resources[value ? "ColorSelectedElement": "ColorConnect"] as SolidColorBrush;
7676
}
77-
private void ToConnectChanged()
78-
{
79-
EndPointUpdate(ToConnector.PositionConnectPoint);
80-
}
8177
private void StartPointUpdate(Point point)
8278
{
8379
StartPoint = point;

SimpleStateMachineNodeEditor/ViewModel/Connector/ViewModelConnectorCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Reactive;
77
using System.Windows;
8+
using System.Windows.Input;
89
using System.Windows.Media;
910

1011
namespace SimpleStateMachineNodeEditor.ViewModel
@@ -106,7 +107,6 @@ private void ConnectorDragEnter()
106107
int indexTo = Node.Transitions.IndexOf(this);
107108
if (indexTo == 0)
108109
return;
109-
110110
int count = this.Node.Transitions.Count;
111111
int indexFrom = this.Node.Transitions.IndexOf(this.NodesCanvas.ConnectorPreviewForDrop);
112112

SimpleStateMachineNodeEditor/ViewModel/Cutter/ViewModelCutter.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
using System;
66
using System.Reactive.Linq;
7-
using System.Reactive;
87
using System.Windows;
98

109
namespace SimpleStateMachineNodeEditor.ViewModel
1110
{
12-
public class ViewModelCutter : ReactiveObject
11+
public partial class ViewModelCutter : ReactiveObject
1312
{
1413
[Reactive] public ViewModelNodesCanvas NodesCanvas { get; set; }
1514
[Reactive] public bool? Visible { get; set; } = false;
@@ -32,21 +31,5 @@ private void SetupSubscriptions()
3231
}
3332

3433
#endregion Setup Subscriptions
35-
36-
#region Setup Commands
37-
public ReactiveCommand<Point, Unit> CommandStartCut { get; set; }
38-
39-
private void SetupCommands()
40-
{
41-
CommandStartCut = ReactiveCommand.Create<Point>(StartCut);
42-
}
43-
44-
private void StartCut(Point point)
45-
{
46-
Visible = true;
47-
StartPoint = point;
48-
}
49-
50-
#endregion Setup Commands
5134
}
5235
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using ReactiveUI;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Reactive;
5+
using System.Text;
6+
using System.Windows;
7+
8+
namespace SimpleStateMachineNodeEditor.ViewModel
9+
{
10+
public partial class ViewModelCutter
11+
{
12+
public ReactiveCommand<Point, Unit> CommandStartCut { get; set; }
13+
14+
private void SetupCommands()
15+
{
16+
CommandStartCut = ReactiveCommand.Create<Point>(StartCut);
17+
}
18+
19+
private void StartCut(Point point)
20+
{
21+
Visible = true;
22+
StartPoint = point;
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)