Skip to content

Commit

Permalink
Initial checkin of bulk-query application.
Browse files Browse the repository at this point in the history
  • Loading branch information
tloten committed Feb 5, 2017
1 parent 706ced9 commit 20cf0ed
Show file tree
Hide file tree
Showing 21 changed files with 1,163 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj/
bin/
33 changes: 33 additions & 0 deletions AddServerDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Window x:Class="BulkQuery.AddServerDialog"
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:BulkQuery"
mc:Ignorable="d"
Title="Add Server" Height="192" Width="495">
<Grid Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Label Grid.Column="1" Grid.Row="0" >Server Connection String</Label>
<TextBox Name="TextBoxConnectionString" Grid.Column="1" Grid.Row="1" MinWidth="250">Server=(localdb)\Projects;Integrated Security=True;</TextBox>

<Label Grid.Column="1" Grid.Row="2" >Server Label</Label>
<TextBox Name="TextBoxDisplayName" Grid.Column="1" Grid.Row="3" MinWidth="250">Test-1</TextBox>

<WrapPanel Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Right" Margin="0,15,0,0">
<Button IsDefault="True" Name="BtnAddServer" Click="BtnAddServer_Click" MinWidth="80" Margin="0,0,10,0">_Add Server</Button>
<Button IsCancel="True" MinWidth="60">_Cancel</Button>
</WrapPanel>
</Grid>
</Window>
24 changes: 24 additions & 0 deletions AddServerDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Windows;

namespace BulkQuery
{
/// <summary>
/// Interaction logic for AddServerDialog.xaml
/// </summary>
public partial class AddServerDialog : Window
{
public AddServerDialog()
{
InitializeComponent();
}

private void BtnAddServer_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}

public string ServerConnectionString => TextBoxConnectionString.Text.Trim();

public string ServerDisplayName => TextBoxDisplayName.Text.Trim();
}
}
21 changes: 21 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="BulkQuery.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<userSettings>
<BulkQuery.Properties.Settings>
<setting name="HideSystemDatabases" serializeAs="String">
<value>False</value>
</setting>
<setting name="NeedsUpgrade" serializeAs="String">
<value>True</value>
</setting>
</BulkQuery.Properties.Settings>
</userSettings>
</configuration>
9 changes: 9 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="BulkQuery.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BulkQuery"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
11 changes: 11 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Windows;

namespace BulkQuery
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
Binary file added AppIcon.ico
Binary file not shown.
130 changes: 130 additions & 0 deletions BulkQuery.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ACC1EC9F-6EF5-4B99-A978-EE407403FBB8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BulkQuery</RootNamespace>
<AssemblyName>BulkQuery</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>BulkQuery.App</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>AppIcon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="AddServerDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="AddServerDialog.xaml.cs">
<DependentUpon>AddServerDialog.xaml</DependentUpon>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="DatabaseDefinition.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="QueryRunner.cs" />
<Compile Include="ServerDefinition.cs" />
<Compile Include="ServersList.cs" />
<Compile Include="TreeViewModel .cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="AppIcon.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
22 changes: 22 additions & 0 deletions BulkQuery.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BulkQuery", "BulkQuery.csproj", "{ACC1EC9F-6EF5-4B99-A978-EE407403FBB8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ACC1EC9F-6EF5-4B99-A978-EE407403FBB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACC1EC9F-6EF5-4B99-A978-EE407403FBB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACC1EC9F-6EF5-4B99-A978-EE407403FBB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACC1EC9F-6EF5-4B99-A978-EE407403FBB8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
20 changes: 20 additions & 0 deletions DatabaseDefinition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BulkQuery
{
public class DatabaseDefinition
{
public ServerDefinition Server { get; }
public string DatabaseName { get; }

public DatabaseDefinition(string databaseName, ServerDefinition server)
{
DatabaseName = databaseName;
Server = server;
}
}
}
72 changes: 72 additions & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<Window x:Class="BulkQuery.MainWindow"
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:BulkQuery"
xmlns:properties="clr-namespace:BulkQuery.Properties"
mc:Ignorable="d"
Title="Bulk Query" Height="500" Width="800" Loaded="Window_Loaded" Closing="Window_Closing" KeyDown="Window_KeyDown">

<Window.Resources>
<ResourceDictionary>
<Style x:Key="TreeViewItemStyle" TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="IsSelected" Value="{Binding IsInitiallySelected, Mode=OneTime}" />
<Setter Property="KeyboardNavigation.AcceptsReturn" Value="True" />
<EventSetter Event="PreviewMouseRightButtonDown" Handler="DatabasesTreeView_PreviewMouseButton" />
</Style>

<HierarchicalDataTemplate x:Key="CheckBoxItemTemplate" ItemsSource="{Binding Children, Mode=OneTime}">
<StackPanel Orientation="Horizontal">
<CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center" />
<ContentPresenter x:Name="Content" Content="{Binding Name, Mode=OneTime}" Margin="2,0" />
</StackPanel>
</HierarchicalDataTemplate>
</ResourceDictionary>
</Window.Resources>

<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="_Add Server" Click="MenuItem_AddServer_OnClick" />
<MenuItem Header="_Hide System Databases" Name="MenuItemHideSystemDatabases" IsCheckable="True" IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=HideSystemDatabases}" />
<MenuItem Header="_Exit" />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_View On Github" Click="MenuItem_Github_Click" />
</MenuItem>
</Menu>
<TextBox AcceptsReturn="True" />

<Grid Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TreeView Grid.Column="0" x:Name="DatabasesTreeView"
ItemContainerStyle="{StaticResource TreeViewItemStyle}"
ItemTemplate="{StaticResource CheckBoxItemTemplate}" />
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" DragDelta="MainGrid_OnDragDelta" />
<Grid Grid.Column="2" Name="RightHandGrid">
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition Height="5" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<DockPanel Grid.Row="0">
<StackPanel Margin="5" Orientation="Horizontal" DockPanel.Dock="Bottom">
<Button Click="ButtonQuery_OnClick" Padding="10 2">Run Query (F5)</Button>
</StackPanel>
<TextBox x:Name="QueryTextBox" TextWrapping="Wrap" AcceptsReturn="True" FontFamily="Courier New" />
</DockPanel>
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" DragDelta="RightHandGrid_OnDragDelta" />
<DockPanel Grid.Row="2">
<TextBox x:Name="TextBoxMessages" DockPanel.Dock="Top" Visibility="Collapsed" Height="50" IsReadOnly="True" Foreground="Red" />
<DataGrid x:Name="ResultDataGrid" IsReadOnly="True" SelectionUnit="CellOrRowHeader" AreRowDetailsFrozen="True" />
</DockPanel>
</Grid>
</Grid>
</DockPanel>
</Window>
Loading

0 comments on commit 20cf0ed

Please sign in to comment.