Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamsoft committed May 24, 2024
2 parents d5fc346 + cdb266f commit dd31072
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ You can easily target elements of the dialogs via their names and types, such as
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,0"/>
</Style>


<!-- Override Wizard complete ellipse fill and stroke -->
<Style Selector="controls|WizardStep:complete /template/ Ellipse#PART_SelectedPipe">
<Setter Property="Fill" Value="DeepPink" />
<Setter Property="StrokeThickness" Value="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class MainWindowViewModel : ViewModelBase
{
private readonly IDialogService _dialogService;
private ICommand? _openFileCommand;
private ICommand? _openFolderCommand;
private ICommand? _openWordFileCommand;
private ICommand? _saveFileCommand;
private ICommand? _saveWordFileCommand;
Expand All @@ -39,6 +40,8 @@ public MainWindowViewModel(IDialogService dialogService)

OpenFileCommand = new DelegateCommand(OpenFileCommandExecuted, () => true);

OpenFolderCommand = new DelegateCommand(OpenFolderCommandExecuted, () => true);

OpenWordFileCommand = new DelegateCommand(OpenWordFileCommandExecuted, () => true);

OpenFilesCommand = new DelegateCommand(OpenFilesCommandExecuted, () => true);
Expand Down Expand Up @@ -66,6 +69,12 @@ public MainWindowViewModel(IDialogService dialogService)
WizardViewCommand = new DelegateCommand(WizardViewCommandExecuted, () => true);
}

public ICommand? OpenFolderCommand
{
get => _openFolderCommand;
set => this.RaiseAndSetIfChanged(ref _openFolderCommand, value);
}

public ICommand? WizardViewCommand
{
get => _wizardViewCommand;
Expand Down Expand Up @@ -161,6 +170,11 @@ private async void OpenFileCommandExecuted()
Message = await _dialogService.OpenFile("Open Any File");
}

private async void OpenFolderCommandExecuted()
{
Message = await _dialogService.OpenFolder("Open Any Folder");
}

private async void OpenWordFileCommandExecuted()
{
Message = await _dialogService.OpenFile("Open Word File", new List<FilePickerFileType>
Expand Down
4 changes: 3 additions & 1 deletion src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
<TextBlock Text="{Binding Message}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap"/>
</StackPanel>

<UniformGrid Grid.Row="1" Columns="3">
<UniformGrid Grid.Row="1" Columns="4">

<Button Command="{Binding OpenFileCommand}" Classes="horizontalCenter">Open File</Button>

<Button Command="{Binding OpenWordFileCommand}" Classes="horizontalCenter">Open Word File</Button>

<Button Command="{Binding OpenFilesCommand}" Classes="horizontalCenter">Open Files</Button>

<Button Command="{Binding OpenFolderCommand}" Classes="horizontalCenter">Open Folder</Button>

<Button Command="{Binding SaveFileCommand}" Classes="horizontalCenter">Save File</Button>

<Button Command="{Binding SaveWordFileCommand}" Classes="horizontalCenter">Save Word File</Button>
Expand Down
9 changes: 5 additions & 4 deletions src/JamSoft.AvaloniaUI.Dialogs/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ public void StartWizard<TViewModel>(TViewModel viewModel, Action<TViewModel>? ca
Title = CreateTitle(title)
});

//var path = await fd.ShowAsync(GetActiveWindowOrMainWindow());
if (path.Count < 1)
return null;

_lastDirectorySelected = path[0].Path.AbsolutePath;
_lastDirectorySelected = path[0].Path.LocalPath;

return _lastDirectorySelected;
}
Expand All @@ -211,7 +212,7 @@ public void StartWizard<TViewModel>(TViewModel viewModel, Action<TViewModel>? ca
DefaultExtension = defaultExtension
});

return fd?.Path.AbsolutePath;
return fd?.Path.LocalPath;
}

/// <summary>
Expand Down Expand Up @@ -260,7 +261,7 @@ public void StartWizard<TViewModel>(TViewModel viewModel, Action<TViewModel>? ca
SuggestedStartLocation = folder
});

return fd.Select(x => x.Path.AbsolutePath).ToArray();
return fd.Select(x => x.Path.LocalPath).ToArray();
}

private IStorageProvider GetStorageProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>JamSoft.AssemblyKeyFile.snk</AssemblyOriginatorKeyFile>
<PublicSign>true</PublicSign>
<Version>1.2.0</Version>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
<Version>1.2.1</Version>
<AssemblyVersion>1.2.1.0</AssemblyVersion>
<FileVersion>1.2.1.0</FileVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<InformationalVersion>1.2.0.0-rel</InformationalVersion>
<InformationalVersion>1.2.1.0-rel</InformationalVersion>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
Expand Down

0 comments on commit dd31072

Please sign in to comment.