forked from DynamoDS/Dynamo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new wizzard control (DynamoDS#15439)
- Loading branch information
Showing
6 changed files
with
467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/DynamoCoreWpf/Views/PackageManager/Controls/PackageManagerWizardControl.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
72 changes: 72 additions & 0 deletions
72
src/DynamoCoreWpf/Views/PackageManager/Controls/PackageManagerWizardControl.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} | ||
} |
128 changes: 128 additions & 0 deletions
128
src/DynamoCoreWpf/Views/PackageManager/Controls/StepIndicatorControl.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.