Skip to content

Commit

Permalink
new wizzard control (DynamoDS#15439)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnenov authored Oct 14, 2024
1 parent aa9cb1b commit f6c1bea
Show file tree
Hide file tree
Showing 6 changed files with 467 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@
<Compile Include="Views\PackageManager\Controls\PackageManagerPackagesControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\PackageManagerPublishControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\PackageManagerSearchControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\PackageManagerWizardControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\SearchBoxControl.xaml.cs" />
<Compile Include="Views\PackageManager\Controls\StepIndicatorControl.xaml.cs" />
<Compile Include="Views\PackageManager\PackageManagerView.xaml.cs" />
<Compile Include="Views\Menu\TrustedPathView.xaml.cs" />
<Compile Include="Views\Output\OutputEditor.cs" />
Expand Down Expand Up @@ -724,6 +726,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PackageManager\Controls\StepIndicatorControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Menu\TrustedPathView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -748,6 +754,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\PackageManager\Controls\PackageManagerWizardControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\ExtensionWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -1842,6 +1852,12 @@
<None Update="Views\PackageManager\Controls\NumericUpDownControl.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Controls\PackageManagerWizardControl.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Controls\StepIndicatorControl.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<None Update="Views\PackageManager\Pages\PublishPackageFinishPage.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
Expand Down
17 changes: 17 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,8 @@ Dynamo.PackageManager.UI.PackageManagerView.InitializeComponent() -> void
Dynamo.PackageManager.UI.PackageManagerView.PackageManagerView(Dynamo.Controls.DynamoView dynamoView, Dynamo.PackageManager.PackageManagerViewModel packageManagerViewModel) -> void
Dynamo.PackageManager.UI.PackageManagerView.PackageManagerViewModel.get -> Dynamo.PackageManager.PackageManagerViewModel
Dynamo.PackageManager.UI.PackageManagerView.PackageManagerViewModel.set -> void
Dynamo.PackageManager.UI.PackageManagerWizardControl
Dynamo.PackageManager.UI.PackageManagerWizardControl.PackageManagerWizardControl() -> void
Dynamo.PackageManager.UI.PackageNameLengthValidationRule
Dynamo.PackageManager.UI.PackageNameLengthValidationRule.PackageNameLengthValidationRule() -> void
Dynamo.PackageManager.UI.PublishPackagePreviewPage
Expand Down Expand Up @@ -1277,6 +1279,18 @@ Dynamo.PackageManager.UI.SortingConverter
Dynamo.PackageManager.UI.SortingConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.PackageManager.UI.SortingConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.PackageManager.UI.SortingConverter.SortingConverter() -> void
Dynamo.PackageManager.UI.StepIndicatorControl
Dynamo.PackageManager.UI.StepIndicatorControl.State.get -> Dynamo.PackageManager.UI.StepIndicatorControl.StepState
Dynamo.PackageManager.UI.StepIndicatorControl.State.set -> void
Dynamo.PackageManager.UI.StepIndicatorControl.StepIndicatorControl() -> void
Dynamo.PackageManager.UI.StepIndicatorControl.StepNumber.get -> string
Dynamo.PackageManager.UI.StepIndicatorControl.StepNumber.set -> void
Dynamo.PackageManager.UI.StepIndicatorControl.StepState
Dynamo.PackageManager.UI.StepIndicatorControl.StepState.Active = 1 -> Dynamo.PackageManager.UI.StepIndicatorControl.StepState
Dynamo.PackageManager.UI.StepIndicatorControl.StepState.Inactive = 0 -> Dynamo.PackageManager.UI.StepIndicatorControl.StepState
Dynamo.PackageManager.UI.StepIndicatorControl.StepState.Ok = 2 -> Dynamo.PackageManager.UI.StepIndicatorControl.StepState
Dynamo.PackageManager.UI.StepIndicatorControl.Title.get -> string
Dynamo.PackageManager.UI.StepIndicatorControl.Title.set -> void
Dynamo.PackageManager.UI.TermsOfUseView
Dynamo.PackageManager.UI.TermsOfUseView.AcceptedTermsOfUse.get -> bool
Dynamo.PackageManager.UI.TermsOfUseView.InitializeComponent() -> void
Expand Down Expand Up @@ -5594,6 +5608,9 @@ static readonly Dynamo.PackageManager.UI.NumericUpDownControl.ValueProperty -> S
static readonly Dynamo.PackageManager.UI.NumericUpDownControl.WatermarkProperty -> System.Windows.DependencyProperty
static readonly Dynamo.PackageManager.UI.PackageManagerPackagesControl.SearchItemsProperty -> System.Windows.DependencyProperty
static readonly Dynamo.PackageManager.UI.PackageManagerPackagesControl.SelectedItemProperty -> System.Windows.DependencyProperty
static readonly Dynamo.PackageManager.UI.StepIndicatorControl.StateProperty -> System.Windows.DependencyProperty
static readonly Dynamo.PackageManager.UI.StepIndicatorControl.StepNumberProperty -> System.Windows.DependencyProperty
static readonly Dynamo.PackageManager.UI.StepIndicatorControl.TitleProperty -> System.Windows.DependencyProperty
static readonly Dynamo.PackageManager.UI.TreeViewItemHelper.IndentProperty -> System.Windows.DependencyProperty
static readonly Dynamo.UI.Controls.CodeCompletionEditor.CodeProperty -> System.Windows.DependencyProperty
static readonly Dynamo.UI.Controls.DynamoToolTip.AttachmentSideProperty -> System.Windows.DependencyProperty
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<UserControl x:Class="Dynamo.PackageManager.UI.PackageManagerWizardControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Dynamo.PackageManager.UI"
xmlns:ui="clr-namespace:Dynamo.UI"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoModernDictionaryUri}" />
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoConvertersDictionaryUri}" />
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoColorsAndBrushesDictionaryUri}" />
</ResourceDictionary.MergedDictionaries>

<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#f5f5f5"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0 0 0 8"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="FontFamily" Value="{StaticResource ArtifaktElementRegular}"/>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="#535353" VerticalAlignment="Center">

<!-- Progress bar section -->
<Grid Grid.Row="0" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<!-- Line connecting steps -->
<Line Grid.Row="1"
Grid.ColumnSpan="5"
X1="0" Y1="0"
X2="1" Y2="0"
Stroke="#979797"
StrokeThickness="2"
Stretch="Fill"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Margin="80 25 80 0"/>

<!-- Step 1 -->
<local:StepIndicatorControl Title="Package details" StepNumber="1" State="Active" Grid.Column="0" Grid.Row="1" VerticalAlignment="Bottom"
MouseLeftButtonDown="StepIndicatorControl_MouseDoubleClick" Width="120" Height="50"/>

<!-- Step 2 -->
<local:StepIndicatorControl Title="Compatibility" StepNumber="2" State="Inactive" Grid.Column="1" Grid.Row="1" VerticalAlignment="Bottom"
MouseLeftButtonDown="StepIndicatorControl_MouseDoubleClick" Width="120" Height="50"/>

<!-- Step 3 -->
<local:StepIndicatorControl Title="Select files" StepNumber="3" State="Inactive" Grid.Column="2" Grid.Row="1" VerticalAlignment="Bottom"
MouseLeftButtonDown="StepIndicatorControl_MouseDoubleClick" Width="120" Height="50"/>

<!-- Step 4 -->
<local:StepIndicatorControl Title="Preview files" StepNumber="4" State="Inactive" Grid.Column="3" Grid.Row="1" VerticalAlignment="Bottom"
MouseLeftButtonDown="StepIndicatorControl_MouseDoubleClick" Width="120" Height="50"/>

<!-- Step 5 -->
<local:StepIndicatorControl Title="Confirm" StepNumber="5" State="Inactive" Grid.Column="4" Grid.Row="1" VerticalAlignment="Bottom"
MouseLeftButtonDown="StepIndicatorControl_MouseDoubleClick" Width="120" Height="50"/>

</Grid>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Dynamo.PackageManager.UI
{
/// <summary>
/// Interaction logic for PackageManagerWizardControl.xaml
/// </summary>
public partial class PackageManagerWizardControl : UserControl
{
private int currentStep;

public PackageManagerWizardControl()
{
InitializeComponent();
currentStep = 1;
}

private void StepIndicatorControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var indicator = sender as StepIndicatorControl;
if (indicator != null)
{
int step;
if (int.TryParse(indicator.StepNumber, out step))
{
currentStep = step;
UpdateSteps();
}
}
}

private void UpdateSteps()
{
UpdateStepStateRecursive(this);
}

private void UpdateStepStateRecursive(DependencyObject parent)
{
if (parent == null)
return;

foreach (object child in LogicalTreeHelper.GetChildren(parent))
{
if (child is StepIndicatorControl indicator)
{
int step;
if (int.TryParse(indicator.StepNumber, out step))
{
if (step < currentStep)
{
indicator.State = StepIndicatorControl.StepState.Ok;
}
else if (step == currentStep)
{
indicator.State = StepIndicatorControl.StepState.Active;
}
else
{
indicator.State = StepIndicatorControl.StepState.Inactive;
}
}
}
else if (child is DependencyObject dependencyChild)
{
UpdateStepStateRecursive(dependencyChild);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<UserControl x:Class="Dynamo.PackageManager.UI.StepIndicatorControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Dynamo.PackageManager.UI"
xmlns:ui="clr-namespace:Dynamo.UI"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="100"
IsHitTestVisible="True"
Background="Transparent">
<UserControl.Resources>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoModernDictionaryUri}" />
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoColorsAndBrushesDictionaryUri}" />
</ResourceDictionary.MergedDictionaries>

<SolidColorBrush x:Key="EllipseStrokeBrush" Color="#979797"/>
<SolidColorBrush x:Key="EllipseFillBrush" Color="#535353"/>

<!-- Tick Icon Path -->
<PathGeometry x:Key="TickIcon" Figures="M4.18021 9L0 5.1129L1.29587 3.8214L4.15699 6.4647L10.6791 0L12 1.2681L4.18021 9Z" />
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="Transparent" IsHitTestVisible="True">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="StepStates">
<!-- Active State -->
<VisualState x:Name="Active">
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#38abdf" Duration="0:0:0.3">
</ColorAnimation>
<ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#535353" Duration="0:0:0.3"/>
</Storyboard>
</VisualState>

<!-- Inactive State -->
<VisualState x:Name="Inactive">
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#979797" Duration="0:0:0.3"/>
<ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#535353" Duration="0:0:0.3"/>
</Storyboard>
</VisualState>

<!-- Ok State -->
<VisualState x:Name="Ok">
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#38abdf" Duration="0:0:0.3"/>
<ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#38abdf" Duration="0:0:0.3"/>
</Storyboard>
</VisualState>

<!-- Mouse Over State -->
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#b0b0b0" Duration="0:0:0.3"/>
<ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="Ellipse"
To="#696969" Duration="0:0:0.3"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>


<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<TextBlock Name="StepTitle"
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=UserControl}}"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
FontWeight="Normal"
Margin="0 0 0 8"/>
<Canvas Grid.Row="1" Height="20" Width="20">
<Ellipse Name="Ellipse"
Width="20"
Height="20"
Stroke="{StaticResource EllipseStrokeBrush}"
Fill="{StaticResource EllipseFillBrush}"
StrokeThickness="2"
SnapsToDevicePixels="True"
UseLayoutRounding="True"
MouseEnter="Ellipse_MouseEnter"
MouseLeave="Ellipse_MouseLeave"
MouseLeftButtonDown="Ellipse_MouseLeftButtonDown"/>

<TextBlock Name="StepNumberText"
Padding="6 2 0 0"
Margin="0"
Width="20"
Height="20"
IsHitTestVisible="False"
Foreground="#979797"
FontSize="12"
Text="{Binding StepNumber, RelativeSource={RelativeSource AncestorType=UserControl}}"
FontWeight="Bold"/>

<!-- OK Icon -->
<Grid Name="OkIcon" Visibility="Visible" IsHitTestVisible="False">
<Canvas Width="20" Height="20">
<Viewbox Width="10" Height="12" Canvas.Left="5" Canvas.Top="4" >
<Path Data="{StaticResource TickIcon}"
Fill="White" />
</Viewbox>
</Canvas>
</Grid>
</Canvas>
</Grid>
</UserControl>
Loading

0 comments on commit f6c1bea

Please sign in to comment.