Skip to content

Commit

Permalink
Pm publishpackage cherrypick mypackage (DynamoDS#14645)
Browse files Browse the repository at this point in the history
* resource cherry-pick

- picked up all resource changes

* main changes

- this cherry-pick contains all main changes minus resources and tests.
- will need to merge resources to work correctly
- if this breaks the test run, we will need to further split it up, or introduce the changes one by one somehow

* null check to mainFrame_Navigated

- added a null check

* remove begin invoke from mainFrame_Navigated

- this was done to try and fix a failing test but it should not be needed

* dispose methods null checks

- trying to prevent null exceptions in case resources have been cleared before dispose event has been called
  • Loading branch information
dnenov authored Nov 29, 2023
1 parent 8f8e28b commit 1649d66
Show file tree
Hide file tree
Showing 39 changed files with 5,871 additions and 922 deletions.
54 changes: 54 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@
<None Remove="Packages\SplashScreen\build\index.bundle.js" />
<None Remove="Packages\SplashScreen\build\index.html" />
<None Remove="UI\Images\Canvas\canvas-button-geometry-scaling.png" />
<None Remove="UI\Images\checkmark_16px.png" />
<None Remove="UI\Images\close_16px.png" />
<None Remove="UI\Images\caret_drop_down.png" />
<None Remove="UI\Images\file-generic-16px.png" />
<None Remove="UI\Images\finished_checkmark_30px.png" />
<None Remove="UI\Images\folder-generic-16px.png" />
<None Remove="UI\Images\help-16px.png" />
<None Remove="UI\Images\NodeStates\package-64px.png" />
<None Remove="UI\Images\PackageManager\empty-state-first-use-light-gray.png" />
<None Remove="UI\Images\search_icon_20px.png" />
Expand All @@ -74,6 +79,10 @@
<None Remove="Views\PackageManager\Controls\PackageManagerPackagesControl.xaml" />
<None Remove="Views\PackageManager\Controls\PackageManagerSearchControl.xaml" />
<None Remove="Views\PackageManager\Controls\SearchBoxControl.xaml" />
<None Remove="Views\PackageManager\Pages\PublishPackageFinishPage.xaml" />
<None Remove="Views\PackageManager\Pages\PublishPackagePreviewPage.xaml" />
<None Remove="Views\PackageManager\Pages\PublishPackagePublishPage.xaml" />
<None Remove="Views\PackageManager\Pages\PublishPackageSelectPage.xaml" />
<None Remove="Views\SplashScreen\WebApp\splashScreenBackground.png" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -435,6 +444,7 @@
<DependentUpon>SurveyPopupWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Input\ParameterEditor.cs" />
<Compile Include="Views\PackageManager\Controls\CustomBrowserControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\FilterTagControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\LoadingAnimationStripeControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\NumericUpDownControl.xaml.cs" />
Expand All @@ -449,6 +459,10 @@
<Compile Include="Views\PackageManager\PackagePathView.xaml.cs">
<DependentUpon>PackagePathView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PackageManager\Pages\PublishPackageFinishPage.xaml.cs" />
<Compile Include="Views\PackageManager\Pages\PublishPackagePreviewPage.xaml.cs" />
<Compile Include="Views\PackageManager\Pages\PublishPackagePublishPage.xaml.cs" />
<Compile Include="Views\PackageManager\Pages\PublishPackageSelectPage.xaml.cs" />
<Compile Include="Views\PackageManager\TermsOfUseView.xaml.cs">
<DependentUpon>TermsOfUseView.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -647,6 +661,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Controls\CustomBrowserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Controls\FilterTagControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -678,6 +696,22 @@
<Page Include="Windows\ExtensionWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Pages\PublishPackageFinishPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Pages\PublishPackagePreviewPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Pages\PublishPackagePublishPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Pages\PublishPackageSelectPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -796,6 +830,7 @@
<Resource Include="UI\Images\caret_drop_down.png" />
<Resource Include="UI\Images\caret_up.png" />
<EmbeddedResource Include="Views\GuidedTour\HtmlPages\Resources\ArtifaktElement-Regular.woff" />
<Resource Include="UI\Images\checkmark_16px.png" />
<Resource Include="UI\Images\close_16px.png" />
<Resource Include="UI\Images\cursors.psd" />
<Resource Include="UI\Images\cursors1.psd" />
Expand Down Expand Up @@ -929,6 +964,10 @@
<ItemGroup>
<Resource Include="UI\Images\closetab_normal.png" />
<Resource Include="UI\Images\dynamonotext.png" />
<Resource Include="UI\Images\file-generic-16px.png" />
<Resource Include="UI\Images\finished_checkmark_30px.png" />
<Resource Include="UI\Images\folder-generic-16px.png" />
<Resource Include="UI\Images\help-16px.png" />
<Resource Include="UI\Images\maximize_16px_blue.png" />
<Resource Include="UI\Images\minimize_16px_blue.png" />
<Resource Include="UI\Images\minus_16px_blue.png" />
Expand Down Expand Up @@ -1722,12 +1761,27 @@
<Resource Include="UI\Images\not-authenticated.png" />
</ItemGroup>
<ItemGroup>
<None Update="Views\PackageManager\Controls\CustomBrowserControl.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Controls\FilterTagControl.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Controls\NumericUpDownControl.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Pages\PublishPackageFinishPage.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Pages\PublishPackagePreviewPage.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Pages\PublishPackagePublishPage.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Pages\PublishPackageSelectPage.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
</ItemGroup>
<Target Name="AfterBuildOps" AfterTargets="Build">
<MakeDir Directories="$(OutputPath)\viewExtensions\" />
Expand Down
159 changes: 159 additions & 0 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,30 @@ public object ConvertBack(object value, Type targetType, object parameter,
}
}


/// <summary>
/// Given a string, returns to upper case
/// </summary>
public class ToTitleCaseStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
if (value is string text)
{
var textInfo = culture.TextInfo;
return textInfo.ToTitleCase(text);
}
return value;
}

public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
{
return null;
}
}

/// <summary>
/// If the given string is empty, collapsed visibility enum is returned, otherwise visible enum is returned.
/// </summary>
Expand Down Expand Up @@ -1415,6 +1439,27 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}

/// <summary>
/// Converts 0 Collapsed state, otherwise returns Visible
/// </summary>
public class ZeroToVisibilityCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is int zero)
{
return zero == 0 ? Visibility.Collapsed : Visibility.Visible;
}

return Visibility.Collapsed; // If not int or int not zero, return collapsed.
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

/// <summary>
/// Takes a value and if the value is not null returns Unity Type Auto (*) as a length value
/// Returns 0 length if the value is null
Expand Down Expand Up @@ -2048,6 +2093,28 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
}
}

public sealed class NullOrEmptyStringToVisibiltyCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool invert = parameter as string == "invert";

if (String.IsNullOrEmpty((string)value))
{
return invert ? Visibility.Visible : Visibility.Collapsed;
}
else
{
return invert ? Visibility.Collapsed : Visibility.Visible;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

public sealed class NullToPinWidthConverter : IValueConverter
{
public const double PIN_WIDTH = 4;
Expand Down Expand Up @@ -3795,4 +3862,96 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
return value;
}
}

public class SumConverter : IMultiValueConverter
{
/// <summary>
/// Calculates and returns the sum of the values provided
/// </summary>
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return values.Cast<double>().Sum();
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}


/// <summary>
/// Convers PackageUploadHandle UploadType enum value to visibility
/// </summary>
public class PackageUploadHandleUploadTypeToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is PackageUploadHandle.UploadType uploadType)
{
if (parameter != null && parameter.ToString().ToLower() == "invert")
{
return uploadType != PackageUploadHandle.UploadType.Submit ? Visibility.Visible : Visibility.Hidden;
}
else
{
return uploadType == PackageUploadHandle.UploadType.Submit ? Visibility.Visible : Visibility.Hidden;
}
}

return Visibility.Hidden;
}

public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
{
return null;
}
}

/// <summary>
/// ReadyToPublish message to visibility converter
/// </summary>
public class ReadyToPublishToVisibilityCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string errorMessage && errorMessage.Equals(Resources.PackageManagerReadyToPublish))
{
return Visibility.Visible;
}

return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
{
return null;
}
}

/// <summary>
/// Given a string, returns to upper case
/// </summary>
public class StringEqualsZeroToVisibilityCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
if (value is string nullOrEmptyString && String.IsNullOrEmpty(nullOrEmptyString)) return Visibility.Visible;
if (value is string zeroString && zeroString.Equals("0"))
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
{
return null;
}
}

}
Binary file added src/DynamoCoreWpf/UI/Images/checkmark_16px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/DynamoCoreWpf/UI/Images/file-generic-16px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/DynamoCoreWpf/UI/Images/folder-generic-16px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/DynamoCoreWpf/UI/Images/help-16px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
<controls:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<controls:BoolToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<controls:InverseBooleanToVisibilityCollapsedConverter x:Key="InverseBoolToVisibilityCollapsedConverter" />
<controls:EmptyToVisibilityCollapsedConverter x:Key="EmptyToVisibilityCollapsedConverter"/>
<controls:EmptyToVisibilityCollapsedConverter x:Key="EmptyToVisibilityCollapsedConverter" />
<controls:ZeroToVisibilityCollapsedConverter x:Key="ZeroToVisibilityCollapsedConverter" />
<controls:EmptyToZeroLengthConverter x:Key="EmptyToZeroLengthConverter"/>
<controls:NavigationToOpacityConverter x:Key="NavigationToOpacityConverter" />
<controls:ViewButtonClipRectConverter x:Key="ViewButtonClipRectConverter" />
Expand Down
41 changes: 41 additions & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6023,4 +6023,45 @@
</Setter.Value>
</Setter>
</Style>

<!-- Package Manager DataGrid Header style -->
<Style x:Key="DataGridColumnHeaderText" TargetType="DataGridColumnHeader">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Grid>
<TextBlock Name="DataGridColumnHeader"
Height="32"
Padding="10,7,10,0"
VerticalAlignment="Center"
Background="#434343"
FontFamily="{StaticResource ArtifaktElementRegular}"
FontSize="14px"
FontWeight="Regular"
Foreground="{StaticResource PrimaryCharcoal200Brush}"
Text="{TemplateBinding Content}" >
<TextBlock.ToolTip>
<ToolTip Content="{x:Static p:Resources.PublishPackageNodeLibraryTooltip}"
Style="{StaticResource GenericToolTipLight}" />
</TextBlock.ToolTip>
</TextBlock>
<Thumb x:Name="PART_RightHeaderGripper"
Width="1"
HorizontalAlignment="Right"
BorderBrush="Transparent"
BorderThickness="1,0,0,0"
Cursor="SizeWE" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="DataGridColumnHeader"
Property="Background"
Value="#666666" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
Loading

0 comments on commit 1649d66

Please sign in to comment.