Skip to content

Commit

Permalink
98 encrypt connection string when entered with characters (#100)
Browse files Browse the repository at this point in the history
* #98 Show * when password is entered
* Remove old Textbox replaced by PasswordBox
* Add format validation on AccountEndpoint
  • Loading branch information
sachabruttin authored May 5, 2023
1 parent ebce9ed commit 60ca5ff
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 183 deletions.
18 changes: 9 additions & 9 deletions src/CosmosDbExplorer/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:CosmosDbExplorer.Converters"
Startup="OnStartup"
Exit="OnExit"
xmlns:theming="clr-namespace:CosmosDbExplorer.Styles"
DispatcherUnhandledException="OnDispatcherUnhandledException">
DispatcherUnhandledException="OnDispatcherUnhandledException"
Exit="OnExit"
Startup="OnStartup">

<Application.Resources>
<ResourceDictionary>
<theming:CosmosDbExplorerThemeProvider x:Key="{x:Static theming:CosmosDbExplorerThemeProvider.DefaultInstance}" />

<!-- Converters -->
<!-- Converters -->
<converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
<converters:NullToVisibilityConverter x:Key="nullToVisibilityConverter" />
<converters:ActiveDocumentConverter x:Key="ActiveDocumentConverter" />
Expand All @@ -23,24 +23,24 @@
<converters:BytesToGigaBytesConverter x:Key="BytesToGigaBytesConverter" />
<!--<converters:QueryMetricsToStringConverter x:Key="queryMetricsToStringConverter" />-->
<!--<converters:QueryMetricsToDocumentConverter x:Key="queryMetricsToDocumentConverter" />-->

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/_FontSizes.xaml" />
<ResourceDictionary Source="/Styles/_Thickness.xaml" />
<ResourceDictionary Source="/Styles/MetroWindow.xaml" />
<ResourceDictionary Source="/Styles/TextBlock.xaml" />
<ResourceDictionary Source="/Styles/Icons.xaml" />
<!--
MahApps.Metro resource dictionaries.
Learn more about using MahApps.Metro at https://mahapps.com/
MahApps.Metro resource dictionaries.
Learn more about using MahApps.Metro at https://mahapps.com/
-->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Accent and AppTheme setting -->
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
<!-- Cosmos resource dictionaries -->
<!-- Cosmos resource dictionaries -->
<ResourceDictionary Source="pack://application:,,,/CosmosDbExplorer;component/Styles/CosmosControls.xaml" />
<ResourceDictionary Source="pack://application:,,,/CosmosDbExplorer;component/Styles/Themes/Dark.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/CosmosDbExplorer;component/Styles/Themes/Light.Blue.xaml" />
Expand Down
86 changes: 60 additions & 26 deletions src/CosmosDbExplorer/Styles/CosmosControls.xaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,54 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:converters="clr-namespace:CosmosDbExplorer.Converters"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:properties="clr-namespace:CosmosDbExplorer.Properties">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:converters="clr-namespace:CosmosDbExplorer.Converters"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:properties="clr-namespace:CosmosDbExplorer.Properties">

<converters:ColorToBrushConverter x:Key="colorToBrushConverter" />
<converters:NullToVisibilityConverter x:Key="nullToVisibilityConverter" />

<Style BasedOn="{StaticResource {x:Type mah:MetroProgressBar}}" TargetType="{x:Type mah:MetroProgressBar}"
x:Key="TreeViewProgress">
<Style
x:Key="TreeViewProgress"
BasedOn="{StaticResource {x:Type mah:MetroProgressBar}}"
TargetType="{x:Type mah:MetroProgressBar}">
<Setter Property="Foreground" Value="{StaticResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
<Setter Property="Margin" Value="0,0,0,-4" />
<Setter Property="IsIndeterminate" Value="True" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="IsEnabled" Value="True" />
</Style>

<Style BasedOn="{StaticResource {x:Type UserControl}}"
TargetType="{x:Type UserControl}"
x:Key="CosmosUserControl">

<Style
x:Key="CosmosUserControl"
BasedOn="{StaticResource {x:Type UserControl}}"
TargetType="{x:Type UserControl}">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ThemeBackground}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.ThemeForeground}" />
</Style>

<DataTemplate x:Key="AvalonDockHeaderTemplate">
<StackPanel Orientation="Horizontal" Margin="0" VerticalAlignment="Center">
<Canvas Height="14" Width="14" Margin="0" Visibility="{Binding Content.AccentColor, Converter={StaticResource nullToVisibilityConverter}, FallbackValue=Collapsed}">
<Ellipse Fill="{Binding Content.AccentColor, Converter={StaticResource colorToBrushConverter}}" Width="14" Height="14" />
<StackPanel
Margin="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Canvas
Width="14"
Height="14"
Margin="0"
Visibility="{Binding Content.AccentColor, Converter={StaticResource nullToVisibilityConverter}, FallbackValue=Collapsed}">
<Ellipse
Width="14"
Height="14"
Fill="{Binding Content.AccentColor, Converter={StaticResource colorToBrushConverter}}" />
</Canvas>

<Image Source="{Binding IconSource}" Height="14" Margin="3,0"/>
<TextBlock Text="{Binding Title}" VerticalAlignment="Bottom" />
<Image
Height="14"
Margin="3,0"
Source="{Binding IconSource}" />
<TextBlock VerticalAlignment="Bottom" Text="{Binding Title}" />
</StackPanel>
</DataTemplate>

Expand All @@ -40,30 +57,47 @@
<Border BorderBrush="DarkRed" BorderThickness="0,0,0,1.5">
<AdornedElementPlaceholder />
</Border>
<TextBlock Foreground="DarkRed" FontFamily="Segoe MDL2 Assets" Text="" VerticalAlignment="Top" Margin="-2,4,0,0" />
<TextBlock
Margin="-2,4,0,0"
VerticalAlignment="Top"
FontFamily="Segoe MDL2 Assets"
Foreground="DarkRed"
Text="" />
</StackPanel>
</ControlTemplate>

<ContextMenu x:Key="JsonEditorContextMenu">
<MenuItem Header="Cut" Command="ApplicationCommands.Cut">
<MenuItem Command="ApplicationCommands.Cut" Header="Cut">
<MenuItem.Icon>
<Image Source="{StaticResource CutIcon}" Height="16" Width="16" />
<Image
Width="16"
Height="16"
Source="{StaticResource CutIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Copy" Command="ApplicationCommands.Copy">
<MenuItem Command="ApplicationCommands.Copy" Header="Copy">
<MenuItem.Icon>
<Image Source="{StaticResource CopyIcon}" Height="16" Width="16" />
<Image
Width="16"
Height="16"
Source="{StaticResource CopyIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Paste" Command="ApplicationCommands.Paste">
<MenuItem Command="ApplicationCommands.Paste" Header="Paste">
<MenuItem.Icon>
<Image Source="{StaticResource PasteIcon}" Height="16" Width="16" />
<Image
Width="16"
Height="16"
Source="{StaticResource PasteIcon}" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Find..." Command="ApplicationCommands.Find">
<MenuItem Command="ApplicationCommands.Find" Header="Find...">
<MenuItem.Icon>
<Image Source="{StaticResource SearchIcon}" Height="16" Width="16" />
<Image
Width="16"
Height="16"
Source="{StaticResource SearchIcon}" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
Expand Down
Loading

0 comments on commit 60ca5ff

Please sign in to comment.