Skip to content

Commit

Permalink
Adding solution for client application.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentedwards committed Dec 14, 2010
1 parent cfac056 commit 862b812
Show file tree
Hide file tree
Showing 59 changed files with 15,839 additions and 3 deletions.
90 changes: 90 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/BrentEdwards.MVVM.Movies.Core.csproj
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D10AC932-FFB4-4118-AE31-C628AA42BA91}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrentEdwards.MVVM.Movies.Core</RootNamespace>
<AssemblyName>BrentEdwards.MVVM.Movies.Core</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core">
<HintPath>..\lib\castle\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.Windsor">
<HintPath>..\lib\castle\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ComponentContainer.cs" />
<Compile Include="Conversion\BoolToVisibilityConverter.cs" />
<Compile Include="Conversion\RatingTemplateSelector.cs" />
<Compile Include="Messaging\CloseViewMessage.cs" />
<Compile Include="Messaging\SearchMessage.cs" />
<Compile Include="ModalDialogs\Dialog.cs" />
<Compile Include="ModalDialogs\IMessageShower.cs" />
<Compile Include="ModalDialogs\MessageShower.cs" />
<Compile Include="Models\Genres.cs" />
<Compile Include="Models\ModelBase.cs" />
<Compile Include="Models\Movie.cs" />
<Compile Include="Models\Ratings.cs" />
<Compile Include="Navigation\MoviesViewTargets.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\IMovieRepository.cs" />
<Compile Include="Repositories\MovieRepository.cs" />
<Compile Include="ViewModels\AdvancedSearchViewModel.cs" />
<Compile Include="ViewModels\DetailViewModel.cs" />
<Compile Include="ViewModels\ITitledViewModel.cs" />
<Compile Include="ViewModels\MasterViewModel.cs" />
<Compile Include="ViewModels\QuickSearchViewModel.cs" />
<Compile Include="ViewModels\CoreViewModelBase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BrentEdwards.MVVM\BrentEdwards.MVVM.csproj">
<Project>{C590ED20-159A-48DF-9D83-1E4E9153DDFE}</Project>
<Name>BrentEdwards.MVVM</Name>
</ProjectReference>
</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>
37 changes: 37 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/ComponentContainer.cs
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;
using System.Reflection;
using Castle.MicroKernel.ComponentActivator;

namespace BrentEdwards.MVVM.Movies.Core
{
public class ComponentContainer
{
public static IWindsorContainer Container { get; set; }

public static void BuildUp(object target)
{
var type = target.GetType();
foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
{
if (property.CanWrite && Container.Kernel.HasComponent(property.PropertyType))
{
var value = Container.Resolve(property.PropertyType);
try
{
property.SetValue(target, value, null);
}
catch (Exception ex)
{
var message = string.Format("Error setting property {0} on type {1}, See inner exception for more information.", property.Name, type.FullName);
throw new ComponentActivatorException(message, ex);
}
}
}

}
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace BrentEdwards.MVVM.Movies.Core.Conversion
{
public sealed class BoolToVisibilityConverter : IValueConverter
{
#region IValueConverter Members

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var visibility = Visibility.Visible;

if (value is Boolean)
{
visibility = (Boolean)value ? Visibility.Visible : Visibility.Collapsed;
}

return visibility;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}

#endregion
}
}
32 changes: 32 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/Conversion/RatingTemplateSelector.cs
@@ -0,0 +1,32 @@
using System.Windows;
using System.Windows.Controls;
using BrentEdwards.MVVM.Movies.Core.Models;

namespace BrentEdwards.MVVM.Movies.Core.Conversion
{
public sealed class RatingTemplateSelector : DataTemplateSelector
{
public DataTemplate GTemplate { get; set; }
public DataTemplate RTemplate { get; set; }

public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
DataTemplate template = null;
if (item is Ratings)
{
switch ((Ratings)item)
{
case Ratings.G:
template = GTemplate;
break;

case Ratings.R:
template = RTemplate;
break;
}
}

return template;
}
}
}
17 changes: 17 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/Messaging/CloseViewMessage.cs
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BrentEdwards.MVVM.Movies.Core.Messaging
{
public sealed class CloseViewMessage
{
public CloseViewMessage(String viewName)
{
ViewName = viewName;
}

public String ViewName { get; private set; }
}
}
24 changes: 24 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/Messaging/SearchMessage.cs
@@ -0,0 +1,24 @@
using System;
using BrentEdwards.MVVM.Movies.Core.Models;

namespace BrentEdwards.MVVM.Movies.Core.Messaging
{
public sealed class SearchMessage
{
public SearchMessage(String keywords)
{
Keywords = keywords;
}

public SearchMessage(String keywords, Genres? genre, Ratings? rating)
: this(keywords)
{
Genre = genre;
Rating = rating;
}

public String Keywords { get; private set; }
public Genres? Genre { get; private set; }
public Ratings? Rating { get; private set; }
}
}
14 changes: 14 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/ModalDialogs/Dialog.cs
@@ -0,0 +1,14 @@
using System;
using System.Windows;

namespace BrentEdwards.MVVM.Movies.Core.ModalDialogs
{
public sealed class Dialog
{
public static MessageBoxResult ShowMessage(String message, String caption, MessageBoxButton button)
{
var messageShower = ComponentContainer.Container.Resolve<IMessageShower>();
return messageShower.Show(message, caption, button);
}
}
}
13 changes: 13 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/ModalDialogs/IMessageShower.cs
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace BrentEdwards.MVVM.Movies.Core.ModalDialogs
{
public interface IMessageShower
{
MessageBoxResult Show(String message, String caption, MessageBoxButton button);
}
}
20 changes: 20 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/ModalDialogs/MessageShower.cs
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace BrentEdwards.MVVM.Movies.Core.ModalDialogs
{
public sealed class MessageShower : IMessageShower
{
#region IMessageShower Members

public MessageBoxResult Show(String message, String caption, MessageBoxButton button)
{
return MessageBox.Show(message, caption, button);
}

#endregion
}
}
17 changes: 17 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/Models/Genres.cs
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BrentEdwards.MVVM.Movies.Core.Models
{
public enum Genres
{
Action,
Comedy,
Drama,
Family,
Fantasy,
Horror
}
}
26 changes: 26 additions & 0 deletions BrentEdwards.MVVM.Movies.Core/Models/ModelBase.cs
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace BrentEdwards.MVVM.Movies.Core.Models
{
public abstract class ModelBase : INotifyPropertyChanged
{
#region INotifyPropertyChanged Members

public event PropertyChangedEventHandler PropertyChanged;

#endregion

protected void NotifyPropertyChanged(String propertyName)
{
if (PropertyChanged != null)
{
var args = new PropertyChangedEventArgs(propertyName);
PropertyChanged(this, args);
}
}
}
}

0 comments on commit 862b812

Please sign in to comment.