summaryrefslogtreecommitdiff
path: root/src/app/Cmpp298.Assignment3.Desktop.Adapters
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/Cmpp298.Assignment3.Desktop.Adapters')
-rw-r--r--src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj54
-rw-r--r--src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs40
-rw-r--r--src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs35
3 files changed, 129 insertions, 0 deletions
diff --git a/src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj
new file mode 100644
index 0000000..f305b26
--- /dev/null
+++ b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Cmpp298.Assignment3.Desktop.Adapters.csproj
@@ -0,0 +1,54 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{097FDBD3-0339-4D79-AE80-1AD1407B15F0}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Cmpp298.Assignment3.Desktop.Adapters</RootNamespace>
+ <AssemblyName>Cmpp298.Assignment3.Desktop.Adapters</AssemblyName>
+ </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="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DesktopDropDownList.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Cmpp298.Assignment3.Dto\Cmpp298.Assignment3.Dto.csproj">
+ <Project>{29260A8E-3F7B-4D9B-BBE3-81210F4B9E5B}</Project>
+ <Name>Cmpp298.Assignment3.Dto</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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> \ No newline at end of file
diff --git a/src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs b/src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs
new file mode 100644
index 0000000..1f3a2ee
--- /dev/null
+++ b/src/app/Cmpp298.Assignment3.Desktop.Adapters/DesktopDropDownList.cs
@@ -0,0 +1,40 @@
+/*
+ * Created by: Mo
+ * Created: Sunday, August 12, 2007
+ */
+
+using System.Collections.Generic;
+using System.Windows.Forms;
+using Cmpp298.Assignment3.Dto;
+
+namespace Cmpp298.Assignment3.Desktop.Adapters {
+ public class DesktopDropDownList : IDropDownListAdapter {
+ public DesktopDropDownList( ComboBox dropDown ) {
+ _dropDown = dropDown;
+ _pairs = new Dictionary< string, IDropDownListItem >( );
+ }
+
+ public void BindTo( IEnumerable< IDropDownListItem > pairs ) {
+ if ( pairs != null ) {
+ _pairs = new Dictionary< string, IDropDownListItem >( );
+
+ foreach ( IDropDownListItem pair in pairs ) {
+ _dropDown.Items.Add( pair.Text );
+ _pairs.Add( pair.Text, pair );
+ }
+ _dropDown.SelectedIndex = 0;
+ }
+ }
+
+ public IDropDownListItem SelectedItem {
+ get { return !string.IsNullOrEmpty( _dropDown.Text ) ? _pairs[ _dropDown.Text ] : null; }
+ }
+
+ public void SetSelectedItemTo( string text ) {
+ _dropDown.SelectedIndex = _dropDown.Items.IndexOf( text );
+ }
+
+ private ComboBox _dropDown;
+ private IDictionary< string, IDropDownListItem > _pairs;
+ }
+} \ No newline at end of file
diff --git a/src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..eede991
--- /dev/null
+++ b/src/app/Cmpp298.Assignment3.Desktop.Adapters/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Cmpp298.Assignment3.Desktop.Adapters")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Cmpp298.Assignment3.Desktop.Adapters")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7ae97ab9-7f1b-4f1c-bf02-39a0f7c2fee1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]