Skip to content

Commit

Permalink
Merge branch 'ErikEJ:master' into kusto-functions-support
Browse files Browse the repository at this point in the history
  • Loading branch information
barnuri authored Oct 13, 2024
2 parents 81a7683 + e359aec commit a983131
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
19 changes: 18 additions & 1 deletion src/GUI/EFCorePowerTools/Dialogs/PickServerDatabaseDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@
Style="{StaticResource SourceSelectionComboBoxStyle}"
ItemsSource="{Binding DatabaseConnections, Mode=OneWay}"
SelectedItem="{Binding SelectedDatabaseConnection, Mode=TwoWay}"
DisplayMemberPath="DisplayName"/>
>
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="ToolTip">
<Setter.Value>
<TextBlock Text="{Binding Path=ToolTip}" />
</Setter.Value>
</Setter>
</Style>
</ComboBox.ItemContainerStyle>
<!-- Here you can specify the Items including the Tooltip for each Item-->
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DisplayName}"
ToolTip="{Binding Path=ToolTip}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>

<Button Grid.Column="1"
Margin="8,12,0,12"
Expand Down
35 changes: 32 additions & 3 deletions src/GUI/Shared/ViewModels/DatabaseConnectionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ public string DisplayName

if (FilePath.EndsWith(".dacpac", StringComparison.InvariantCultureIgnoreCase))
{
return FilePath.Length > 40
? "..." + FilePath.Substring(FilePath.Length - 40)
: FilePath;
return $"{Path.GetFileNameWithoutExtension(FilePath)} (.dacpac)";
}
}

Expand All @@ -87,6 +85,37 @@ public string DisplayName
}
}

public string ToolTip
{
get
{
if (DataConnection == null)
{
if (DatabaseType == DatabaseType.SQLServerDacpac)
{
if (string.IsNullOrEmpty(FilePath))
{
return "<null>";
}

if (FilePath.EndsWith(".sqlproj", StringComparison.InvariantCultureIgnoreCase))
{
return FilePath;
}

if (FilePath.EndsWith(".dacpac", StringComparison.InvariantCultureIgnoreCase))
{
return FilePath;
}
}

return ConnectionString;
}

return ConnectionString;
}
}

public string ConnectionString
{
get => connectionString;
Expand Down

0 comments on commit a983131

Please sign in to comment.