Skip to content

Commit

Permalink
Updated MainWindow and StartupDialog Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDavies8 committed Feb 8, 2022
1 parent 92ce03f commit a8605c2
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 25 deletions.
Binary file modified .vs/Dynamo/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
10 changes: 10 additions & 0 deletions Dynamo/Dynamo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<None Remove="alps-canvas.png" />
</ItemGroup>

<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
Expand All @@ -30,4 +34,10 @@
<ProjectReference Include="..\NodeGraph\NodeGraph.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="alps-canvas.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>

</Project>
4 changes: 3 additions & 1 deletion Dynamo/Dynamo.csproj.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup>
<_LastSelectedProfileId>D:\Programming\C#\Dynamo\Dynamo\Properties\PublishProfiles\ClickOnceProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<SubType>Designer</SubType>
Expand Down
2 changes: 1 addition & 1 deletion Dynamo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:v="clr-namespace:Dynamo.View"
xmlns:pt="http://propertytools.org/wpf"
mc:Ignorable="d"
Title=" Dynamo" Height="450" Width="800">
Title=" Dynamo" Height="700" Width="1200" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
Expand Down
37 changes: 27 additions & 10 deletions Dynamo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.Win32;
using System.Linq;
using System.Windows.Media.Effects;
using System.Windows.Input;

namespace Dynamo
{
Expand Down Expand Up @@ -67,10 +68,6 @@ public MainWindow()

private void Window_Loaded(object sender, RoutedEventArgs e)
{
Flowchart flowchart = NodeGraphManager.CreateFlowchart(Guid.NewGuid());
FlowchartViewModel = flowchart.ViewModel;
NodeGraphManager.BuildFlowchartContextMenu = BuildFlowchartContextMenu;

PropertyPanel propertyPanel = new PropertyPanel();
ViewModel.PropertyPanelViewModel propertyPanelViewModel = new ViewModel.PropertyPanelViewModel(propertyPanel);
PropertyPanelViewModel = propertyPanelViewModel;
Expand Down Expand Up @@ -102,13 +99,17 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
Opacity = 1;
Effect = null;
};
startupWindow.NewProjectCallback += () => startupWindow.Close();
startupWindow.OpenProjectCallback += () =>
startupWindow.NewProjectCallback += () =>
{
OpenButtonClick(null, null);
// Check if project actually opened
NewFile();
startupWindow.Close();
};
startupWindow.OpenProjectCallback += () =>
{
OpenFile();
if (_projectPath != null)
startupWindow.Close();
};

startupWindow.Show();
}
Expand Down Expand Up @@ -299,6 +300,7 @@ private void OpenFile()
var path = openFileDialog.FileName;
if (System.IO.File.Exists(path))
{
Mouse.OverrideCursor = Cursors.Wait;
bool temp = ExecutionManager.AutoExecute;
ExecutionManager.AutoExecute = false;

Expand All @@ -311,6 +313,10 @@ private void OpenFile()

Title = $" Dynamo ({System.IO.Path.GetFileNameWithoutExtension(path)})";

Mouse.OverrideCursor = null;

Activate();

_projectPath = path;
}
}
Expand All @@ -320,12 +326,23 @@ private void NewFile()
{
bool temp = ExecutionManager.AutoExecute;
ExecutionManager.AutoExecute = false;
Mouse.OverrideCursor = Cursors.Wait;

NodeGraphManager.DestroyFlowchart(FlowchartViewModel.Model.Guid);
if (FlowchartViewModel != null)
{
NodeGraphManager.DestroyFlowchart(FlowchartViewModel.Model.Guid);

ExecutionManager.ResolveDirtyNodes();
ExecutionManager.ResolveDirtyNodes();
}

Flowchart flowchart = NodeGraphManager.CreateFlowchart(Guid.NewGuid());
FlowchartViewModel = flowchart.ViewModel;
NodeGraphManager.BuildFlowchartContextMenu = BuildFlowchartContextMenu;

ExecutionManager.AutoExecute = temp;
Mouse.OverrideCursor = null;

Activate();

Title = $" Dynamo (Unnamed Project)";
}
Expand Down
26 changes: 14 additions & 12 deletions Dynamo/StartupDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Dynamo"
mc:Ignorable="d"
Title="StartupDialog" Height="300" Width="500" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" Topmost="True">
Title="StartupDialog" Height="300" Width="500" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True">
<Grid>
<Border CornerRadius="4">
<Grid>
Expand All @@ -27,17 +27,19 @@
</Rectangle.Fill>
</Rectangle>
<TextBlock Grid.Column="0" Foreground="{StaticResource ForegroundStrongColour}" FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Rubik Medium">Dynamo</TextBlock>
<Grid Grid.Column="1" Background="{StaticResource BackgroundColour}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Style="{StaticResource AppbarButton}" Click="NewProject">New Project</Button>
<Button Grid.Row="1" Style="{StaticResource AppbarButton}" Click="OpenProject">Open Project</Button>
<Button Grid.Row="3" Style="{StaticResource AppbarButton}" Click="ExitProgram">Exit</Button>
</Grid>
<Border Grid.Column="1" Background="{StaticResource BackgroundColour}" Padding="4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Style="{StaticResource AppbarButton}" Click="NewProject">New Project</Button>
<Button Grid.Row="1" Style="{StaticResource AppbarButton}" Click="OpenProject">Open Project</Button>
<Button Grid.Row="3" Style="{StaticResource AppbarButton}" Click="ExitProgram">Exit</Button>
</Grid>
</Border>
</Grid>
</Border>

Expand Down
Binary file modified Dynamo/icon.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions NodeGraph/NodeGraphManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ public static void DeselectAllNodes(Flowchart flowchart)
{
ObservableCollection<Guid> selected = GetSelectedNodeGuids(flowchart);

if (selected == null) return;

foreach (var guid in selected)
{
Node node = FindNode(guid);
Expand Down
1 change: 0 additions & 1 deletion NodeGraph/View/ConnectorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void BuildCurveData(Point mousePosition)
c0.X += 100 * ratio;
c1.X -= 100 * ratio;

// Copied from https://github.com/lifeisforu/NodeGraph/blob/master/View/ConnectorView.cs
CurveData = string.Format("M{0},{1} C{0},{1} {2},{3} {4},{5} " +
"M{4},{5} C{4},{5} {6},{7} {8},{9}",
(int)start.X, (int)start.Y, // 0, 1
Expand Down

0 comments on commit a8605c2

Please sign in to comment.