Skip to content

Commit

Permalink
Added link to option in the settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Irame committed Mar 4, 2023
1 parent 085561d commit d27a707
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SmartCmdArgs/SmartCmdArgs.Shared/View/SettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Smart Commandline Arguments Settings" FontSize="20" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
<TextBlock Grid.Row="1" TextWrapping="WrapWithOverflow" Margin="5,0,0,5">Default values can be configured under Tools → Options → Smart Commandline Arguments</TextBlock>
<TextBlock Grid.Row="1" TextWrapping="WrapWithOverflow" Margin="5,0,0,5">Default values can be configured under <Hyperlink Command="{Binding OpenOptionsCommand}">Tools → Options → Smart Commandline Arguments</Hyperlink></TextBlock>
<ScrollViewer Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto">
<StackPanel VerticalAlignment="Top" HorizontalAlignment="Stretch">
<CheckBox Content="Save Settings to JSON" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,5,5" FontWeight="Bold" IsChecked="{Binding SaveSettingsToJson}" IsThreeState="True"/>
Expand Down
22 changes: 19 additions & 3 deletions SmartCmdArgs/SmartCmdArgs.Shared/ViewModel/SettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
using SmartCmdArgs.Helper;
using Microsoft.VisualStudio.Shell;
using SmartCmdArgs.Helper;
using System;
using System.Collections.Generic;
using System.IO.Packaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SmartCmdArgs.ViewModel
{
public class SettingsViewModel : PropertyChangedBase
{
private CmdArgsPackage _package;

private bool? _saveSettingsToJson;
private bool? _vcsSupportEnabled;
private bool? _useSolutionDir;
Expand Down Expand Up @@ -38,9 +43,19 @@ public bool? MacroEvaluationEnabled
set => SetAndNotify(value, ref _macroEvaluationEnabled);
}

public SettingsViewModel() { }
public RelayCommand OpenOptionsCommand { get; }

public SettingsViewModel(CmdArgsPackage package)
{
_package = package;

OpenOptionsCommand = new RelayCommand(() =>
{
package.ShowOptionPage(typeof(CmdArgsOptionPage));
});
}

public SettingsViewModel(SettingsViewModel other)
public SettingsViewModel(SettingsViewModel other) : this(other._package)
{
Assign(other);
}
Expand All @@ -49,6 +64,7 @@ public void Assign(SettingsViewModel other)
{
typeof(SettingsViewModel)
.GetProperties()
.Where(p => p.CanRead && p.CanWrite)
.ForEach(p => p.SetValue(this, p.GetValue(other)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ToolWindowViewModel(CmdArgsPackage package)

TreeViewModel = new TreeViewModel();

SettingsViewModel = new SettingsViewModel();
SettingsViewModel = new SettingsViewModel(package);

ToolWindowHistory.Init(this);

Expand Down

0 comments on commit d27a707

Please sign in to comment.