-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Global setting for command timeouts.
- Loading branch information
Showing
12 changed files
with
166 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using RPForEachDB.Properties; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RPForEachDB | ||
{ | ||
public interface IAppState | ||
{ | ||
IEnumerable<IServerModel> Servers { get; set; } | ||
int CommandTimeout { get; set; } | ||
void Save(); | ||
} | ||
public class AppState: IAppState | ||
{ | ||
public IEnumerable<IServerModel> Servers { get; set; } | ||
public int CommandTimeout | ||
{ | ||
get => Settings.Default.CommandTimeout; | ||
set => Settings.Default.CommandTimeout = value; | ||
} | ||
|
||
public AppState() | ||
{ | ||
Servers = Settings.Default.Servers ?? new IServerModel[0]; | ||
} | ||
|
||
public void Save() | ||
{ | ||
Settings.Default.Servers = Servers.Cast<ServerModel>().ToArray(); | ||
Settings.Default.Save(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,53 @@ | ||
<Window x:Class="RPForEachDB.SettingsWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:RPForEachDB" | ||
mc:Ignorable="d" | ||
Title="Settings" Height="330" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterOwner"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"></ColumnDefinition> | ||
</Grid.ColumnDefinitions> | ||
<TabControl Grid.Column="0"> | ||
<TabItem Header="Servers" Margin="0,-2,-4,0"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="auto"></ColumnDefinition> | ||
<ColumnDefinition Width="*"></ColumnDefinition> | ||
</Grid.ColumnDefinitions> | ||
<ListBox Grid.Column="0" HorizontalAlignment="Left" ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" VerticalAlignment="Top" Width="100" Height="230" ItemsSource="{Binding Servers}" DisplayMemberPath="Name" SelectedValue="{Binding CurrentModel}" SelectedIndex="{Binding CurrentModelIndex, Mode=OneWay}" /> | ||
<Label Content="Server" Grid.Column="1" HorizontalAlignment="Left" Margin="10,47,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.547,0.615"/> | ||
<TextBox Grid.Column="1" Height="23" Margin="85,19,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="{Binding CurrentModel.Name, UpdateSourceTrigger=PropertyChanged}"/> | ||
<TextBox Grid.Column="1" Height="23" Margin="85,50,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="{Binding CurrentModel.Server, UpdateSourceTrigger=PropertyChanged}"/> | ||
<RadioButton GroupName="SecurityMode" IsChecked="{Binding IsWindowsAuthentication, Mode=TwoWay}" Content="Windows" Grid.Column="1" HorizontalAlignment="Left" Margin="85,110,0,0" VerticalAlignment="Top" Checked="OnSecurityModeRadioClick"/> | ||
<RadioButton Name="SQLAuthenticationRadio" GroupName="SecurityMode" IsChecked="{Binding IsSQLAuthentication, Mode=TwoWay}" Content="SQL Server" Grid.Column="1" HorizontalAlignment="Left" Margin="85,130,0,0" VerticalAlignment="Top" Checked="OnSecurityModeRadioClick"/> | ||
<Grid Name="CredentialsGrid" Grid.Column="1" Margin="10,150,10,35"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="115*"/> | ||
</Grid.ColumnDefinitions> | ||
<TextBox Height="23" Margin="68,5,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="{Binding CurrentModel.Username, UpdateSourceTrigger=PropertyChanged}"/> | ||
<TextBox Name="PasswordField" Height="23" Margin="68,31,0,0" VerticalAlignment="Top" Text="{Binding CurrentModel.Password, UpdateSourceTrigger=PropertyChanged}"/> | ||
<Label Content="Username" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.ColumnSpan="2"/> | ||
<Label Content="Password" HorizontalAlignment="Left" Margin="0,28,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.517,1.559" Width="63" Grid.ColumnSpan="2"/> | ||
<Label Content="Passwords are stored in plain text." TextElement.Foreground="Red" Margin="41,54,0,0" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Top"/> | ||
</Grid> | ||
<Label Content="Name" Grid.Column="1" HorizontalAlignment="Left" Margin="10,16,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.547,0.615"/> | ||
<Button IsEnabled="{Binding IsDeleteEnabled}" Content="Delete" HorizontalAlignment="Left" Margin="85,236,0,0" Width="80" Grid.Column="1" RenderTransformOrigin="0.468,1.348" Click="OnDeleteBtnClick" Height="20" VerticalAlignment="Top"/> | ||
<Button Content="Add New" HorizontalAlignment="Right" Margin="0,236,10,0" Width="80" Click="OnAddNewBtnClick" Height="20" VerticalAlignment="Top"/> | ||
<Label Content="Security Mode" Grid.Column="1" HorizontalAlignment="Left" Margin="85,78,0,0" VerticalAlignment="Top"/> | ||
<Button Content="Close" Margin="204,236,10,0" Grid.Column="1" RenderTransformOrigin="0.468,1.348" Click="OnCloseBtnClick" Height="20" VerticalAlignment="Top"/> | ||
|
||
</Grid> | ||
</TabItem> | ||
<TabItem Header="Global"> | ||
<Grid> | ||
<TextBox HorizontalAlignment="Left" Height="23" PreviewTextInput="TextBox_PreviewTextInput" PreviewKeyDown="TextBox_PreviewKeyDown" PreviewMouseWheel="TextBox_PreviewMouseWheel" Margin="127,13,0,0" TextWrapping="Wrap" Text="{Binding CommandTimeout, Mode=TwoWay}" VerticalAlignment="Top" Width="251"/> | ||
<Label Content="Command Timeout" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/> | ||
<Button Content="Close" Margin="304,236,10,0" Click="OnCloseBtnClick" Height="20" VerticalAlignment="Top"/> | ||
</Grid> | ||
</TabItem> | ||
</TabControl> | ||
</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
This file was deleted.
Oops, something went wrong.