-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from lacmus-foundation/dev
Dev: Report image processing result #66
- Loading branch information
Showing
10 changed files
with
227 additions
and
16 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
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,62 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Reactive; | ||
using System.Runtime.InteropServices; | ||
using Avalonia.Controls; | ||
using LacmusApp.Services; | ||
using ReactiveUI; | ||
using ReactiveUI.Fody.Helpers; | ||
using Serilog; | ||
|
||
namespace LacmusApp.ViewModels | ||
{ | ||
public class BugReportViewModel : ReactiveObject | ||
{ | ||
public BugReportViewModel(Window window, LocalizationContext localizationContext) | ||
{ | ||
LocalizationContext = localizationContext; | ||
OpenFalseNegativeCommand = ReactiveCommand.Create(OpenFalseNegative); | ||
OpenFalsePositiveCommand = ReactiveCommand.Create(OpenFalsePositive); | ||
} | ||
[Reactive] public LocalizationContext LocalizationContext { get; set; } | ||
public ReactiveCommand<Unit, Unit> OpenFalseNegativeCommand { get; set; } | ||
public ReactiveCommand<Unit, Unit> OpenFalsePositiveCommand { get; set; } | ||
|
||
public void OpenFalseNegative() | ||
{ | ||
OpenUrl("https://forms.gle/QbJaqcYvozC1dqTg7"); | ||
} | ||
public void OpenFalsePositive() | ||
{ | ||
OpenUrl("https://forms.gle/FAGyGsSiFooVt5L89"); | ||
} | ||
private void OpenUrl(string url) | ||
{ | ||
try | ||
{ | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
//https://stackoverflow.com/a/2796367/241446 | ||
using (Process proc = new Process {StartInfo = {UseShellExecute = true, FileName = url}}) | ||
{ | ||
proc.Start(); | ||
} | ||
} | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
Process.Start("x-www-browser", url); | ||
} | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
Process.Start("open", url); | ||
} | ||
else | ||
throw new Exception(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error(e,$"Unable to ope url {url}."); | ||
} | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<Window xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Icon="resm:LacmusApp.Assets.avalonia-logo.ico" | ||
x:Class="LacmusApp.Views.BugReportWindow" | ||
CanResize="True" | ||
Title="Bug Report" | ||
Width="650" | ||
Height="300"> | ||
|
||
<Grid> | ||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" | ||
VerticalScrollBarVisibility="Hidden"> | ||
<Border Classes="Card"> | ||
<Grid> | ||
<StackPanel Margin="10, 10"> | ||
<TextBlock TextWrapping="Wrap" Classes="Heading" Text="{Binding LocalizationContext.LabelingWindowCapture}" /> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*" /> | ||
<RowDefinition Height="10" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<Button Grid.Row="0" | ||
Content="{Binding LocalizationContext.LabelingWindowFalsePositive}" | ||
Command="{Binding OpenFalsePositiveCommand}"/> | ||
<Button Grid.Row="2" | ||
Content="{Binding LocalizationContext.LabelingWindowFalseNegative}" | ||
Command="{Binding OpenFalseNegativeCommand}"/> | ||
</Grid> | ||
</StackPanel> | ||
</Grid> | ||
</Border> | ||
</ScrollViewer> | ||
</Grid> | ||
</Window> |
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,20 @@ | ||
using Avalonia.Markup.Xaml; | ||
using Avalonia.ReactiveUI; | ||
using LacmusApp.Managers; | ||
using LacmusApp.ViewModels; | ||
using ReactiveUI; | ||
|
||
namespace LacmusApp.Views | ||
{ | ||
public class BugReportWindow : ReactiveWindow<BugReportViewModel> | ||
{ | ||
public BugReportWindow(ThemeManager themeManager) | ||
{ | ||
var localThemeManager = new ThemeManager(this); | ||
localThemeManager.UseTheme(themeManager.CurrentTheme); | ||
this.WhenActivated(disposables => { }); | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
public BugReportWindow() { } | ||
} | ||
} |
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