Skip to content

Commit

Permalink
Make MVC the default for the new template dialog box. (#822)
Browse files Browse the repository at this point in the history
Make MVC the default for the new template dialog box.
Change the Template Chooser Window Margins to match the Microsoft UX Style Guide.
  • Loading branch information
Jim Przybylinski authored Oct 4, 2017
1 parent 3398931 commit 8126498
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class TemplateChooserViewModel : ViewModelBase
private FrameworkType _selectedFramework;
private AspNetVersion _selectedVersion;
private IList<AspNetVersion> _availableVersions;
private AppType _appType = AppType.None;
private AppType _appType = AppType.Mvc;

/// <summary>
/// The id of a google cloud project.
Expand Down Expand Up @@ -125,7 +125,7 @@ public AppType AppType
private set
{
SetValueAndRaise(ref _appType, value);
OkCommand.CanExecuteCommand = _appType != AppType.None;
OkCommand.CanExecuteCommand = AppType != AppType.None;
}
}

Expand Down Expand Up @@ -158,8 +158,7 @@ public TemplateChooserViewModel(Action closeWindow, Func<string> promptPickProje
{
Result = new TemplateChooserViewModelResult(this);
closeWindow();
},
false);
});
SelectProjectCommand = new ProtectedCommand(() => GcpProjectId = promptPickProject() ?? GcpProjectId);
SelectedFramework = NetCoreAvailable ? FrameworkType.NetCore : FrameworkType.NetFramework;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@
IsCancel="True"/>
</theming:CommonDialogWindowBaseContent.Buttons>
<StackPanel Orientation="Vertical">
<DockPanel Margin="0,5,0,0">
<DockPanel Margin="0,0,0,8">
<Label
DockPanel.Dock ="Top"
Content="{x:Static ext:Resources.WizardTemplateChooserTargetFrameworkLabel}"
Target="{Binding ElementName=_targetFramework}"/>
Target="{Binding ElementName=_targetFramework}"
Margin="0,0,0,5"/>
<StackPanel Orientation="Horizontal">
<ComboBox
x:Name="_targetFramework"
SelectedValuePath="Tag"
SelectedValue="{Binding SelectedFramework}"
MinWidth="150px">
MinWidth="150px"
Margin="0,0,5,0">

<ComboBoxItem
Tag="{x:Static local:FrameworkType.NetCore}"
Expand All @@ -57,34 +59,37 @@
<ComboBox
ItemsSource="{Binding AvailableVersions}"
SelectedItem="{Binding SelectedVersion}"
MinWidth="180px"/>
MinWidth="180px"
Margin="0"/>
</StackPanel>
</DockPanel>
<DockPanel Margin="0,5,0,0">
<DockPanel>
<Label
DockPanel.Dock="Top"
Content="{x:Static ext:Resources.WizardTemplateChooserProjectIdLabel}"
Target="{Binding ElementName=_projectIdBox}"/>
<StackPanel Orientation="Horizontal">
<TextBox x:Name="_projectIdBox" Text="{Binding GcpProjectId}" Width="200px"/>
Target="{Binding ElementName=_projectIdBox}"
Margin="0,0,0,5"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<TextBox x:Name="_projectIdBox" Text="{Binding GcpProjectId}" Width="200" Margin="0,0,5,0"/>
<Button
Command="{Binding SelectProjectCommand}"
Content="{x:Static ext:Resources.WizardTemplateChooserSelectProjectButton}"/>
</StackPanel>
</DockPanel>
<DockPanel Margin="0,5,0,0">
<TextBlock DockPanel.Dock="Top" Text="{x:Static ext:Resources.WizardTemplateChooserFeaturesLabel}"/>
<StackPanel Orientation="Horizontal">
<RadioButton
GroupName="AppType"
Content="{x:Static ext:Resources.WizardTemplateChooserMvcLabel}"
IsChecked="{Binding IsMvc}"/>
<RadioButton
GroupName="AppType"
Content="{x:Static ext:Resources.WizardTemplateChooserWebApiLabel}"
IsChecked="{Binding IsWebApi}"/>
Content="{x:Static ext:Resources.WizardTemplateChooserSelectProjectButton}"
Margin="0" />
</StackPanel>
</DockPanel>
<StackPanel>
<TextBlock Text="{x:Static ext:Resources.WizardTemplateChooserFeaturesLabel}" Margin="0,0,0,3"/>
<RadioButton
GroupName="AppType"
Content="{x:Static ext:Resources.WizardTemplateChooserMvcLabel}"
IsChecked="{Binding IsMvc}"
Margin="0,0,0,4"/>
<RadioButton
GroupName="AppType"
Content="{x:Static ext:Resources.WizardTemplateChooserWebApiLabel}"
IsChecked="{Binding IsWebApi}"
Margin="0"/>
</StackPanel>
</StackPanel>
</theming:CommonDialogWindowBaseContent>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public void BeforeEach()
[TestMethod]
public void TestInitialConditions()
{
Assert.AreEqual(AppType.None, _objectUnderTest.AppType);
Assert.AreEqual(false, _objectUnderTest.OkCommand.CanExecuteCommand);
Assert.AreEqual(AppType.Mvc, _objectUnderTest.AppType);
Assert.AreEqual(true, _objectUnderTest.OkCommand.CanExecuteCommand);
Assert.AreEqual(DefaultProjectId, _objectUnderTest.GcpProjectId);
Assert.IsNull(_objectUnderTest.Result);
}
Expand Down Expand Up @@ -296,7 +296,7 @@ public void TestSelectProject()
[TestMethod]
public void TestSelectProjectCanceled()
{
_promptPickProjectMock.Setup(f => f()).Returns((string) null);
_promptPickProjectMock.Setup(f => f()).Returns((string)null);

_objectUnderTest.SelectProjectCommand.Execute(null);

Expand Down

0 comments on commit 8126498

Please sign in to comment.