Add more UI for document generation

This commit is contained in:
Ryan Nowak 2018-05-03 11:42:16 -07:00
parent f150ee329a
commit b538f22ad5
2 changed files with 42 additions and 0 deletions

View File

@ -9,9 +9,13 @@ namespace Microsoft.VisualStudio.RazorExtension.RazorInfo
{ {
public class DocumentSnapshotViewModel : NotifyPropertyChanged public class DocumentSnapshotViewModel : NotifyPropertyChanged
{ {
private double _progress;
internal DocumentSnapshotViewModel(DocumentSnapshot document) internal DocumentSnapshotViewModel(DocumentSnapshot document)
{ {
Document = document; Document = document;
InitializeGeneratedDocument();
} }
internal DocumentSnapshot Document { get; } internal DocumentSnapshot Document { get; }
@ -19,6 +23,28 @@ namespace Microsoft.VisualStudio.RazorExtension.RazorInfo
public string FilePath => Document.FilePath; public string FilePath => Document.FilePath;
public string TargetPath => Document.TargetPath; public string TargetPath => Document.TargetPath;
public bool CodeGenerationInProgress => _progress < 100;
public double CodeGenerationProgress => _progress;
private async void InitializeGeneratedDocument()
{
_progress = 0;
OnPropertyChanged(nameof(CodeGenerationInProgress));
OnPropertyChanged(nameof(CodeGenerationProgress));
try
{
await Document.GetGeneratedOutputAsync();
}
finally
{
_progress = 100;
OnPropertyChanged(nameof(CodeGenerationInProgress));
OnPropertyChanged(nameof(CodeGenerationProgress));
}
}
} }
} }
#endif #endif

View File

@ -301,6 +301,22 @@
<ListView.View> <ListView.View>
<GridView <GridView
AllowsColumnReorder="False"> AllowsColumnReorder="False">
<GridViewColumn
Width="50">
<GridViewColumnHeader
Content="Status" />
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<ProgressBar
Height="15"
Width="40"
IsIndeterminate="{Binding Path=CodeGenerationInProgress, Mode=OneWay}"
Value="{Binding Path=CodeGenerationProgress, Mode=OneWay}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn <GridViewColumn
Width="150"> Width="150">
<GridViewColumnHeader <GridViewColumnHeader