Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show error on the previewer side when project is built #365

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions AvaloniaVS.Shared/Views/AvaloniaDesigner.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Avalonia.Ide.CompletionEngine.DnlibMetadataProvider;
using AvaloniaVS.Models;
using AvaloniaVS.Services;
using AvaloniaVS.Shared.Views;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text;
Expand Down Expand Up @@ -100,6 +99,7 @@ internal partial class AvaloniaDesigner : UserControl, IDisposable
private bool _disposed;
private double _scaling = 1;
private AvaloniaDesignerView _unPausedView;
private bool _buidRequired;

/// <summary>
/// Initializes a new instance of the <see cref="AvaloniaDesigner"/> class.
Expand Down Expand Up @@ -340,7 +340,7 @@ private async Task LoadTargetsAsync()

bool IsValidTarget(ProjectInfo project)
{
return project.IsExecutable &&
return project.IsExecutable &&
project.References.Contains("Avalonia.DesignerSupport") &&
(project.Project == _project || project.ProjectReferences.Contains(_project));
}
Expand Down Expand Up @@ -483,6 +483,7 @@ private async Task StartProcessAsync()
}
catch (FileNotFoundException ex)
{
_buidRequired = true;
ShowError("Build Required", ex.Message);
Log.Logger.Debug(ex, "StartAsync could not find executable");
}
Expand All @@ -495,6 +496,7 @@ private async Task StartProcessAsync()
{
_startingProcess.Release();
}
_buidRequired = false;
}
else
{
Expand Down Expand Up @@ -625,9 +627,18 @@ private void ShowError(string heading, string message)
errorIndicator.Visibility = Visibility.Visible;
errorHeading.Text = heading;
errorMessage.Text = message;
if (_buidRequired == true)
{
previewer.buildButton.Visibility = Visibility.Visible;
}
else
{
previewer.buildButton.Visibility = Visibility.Hidden;
}
previewer.error.Visibility = Visibility.Visible;
previewer.errorHeading.Text = heading;
previewer.errorMessage.Text = message;
previewer.previewScroller.Visibility = Visibility.Hidden;
}

private void ShowPreview()
Expand Down Expand Up @@ -677,7 +688,7 @@ void VerticalGrid()
{
HorizontalGrid();
var content = SwapPanesButton.Content as UIElement;
content.RenderTransform = new RotateTransform(90);
content.RenderTransform = new RotateTransform(90);
}
else
{
Expand Down Expand Up @@ -705,7 +716,7 @@ private void SwapPreviewAndXamlPanes(object sender, RoutedEventArgs args)
{
case Orientation.Horizontal:
var editorRow = Grid.GetRow(editorHost);

if (editorRow == 0)
{
Grid.SetRow(editorHost, 2);
Expand Down
1 change: 1 addition & 0 deletions AvaloniaVS.Shared/Views/AvaloniaPreviewer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
Name="buildButton"
Margin="0,15,0,0"
Padding="7,5,7,5"
Visibility="Hidden"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="Build" />
Expand Down
4 changes: 2 additions & 2 deletions AvaloniaVS.Shared/Views/AvaloniaPreviewer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ private void Update(BitmapSource bitmap)
{
preview.Width = bitmap.Width / scaling;
preview.Height = bitmap.Height / scaling;
error.Visibility = Visibility.Collapsed;
previewScroller.Visibility = Visibility.Visible;
}
error.Visibility = Visibility.Collapsed;
previewScroller.Visibility = Visibility.Visible;

var fullScaling = scaling * Process.Scaling;
var hScale = preview.Width * 2 / fullScaling;
Expand Down