Skip to content

Commit

Permalink
Release 1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
FolkerKinzel committed Mar 6, 2021
1 parent c9e0ee4 commit 1006fff
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 86 deletions.
Binary file not shown.
Binary file not shown.
10 changes: 7 additions & 3 deletions FolkerKinzel.RecentFiles.WPF/FolkerKinzel.RecentFiles.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
<!-- nuget-Package: -->
<PackageId>FolkerKinzel.RecentFiles.WPF</PackageId>
<Product>FolkerKinzel.RecentFiles.WPF</Product>
<Version>1.3.2</Version>
<FileVersion>1.3.2.4</FileVersion>
<Version>1.3.3</Version>
<FileVersion>1.3.3.13</FileVersion>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<PackageReleaseNotes>Dependency update</PackageReleaseNotes>
<PackageReleaseNotes>
Fixed an issue with nullable reference types.
Added a .NET 5.0 - Windows 7.0 dll to the package.
The constructor of RecentFileSelectedEventArgs is now internal.
</PackageReleaseNotes>
<PackageTags>recent menu WPF</PackageTags>
<Description>Recent files menu for WPF applications.</Description>
<Authors>Folker Kinzel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public sealed class RecentFileSelectedEventArgs : EventArgs
/// Initialisiert ein <see cref="RecentFileSelectedEventArgs"/>-Objekt.
/// </summary>
/// <param name="fileName">Der Dateiname der ausgewählten Datei.</param>
public RecentFileSelectedEventArgs(string fileName) => FileName = fileName;
internal RecentFileSelectedEventArgs(string fileName) => FileName = fileName;

/// <summary>
/// Der ausgewählte Dateiname.
Expand Down
2 changes: 1 addition & 1 deletion FolkerKinzel.RecentFiles.WPF/RecentFilesMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace FolkerKinzel.RecentFiles.WPF
/// </remarks>
/// <example>
/// <para>Initialisieren von <see cref="RecentFilesMenu"/>:</para>
/// <code language="cs" source="..\WpfExample\App.xaml.cs" />
/// <code language="cs" source="..\WpfExample\App-Doku.xaml.cs" />
/// <para>Einbinden von <see cref="RecentFilesMenu"/> in ein WPF-<see cref="Window"/>:</para>
/// <code language="cs" source="..\WpfExample\MainWindow.xaml.cs" />
/// </example>
Expand Down
Binary file not shown.
Binary file not shown.
54 changes: 13 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ Recent files menu for WPF applications.

```
nuget Package Manager:
PM> Install-Package FolkerKinzel.RecentFiles.WPF -Version 1.3.2
PM> Install-Package FolkerKinzel.RecentFiles.WPF -Version 1.3.3
.NET CLI:
> dotnet add package FolkerKinzel.RecentFiles.WPF --version 1.3.2
> dotnet add package FolkerKinzel.RecentFiles.WPF --version 1.3.3
PackageReference (Visual Studio Project File):
<PackageReference Include="FolkerKinzel.RecentFiles.WPF" Version="1.3.2" />
<PackageReference Include="FolkerKinzel.RecentFiles.WPF" Version="1.3.3" />
Paket CLI:
> paket add FolkerKinzel.RecentFiles.WPF --version 1.3.2
> paket add FolkerKinzel.RecentFiles.WPF --version 1.3.3
F# Interactive:
> #r "nuget: FolkerKinzel.RecentFiles.WPF, 1.3.2"
> #r "nuget: FolkerKinzel.RecentFiles.WPF, 1.3.3"
```

* [Download Reference (English)](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.2/FolkerKinzel.RecentFiles.WPF.Reference.en.chm)
* [Download Reference (English)](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.3/FolkerKinzel.RecentFiles.WPF.Reference.en.chm)

* [Projektdokumentation (Deutsch) herunterladen](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.2/FolkerKinzel.RecentFiles.Doku.de.chm)
* [Projektdokumentation (Deutsch) herunterladen](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.3/FolkerKinzel.RecentFiles.Doku.de.chm)

> IMPORTANT: On some systems, the content of the CHM file is blocked. Before opening the file
> right click on it, select Properties, and check the "Allow" checkbox - if it
Expand All @@ -41,9 +41,7 @@ F# Interactive:
#### Initializing a RecentFilesMenu object:
```c#
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Windows;
using FolkerKinzel.RecentFiles.WPF;

Expand All @@ -54,21 +52,21 @@ namespace WpfExample
/// </summary>
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
private void Application_Startup(object? sender, StartupEventArgs e)
{
// The example initializes a new RecentFilesMenu which persists its data in
// the same directory, where the program exe-file is. The constructor has
// optional parameters to substitute the text "Clear list" to something in
// another language and to control the maximum number of files to be displayed.
string persistenceDirectoryPath =
Path.GetDirectoryName(Process.GetCurrentProcess().MainModule!.FileName)!;

var rfm = new RecentFilesMenu(persistenceDirectoryPath);

new MainWindow(rfm).Show();
}
}
}

```

#### Including RecentFilesMenu into a WPF-Window:
Expand Down Expand Up @@ -125,7 +123,7 @@ namespace WpfExample
}


private void Window_Loaded(object sender, RoutedEventArgs e)
private void Window_Loaded(object? sender, RoutedEventArgs e)
{
// Assign the RecentFilesMenu the MenuItem next to which the
// RecentFilesMenu is to be displayed:
Expand All @@ -137,7 +135,7 @@ namespace WpfExample
}


private async void Window_Closed(object sender, EventArgs e)
private async void Window_Closed(object? sender, EventArgs e)
{
// Wait all tasks to be finished before disposing the
// recent files menu:
Expand All @@ -146,15 +144,15 @@ namespace WpfExample
}


private void Quit_Click(object sender, RoutedEventArgs e) => Close();
private void Quit_Click(object? sender, RoutedEventArgs e) => Close();


private void RecentFilesMenu_RecentFileSelected(
object? sender,
RecentFileSelectedEventArgs e) => OpenFile(e.FileName);


private void Open_Executed(object sender, ExecutedRoutedEventArgs e)
private void Open_Executed(object? sender, ExecutedRoutedEventArgs e)
{
var dialog = new OpenFileDialog();

Expand Down Expand Up @@ -182,32 +180,6 @@ namespace WpfExample
}


private void SaveAs_Executed(object sender, ExecutedRoutedEventArgs e)
{
var dialog = new SaveFileDialog();

if (CurrentFile != null)
{
dialog.InitialDirectory = Path.GetDirectoryName(CurrentFile);
dialog.FileName = Path.GetFileName(CurrentFile);
}

if (dialog.ShowDialog(this) == true)
{
try
{
// Save the file here!
CurrentFile = dialog.FileName;
}
catch (IOException)
{

}
}
}


private void OnPropertyChanged([CallerMemberName] string propName = "")
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
}
Expand Down
4 changes: 2 additions & 2 deletions Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Recent files menu for WPF applications.

.

* [Download Reference (English)](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.2/FolkerKinzel.RecentFiles.WPF.Reference.en.chm)
* [Download Reference (English)](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.3/FolkerKinzel.RecentFiles.WPF.Reference.en.chm)

* [Projektdokumentation (Deutsch) herunterladen](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.2/FolkerKinzel.RecentFiles.Doku.de.chm)
* [Projektdokumentation (Deutsch) herunterladen](https://github.com/FolkerKinzel/RecentFiles.WPF/blob/master/ProjectReference/1.3.3/FolkerKinzel.RecentFiles.Doku.de.chm)

> IMPORTANT: On some systems, the content of the CHM file is blocked. Before opening the file right click on it, select Properties, and check the "Allow" checkbox - if it is present - in the lower right corner of the General tab in the Properties dialog.
27 changes: 27 additions & 0 deletions WpfExample/App-Doku.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Diagnostics;
using System.IO;
using System.Windows;
using FolkerKinzel.RecentFiles.WPF;

namespace WpfExample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private void Application_Startup(object? sender, StartupEventArgs e)
{
// The example initializes a new RecentFilesMenu which persists its data in
// the same directory, where the program exe-file is. The constructor has
// optional parameters to substitute the text "Clear list" to something in
// another language and to control the maximum number of files to be displayed.
string persistenceDirectoryPath =
Path.GetDirectoryName(Process.GetCurrentProcess().MainModule!.FileName)!;

var rfm = new RecentFilesMenu(persistenceDirectoryPath);

new MainWindow(rfm).Show();
}
}
}
8 changes: 3 additions & 5 deletions WpfExample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Windows;
using FolkerKinzel.RecentFiles.WPF;

Expand All @@ -12,10 +10,10 @@ namespace WpfExample
/// </summary>
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
private void Application_Startup(object? sender, StartupEventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
//Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
//Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

// The example initializes a new RecentFilesMenu which persists its data in
// the same directory, where the program exe-file is. The constructor has
Expand Down
6 changes: 3 additions & 3 deletions WpfExample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="Open" Executed="Open_Executed" />
<CommandBinding Command="SaveAs" Executed="SaveAs_Executed" />
<!--<CommandBinding Command="SaveAs" Executed="SaveAs_Executed" />-->
</Window.CommandBindings>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem Command="Open"/>
<MenuItem Command="SaveAs"/>
<!--<MenuItem Command="SaveAs"/>-->
<MenuItem Name="_miRecentFiles" Header="RecentFiles"/>
<Separator/>
<MenuItem Header="Quit" Click="Quit_Click"/>
</MenuItem>
</Menu>
<Image Name="imgIcon" Source="{Binding ImageSource}" Width="32" Height="32" DockPanel.Dock="Top"/>
<!--<Image Name="imgIcon" Source="{Binding ImageSource}" Width="32" Height="32" DockPanel.Dock="Top"/>-->
<Grid DockPanel.Dock="Top">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="24" FontWeight="Bold" TextAlignment="Center">Open some files to see the RecentFilesMenu in action.</TextBlock>
Expand Down
34 changes: 4 additions & 30 deletions WpfExample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private set
}


private void Window_Loaded(object sender, RoutedEventArgs e)
private void Window_Loaded(object? sender, RoutedEventArgs e)
{
// Assign the RecentFilesMenu the MenuItem next to which the
// RecentFilesMenu is to be displayed:
Expand All @@ -61,7 +61,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
}


private async void Window_Closed(object sender, EventArgs e)
private async void Window_Closed(object? sender, EventArgs e)
{
// Wait all tasks to be finished before disposing the
// recent files menu:
Expand All @@ -70,15 +70,15 @@ private async void Window_Closed(object sender, EventArgs e)
}


private void Quit_Click(object sender, RoutedEventArgs e) => Close();
private void Quit_Click(object? sender, RoutedEventArgs e) => Close();


private void RecentFilesMenu_RecentFileSelected(
object? sender,
RecentFileSelectedEventArgs e) => OpenFile(e.FileName);


private void Open_Executed(object sender, ExecutedRoutedEventArgs e)
private void Open_Executed(object? sender, ExecutedRoutedEventArgs e)
{
var dialog = new OpenFileDialog();

Expand Down Expand Up @@ -106,32 +106,6 @@ private void OpenFile(string fileName)
}


private void SaveAs_Executed(object sender, ExecutedRoutedEventArgs e)
{
var dialog = new SaveFileDialog();

if (CurrentFile != null)
{
dialog.InitialDirectory = Path.GetDirectoryName(CurrentFile);
dialog.FileName = Path.GetFileName(CurrentFile);
}

if (dialog.ShowDialog(this) == true)
{
try
{
// Save the file here!

CurrentFile = dialog.FileName;
}
catch (IOException)
{

}
}
}


private void OnPropertyChanged([CallerMemberName] string propName = "")
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
}
Expand Down
1 change: 1 addition & 0 deletions WpfExample/WpfExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</PropertyGroup>

<ItemGroup>
<Compile Remove="App-Doku.xaml.cs" />
<Compile Remove="DefaultIcons.cs" />
<Compile Remove="DefaultIcons2.cs" />
</ItemGroup>
Expand Down

0 comments on commit 1006fff

Please sign in to comment.