Skip to content

Commit

Permalink
Merge branch 'master' into webview2_initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart committed Dec 5, 2023
2 parents 64a2539 + a23a197 commit ab7669f
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_dynamo_all_net6.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
path: Dynamo
repository: DynamoDS/Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Disable problem matcher
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_dynamo_all_net8.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
path: Dynamo
repository: DynamoDS/Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Disable problem matcher
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
path: Dynamo
repository: DynamoDS/Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
# Initializes the CodeQL tools for scanning.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dynamoBinDiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
path: net60_Win_Dynamo
repository: DynamoDS/Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Disable problem matcher
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
path: master_net60_Win_Dynamo
repository: DynamoDS/Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Disable problem matcher
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dynamoNet6.0_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
path: Dynamo
repository: DynamoDS/Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Disable problem matcher
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dynamoNet6.0_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
with:
path: Dynamo
- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
- name: Disable problem matcher
run: echo "::remove-matcher owner=csc::"

Expand Down
4 changes: 2 additions & 2 deletions src/Config/CS_SDK.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PlatformTarget >x64</PlatformTarget>
<!--Use the property DotNet to set TargetFramework from commandline without forcing it on all projects-->
<!--Ex. DynamoServices uses TargetFramework netstandard2.0 -->
<DotNet>net6.0</DotNet>
<DotNet>net8.0</DotNet>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">16.0</VisualStudioVersion>
<TargetFramework>$(DotNet)</TargetFramework>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -146,4 +146,4 @@
</PropertyGroup>
</Otherwise>
</Choose>
</Project>
</Project>
4 changes: 2 additions & 2 deletions src/DynamoCore/Models/DynamoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2309,7 +2309,7 @@ private bool OpenJsonFile(
workspace.FromJsonGraphId = string.IsNullOrEmpty(filePath) ? WorkspaceModel.ComputeGraphIdFromJson(fileContents) : "";
workspace.ScaleFactor = dynamoPreferences.ScaleFactor;

if (!IsTestMode)
if (!IsTestMode || !IsHeadless)
{
if (workspace.ContainsLegacyTraceData)
{
Expand Down Expand Up @@ -2442,7 +2442,7 @@ private bool OpenXmlHomeWorkspace(
Guid deterministicId = GuidUtility.Create(GuidUtility.UrlNamespace, workspaceInfo.Name);

var loadedTraceData = Utils.LoadTraceDataFromXmlDocument(xmlDoc, out var containsLegacyTraceData);
if (!IsTestMode)
if (!IsTestMode || !IsHeadless)
{
if (containsLegacyTraceData) OnRequestNotification(Resources.LegacyTraceDataWarning, true);
}
Expand Down
9 changes: 5 additions & 4 deletions src/Libraries/CoreNodeModels/DropDown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ObservableCollection<DynamoDropDownItem> Items
set
{
items = value;
RaisePropertyChanged("Items");
RaisePropertyChanged(nameof(Items));
}
}

Expand Down Expand Up @@ -106,7 +106,6 @@ public int SelectedIndex
selectedString = GetSelectedStringFromItem(Items.ElementAt(value));
}

OnNodeModified();
RaisePropertyChanged("SelectedIndex");
RaisePropertyChanged("SelectedString");
}
Expand Down Expand Up @@ -137,12 +136,12 @@ public string SelectedString
if (item != null)
{
selectedIndex = Items.IndexOf(item);
RaisePropertyChanged("SelectedIndex");
RaisePropertyChanged(nameof(SelectedIndex));
}
}

selectedString = value;
RaisePropertyChanged("SelectedString");
RaisePropertyChanged(nameof(SelectedString));
}
}

Expand Down Expand Up @@ -203,6 +202,8 @@ protected override bool UpdateValueCore(UpdateValueParams updateValueParams)
Warning(Dynamo.Properties.Resources.NothingIsSelectedWarning);
}

OnNodeModified();

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,69 @@ namespace CoreNodeModelsWpf.Nodes
public class DropDownNodeViewCustomization : INodeViewCustomization<DSDropDownBase>
{
private DSDropDownBase model;
private ComboBox comboBox;

public void CustomizeView(DSDropDownBase model, NodeView nodeView)
{
this.model = model;

//add a drop down list to the window
var combo = new ComboBox
// Add a drop down list to the window
comboBox = new ComboBox
{
Width = System.Double.NaN,
MinWidth= 150,
Width = double.NaN,
MinWidth = 150,
Height = Configurations.PortHeightInPixels,
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Center
VerticalAlignment = VerticalAlignment.Center,
Style = (Style)SharedDictionaryManager.DynamoModernDictionary["RefreshComboBox"]
};

nodeView.inputGrid.Children.Add(comboBox);
Grid.SetColumn(comboBox, 0);
Grid.SetRow(comboBox, 0);

combo.Style = (Style)SharedDictionaryManager.DynamoModernDictionary["RefreshComboBox"];
comboBox.DropDownOpened += DropDownOpened;
comboBox.SelectionChanged += SelectionChanged;

nodeView.inputGrid.Children.Add(combo);
System.Windows.Controls.Grid.SetColumn(combo, 0);
System.Windows.Controls.Grid.SetRow(combo, 0);
comboBox.DataContext = model;

combo.DropDownOpened += combo_DropDownOpened;

combo.DataContext = model;

// bind this combo box to the selected item hash
var bindingVal = new System.Windows.Data.Binding("Items")
// Bind this combo box to the selected item hash.
var bindingVal = new Binding(nameof(DSDropDownBase.Items))
{
Mode = BindingMode.TwoWay,
Source = model
};
combo.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal);
comboBox.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal);

// bind the selected index to the model property SelectedIndex
var indexBinding = new Binding("SelectedIndex")
// Bind the selected index to the model property SelectedIndex.
var indexBinding = new Binding(nameof(DSDropDownBase.SelectedIndex))
{
Mode = BindingMode.TwoWay,
Source = model
};
combo.SetBinding(Selector.SelectedIndexProperty, indexBinding);
comboBox.SetBinding(Selector.SelectedIndexProperty, indexBinding);
}

private void SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (comboBox.SelectedIndex != -1)
{
model.OnNodeModified();
}
}

public void Dispose()
{
comboBox.DropDownOpened -= DropDownOpened;
comboBox.SelectionChanged -= SelectionChanged;
}

/// <summary>
/// When the dropdown is opened, the node's implementation of PopulateItems is called
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void combo_DropDownOpened(object sender, EventArgs e)
void DropDownOpened(object sender, EventArgs e)
{
this.model.PopulateItems();
model.PopulateItems();
}

}
Expand Down
13 changes: 13 additions & 0 deletions src/Notifications/NotificationCenterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ internal NotificationCenterController(DynamoView view, DynamoLogger dynLogger)
dynamoView.SizeChanged += DynamoView_SizeChanged;
dynamoView.LocationChanged += DynamoView_LocationChanged;
notificationsButton.Click += NotificationsButton_Click;
dynamoView.PreviewMouseDown += DynamoView_PreviewMouseDown;

notificationUIPopup = new NotificationUI
{
Expand Down Expand Up @@ -255,6 +256,17 @@ private void DynamoView_SizeChanged(object sender, SizeChangedEventArgs e)
notificationUIPopup.UpdatePopupLocation();
}

/// <summary>
/// Dismiss notifications panel by clicking outside the panel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DynamoView_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (!notificationUIPopup.IsOpen) return;
notificationUIPopup.IsOpen = false;
}

/// <summary>
/// Notification Center button click handler
/// </summary>
Expand Down Expand Up @@ -301,6 +313,7 @@ protected virtual void Dispose(bool disposing)
{
dynamoView.SizeChanged -= DynamoView_SizeChanged;
dynamoView.LocationChanged -= DynamoView_LocationChanged;
dynamoView.PreviewMouseDown -= DynamoView_PreviewMouseDown;
}

if (notificationUIPopup != null)
Expand Down
2 changes: 1 addition & 1 deletion src/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<Solution>Dynamo.All.sln</Solution>
<Platform>Any CPU</Platform>
<DotNet>net6.0</DotNet>
<DotNet>net8.0</DotNet>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<NuGetPath>$(MSBuildProjectDirectory)\..\tools\Nuget\NuGet.exe</NuGetPath>
</PropertyGroup>
Expand Down
19 changes: 19 additions & 0 deletions test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />

<!--roslyn compiler apis direct references so we can copy them to the test_dependencies folder-->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" GeneratePathProperty="true">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.11.0" GeneratePathProperty="true">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Cyotek.Drawing.BitmapFont" Version="2.0.0" />
<PackageReference Include="Greg" Version="3.0.0.3175">
Expand Down Expand Up @@ -203,4 +214,12 @@
<ItemGroup>
<EmbeddedResource Include="Resources\DocumentationBrowserScriptsTest.html" />
</ItemGroup>

<Target Name="CopyRoslynToTestDepsFolder" AfterTargets="Build">
<Message Importance="High" Text="copying test dependencies to test dependencies folder" />
<!--roslyn compiler api and deps-->
<Copy SourceFiles="$(PkgMicrosoft_CodeAnalysis_CSharp)\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.dll" DestinationFolder="$(TestDependenciesPath)" />
<Copy SourceFiles="$(PkgMicrosoft_CodeAnalysis_Common)\lib\netstandard2.0\Microsoft.CodeAnalysis.dll" DestinationFolder="$(TestDependenciesPath)" />

</Target>
</Project>
Loading

0 comments on commit ab7669f

Please sign in to comment.