Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilian-hammerl committed Oct 23, 2022
1 parent 7a275c5 commit f36fd08
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion RSHExporter/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace RSHExporter;

/// <summary>
/// Interaction logic for App.xaml
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
Expand Down
20 changes: 9 additions & 11 deletions RSHExporter/Controls/InvertedBooleanToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
namespace RSHExporter.Controls;

/// <summary>
/// Convert between boolean and visibility
/// Convert between boolean and visibility
/// </summary>
[Localizability(LocalizationCategory.NeverLocalize)]
public sealed class InvertedBooleanToVisibilityConverter : IValueConverter
{
/// <summary>
/// Convert bool or Nullable&lt;bool&gt; to Visibility
/// Convert bool or Nullable&lt;bool&gt; to Visibility
/// </summary>
/// <param name="value">bool or Nullable&lt;bool&gt;</param>
/// <param name="targetType">Visibility</param>
Expand All @@ -21,22 +21,22 @@ public sealed class InvertedBooleanToVisibilityConverter : IValueConverter
/// <returns>Visible or Collapsed</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool bValue = false;
var bValue = false;
if (value is bool)
{
bValue = (bool)value;
}
else if (value is Nullable<bool>)
else if (value is bool?)
{
Nullable<bool> tmp = (Nullable<bool>)value;
var tmp = (bool?)value;
bValue = tmp.HasValue ? tmp.Value : false;
}

return (bValue) ? Visibility.Collapsed : Visibility.Visible;
return bValue ? Visibility.Collapsed : Visibility.Visible;
}

/// <summary>
/// Convert Visibility to boolean
/// Convert Visibility to boolean
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
Expand All @@ -49,9 +49,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
return (Visibility)value == Visibility.Collapsed;
}
else
{
return false;
}

return false;
}
}
5 changes: 2 additions & 3 deletions RSHExporter/Resources/Localization/Resources.de.resx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<root>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
id="root" xmlns="">
<xsd:element name="root" msdata:IsDataSet="true">

</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
Expand Down
5 changes: 2 additions & 3 deletions RSHExporter/Resources/Localization/Resources.resx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<root>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
id="root" xmlns="">
<xsd:element name="root" msdata:IsDataSet="true">

</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
Expand Down
4 changes: 2 additions & 2 deletions RSHExporter/Scrape/Scraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private static HttpClient GetOrCreateHttpClient(bool createNew = false)
AllowAutoRedirect = true,
UseDefaultCredentials = true,
CookieContainer = cookieContainer,
UseCookies = true,
UseCookies = true
};
_client = new HttpClient(clientHandler);
_client.DefaultRequestHeaders.UserAgent.ParseAdd(
Expand Down Expand Up @@ -437,7 +437,7 @@ private static async Task<bool> Login(string username, string password)
{
new("username", username),
new("password", password),
new("use_cookie", "1"),
new("use_cookie", "1")
}
);

Expand Down
2 changes: 1 addition & 1 deletion RSHExporter/View/FeedbackDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public partial class FeedbackDialog : Window
public enum FeedbackType
{
Default,
Error,
Error
}

public FeedbackDialog(FeedbackType feedbackType, string? id = null)
Expand Down
19 changes: 9 additions & 10 deletions RSHExporter/View/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
using System.Windows;
using RSHExporter.View.Pages;

namespace RSHExporter.View
namespace RSHExporter.View;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public MainWindow()
{
public MainWindow()
{
InitializeComponent();
InitializeComponent();

MainFrame.Navigate(new LicensePage());
}
MainFrame.Navigate(new LicensePage());
}
}
1 change: 0 additions & 1 deletion RSHExporter/View/Pages/ExportPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public ExportPage(List<Thread> threads)
SelectableFileFormats = new ObservableCollection<SelectableFileFormat>();
foreach (var fileFormat in Enum.GetValues<FileFormat>())
{
// FIXME
SelectableFileFormats.Add(new SelectableFileFormat(fileFormat,
ExportConfiguration.FileFormats.Contains(fileFormat)));
}
Expand Down
10 changes: 6 additions & 4 deletions RSHExporter/View/Pages/LicensePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Windows;
using System.Globalization;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using RSHExporter.Utils;
Expand All @@ -13,7 +15,7 @@ public LicensePage()

VersionTextBlock.Text = Util.GetVersion();

var currentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
var currentCulture = Thread.CurrentThread.CurrentUICulture.Name;
if (currentCulture == "de" || currentCulture.StartsWith("de-"))
{
ToGermanButton.IsEnabled = false;
Expand All @@ -36,13 +38,13 @@ private void DeclineButton_OnClick(object sender, RoutedEventArgs e)

private void ToGermanButton_OnClick(object sender, RoutedEventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");
NavigationService.Navigate(new LicensePage());
}

private void ToEnglishButton_OnClick(object sender, RoutedEventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
NavigationService.Navigate(new LicensePage());
}

Expand Down
11 changes: 6 additions & 5 deletions RSHExporter/View/Pages/SelectPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
HorizontalAlignment="Center" />
</Grid>
</Button>

<Button Click="UnselectAllGroups_OnClick" Width="200"
Style="{StaticResource IconButtonStyle}">

Expand All @@ -259,7 +259,7 @@
HorizontalAlignment="Center" />
</Grid>
</Button>

<Button Click="SelectAllGroupsThreads_OnClick" Width="300"
Style="{StaticResource IconButtonStyle}">

Expand All @@ -280,7 +280,7 @@
HorizontalAlignment="Center" />
</Grid>
</Button>

<Button Click="UnselectAllGroupsThreads_OnClick" Width="300"
Style="{StaticResource IconButtonStyle}">

Expand All @@ -297,11 +297,12 @@
<Image Grid.Row="0" Grid.Column="0" fa:FontAwesome.Icon="Solid_Minus"
Style="{StaticResource IconImageStyle}" />

<TextBlock Grid.Row="0" Grid.Column="1" Text="{x:Static l:Resources.SelectUnselectGroupsThreads}"
<TextBlock Grid.Row="0" Grid.Column="1"
Text="{x:Static l:Resources.SelectUnselectGroupsThreads}"
HorizontalAlignment="Center" />
</Grid>
</Button>

</StackPanel>
</Border>

Expand Down
2 changes: 1 addition & 1 deletion RSHExporter/View/Pages/WelcomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public WelcomePage()
VersionTextBlock.Text = Util.GetVersion();
}

public static bool CollectDataAccepted { get; private set; } = false;
public static bool CollectDataAccepted { get; private set; }

private void HelpButton_OnClick(object sender, RoutedEventArgs e)
{
Expand Down

0 comments on commit f36fd08

Please sign in to comment.