提交 cf0f5890 编写于 作者: A Andrew Hall (METAL)

UI updates post review

上级 7806c67a
......@@ -8,53 +8,58 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0"
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="180" d:DesignWidth="460"
Height="180" Width="460"
MinHeight="180" MinWidth="460"
MinWidth="400" MinHeight="100"
Width="400" Height="166"
Title="{Binding ElementName=dialog, Path=MoveToNamespaceDialogTitle}"
HasHelpButton="True"
ResizeMode="CanResizeWithGrip"
ShowInTaskbar="False"
HasDialogFrame="True"
WindowStartupLocation="CenterOwner">
<Window.Resources>
<Thickness x:Key="labelPadding">0, 5, 0, 2</Thickness>
<Thickness x:Key="textboxPadding">2</Thickness>
<Thickness x:Key="verticalLabelMargin">0, 0, 0, 5</Thickness>
<Thickness x:Key="messageMargin">0, 9, 0, 0</Thickness>
<Thickness x:Key="submitButtonsGroupMargin">0, 18, 0, 0</Thickness>
<Thickness x:Key="submitButtonSpacingMargin">6, 0, 0, 0</Thickness>
<system:Double x:Key="buttonWidth">75</system:Double>
<system:Double x:Key="buttonHeight">23</system:Double>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Window.Resources>
<Grid Margin="11,6,11,11">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="50" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="8, 0, 8, 0" x:Name="Root">
<Label x:Uid="NamespaceLabel"
x:Name="NamespaceLabel"
Grid.Column="0"
Margin="{StaticResource verticalLabelMargin}"
Content="{Binding ElementName=dialog, Path=NamespaceLabelText}"
Padding="{StaticResource ResourceKey=labelPadding}"
Target="{Binding ElementName=NamespaceTextBox}" />
<Border BorderThickness="1">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=CanSubmit}" Value="False">
<Setter Property="BorderBrush" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<ComboBox x:Uid="NamespaceBox"
Name="NamespaceBox"
Grid.Column="1"
IsEditable="True"
IsReadOnly="False"
AutomationProperties.LabeledBy="{Binding ElementName=NamespaceLabel}"
Text="{Binding NamespaceName, Mode=TwoWay}"
ItemsSource="{Binding AvailableNamespaces, Mode=OneTime}" />
</Grid>
ItemsSource="{Binding AvailableNamespaces, Mode=OneTime}"
BorderThickness="0"
BorderBrush="Red">
</ComboBox>
</Border>
<StackPanel Height="25">
<StackPanel Orientation="Horizontal"
Grid.Row="1"
Visibility="{Binding ShowMessage, Converter={StaticResource BooleanToVisibilityConverter}}"
Margin="0, 11, 0, 0">
Margin="{StaticResource messageMargin}">
<imaging:CrispImage Name="MessageIcon"
Moniker="{Binding Icon}"
Height="16"
......@@ -64,27 +69,25 @@
Text="{Binding Message}"
Margin="7, 0, 0, 0" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2"
HorizontalAlignment="Right"
Margin="0, 11, 0, 0"
<StackPanel HorizontalAlignment="Right"
Margin="{StaticResource submitButtonsGroupMargin}"
Orientation="Horizontal">
<Button x:Uid="OkButton"
Content="{Binding ElementName=dialog, Path=OK}"
Margin="0, 0, 0, 0"
Padding="9,2,9,2"
Click="OK_Click"
IsDefault="True"
MinWidth="73"
MinHeight="21"/>
MinWidth="{StaticResource ResourceKey=buttonWidth}"
MinHeight="{StaticResource ResourceKey=buttonHeight}"
IsEnabled="{Binding CanSubmit}" />
<Button x:Uid="CancelButton"
Content="{Binding ElementName=dialog, Path=Cancel}"
Margin="7, 0, 0, 0"
Padding="9,2,9,2"
Margin="{StaticResource submitButtonSpacingMargin}"
Click="Cancel_Click"
IsCancel="True"
MinWidth="73"
MinHeight="21"/>
MinWidth="{StaticResource ResourceKey=buttonWidth}"
MinHeight="{StaticResource ResourceKey=buttonHeight}" />
</StackPanel>
</StackPanel>
</Grid>
</vs:DialogWindow>
......@@ -14,12 +14,12 @@ internal partial class MoveToNamespaceDialog : DialogWindow
private readonly MoveToNamespaceDialogViewModel _viewModel;
public string MoveToNamespaceDialogTitle => ServicesVSResources.Move_to_namespace;
public string NamespaceLabelText => "Namespace: "; // ServicesVSResources.Namespace_colon;
public string NamespaceLabelText => "Target Namespace:"; // ServicesVSResources.Namespace_colon;
public string OK => ServicesVSResources.OK;
public string Cancel => ServicesVSResources.Cancel;
internal MoveToNamespaceDialog(MoveToNamespaceDialogViewModel viewModel)
: base(helpTopic: "vs.csharp.refactoring.movetonamespace")
: base()
{
_viewModel = viewModel;
......@@ -36,8 +36,11 @@ private void Cancel_Click(object sender, RoutedEventArgs e)
}
private void OK_Click(object sender, RoutedEventArgs e)
{
if (_viewModel.CanSubmit)
{
DialogResult = true;
}
}
}
}
......@@ -41,16 +41,19 @@ public void OnNamespaceUpdated()
Icon = KnownMonikers.StatusInformation;
Message = $"'{NamespaceName}' will be created as a new namespace";
ShowMessage = true;
CanSubmit = true;
}
else if (!isValidName)
{
Icon = KnownMonikers.StatusError;
Icon = KnownMonikers.StatusInvalid;
Message = $"'{NamespaceName}' is not a valid namespace";
ShowMessage = true;
CanSubmit = false;
}
else
{
ShowMessage = false;
CanSubmit = true;
}
}
......@@ -88,5 +91,12 @@ public bool ShowMessage
get => _showMessage;
private set => SetProperty(ref _showMessage, value);
}
private bool _canSubmit = true;
public bool CanSubmit
{
get => _canSubmit;
private set => SetProperty(ref _canSubmit, value);
}
}
}
......@@ -1202,7 +1202,7 @@ I agree to all of the foregoing:</value>
<value>Use enhanced colors for C# and Basic</value>
</data>
<data name="Move_to_namespace" xml:space="preserve">
<value>Move To Namespace</value>
<value>Move to Namespace</value>
</data>
<data name="Namespace" xml:space="preserve">
<value>Namespace</value>
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
......@@ -128,8 +128,8 @@
<note />
</trans-unit>
<trans-unit id="Move_to_namespace">
<source>Move To Namespace</source>
<target state="new">Move To Namespace</target>
<source>Move to Namespace</source>
<target state="new">Move to Namespace</target>
<note />
</trans-unit>
<trans-unit id="Namespace">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册