Skip to content

Commit

Permalink
Refactoring: Move controls and resources in their own namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrondeau committed Jul 27, 2014
1 parent 1817c3b commit bfd4d54
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 21 deletions.
1 change: 1 addition & 0 deletions GoToWindow.Api/GoToWindow.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InterceptAltTab.cs" />
<Compile Include="IWindowEntry.cs" />
<Compile Include="ProcessExtensions.cs" />
<Compile Include="WindowEntry.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.InteropServices;
using System.Windows.Input;

namespace GoToWindow
namespace GoToWindow.Api
{
public class InterceptAltTab : IDisposable
{
Expand Down
3 changes: 2 additions & 1 deletion GoToWindow/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Hardcodet.Wpf.TaskbarNotification;
using GoToWindow.Api;
using Hardcodet.Wpf.TaskbarNotification;
using System;
using System.Collections.Generic;
using System.Configuration;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<UserControl x:Class="GoToWindow.WindowListEntry"
<UserControl x:Class="GoToWindow.Controls.WindowListEntry"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:gotowindow="clr-namespace:GoToWindow"
xmlns:gotowindowConverters="clr-namespace:GoToWindow.Converters"
mc:Ignorable="d" Height="48"
d:DesignHeight="48" d:DesignWidth="512">
<UserControl.Resources>
<gotowindow:ExecutableToIconValueConverter x:Key="IconConverter" />
<gotowindowConverters:ExecutableToIconValueConverter x:Key="IconConverter" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GoToWindow
namespace GoToWindow.Controls
{
/// <summary>
/// Interaction logic for WindowListEntry.xaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace GoToWindow
namespace GoToWindow.Converters
{
[ValueConversion(typeof(string), typeof(BitmapFrame))]
public class ExecutableToIconValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;

var iconStream = new MemoryStream();

using(var icon = Icon.ExtractAssociatedIcon((string)value))
Expand Down
17 changes: 8 additions & 9 deletions GoToWindow/GoToWindow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,26 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ExecutableToIconValueConverter.cs" />
<Compile Include="ExitCommand.cs" />
<Compile Include="Converters\ExecutableToIconValueConverter.cs" />
<Compile Include="Commands\ExitCommand.cs" />
<Compile Include="GoToWindowContext.cs" />
<Compile Include="InterceptAltTab.cs" />
<Compile Include="OpenMainWindowCommand.cs" />
<Compile Include="WindowListEntry.xaml.cs">
<Compile Include="Commands\OpenMainWindowCommand.cs" />
<Compile Include="Controls\WindowListEntry.xaml.cs">
<DependentUpon>WindowListEntry.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Page Include="Windows\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<Compile Include="Windows\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="WindowListEntry.xaml">
<Page Include="Controls\WindowListEntry.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down Expand Up @@ -116,7 +115,7 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="AppIcon.ico" />
<Resource Include="Resources\AppIcon.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GoToWindow.Api\GoToWindow.Api.csproj">
Expand Down
2 changes: 1 addition & 1 deletion GoToWindow/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AppIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\AppIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>..\Resources\AppIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Window x:Class="GoToWindow.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gotowindow="clr-namespace:GoToWindow"
xmlns:gotowindowControls="clr-namespace:GoToWindow.Controls"
Title="Go To Window" Height="Auto" Width="640"
WindowStartupLocation="CenterScreen"
AllowsTransparency="True"
Background="Transparent"
WindowStyle="None"
Icon="AppIcon.ico"
Icon="..\Resources\AppIcon.ico"
Topmost="True"
ShowInTaskbar="False"
FocusManager.FocusedElement="{Binding ElementName=searchTextBox}"
Expand Down Expand Up @@ -85,7 +85,7 @@
</ListView.Style>
<ListView.ItemTemplate>
<DataTemplate>
<gotowindow:WindowListEntry />
<gotowindowControls:WindowListEntry />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public partial class MainWindow : Window
{
public MainWindow()
{

InitializeComponent();
}

Expand Down

0 comments on commit bfd4d54

Please sign in to comment.