changeset 3:1e9583086e99

Added Impl.Fx
author cin
date Fri, 13 Sep 2013 12:54:28 +0400
parents aa367305156b
children 381095ad0a69
files .hgignore Implab.Fx/Animation.cs Implab.Fx/ControlHelpers.cs Implab.Fx/Implab.Fx.csproj Implab.Fx/Properties/AssemblyInfo.cs Implab.sln Implab.suo
diffstat 7 files changed, 175 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Aug 29 17:03:44 2013 +0400
+++ b/.hgignore	Fri Sep 13 12:54:28 2013 +0400
@@ -6,3 +6,4 @@
 Implab/bin/
 Implab/obj/
 TestResults/
+Implab.Fx/obj/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab.Fx/Animation.cs	Fri Sep 13 12:54:28 2013 +0400
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Implab.Fx
+{
+    public class Animation
+    {
+        int m_duration;
+        int m_fps;
+
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab.Fx/ControlHelpers.cs	Fri Sep 13 12:54:28 2013 +0400
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Implab.Fx
+{
+    public static class ControlHelpers
+    {
+        /// <summary>
+        /// Переключает обработку обещания в поток указанного элемента управления.
+        /// </summary>
+        /// <typeparam name="T">Тип результата обещания</typeparam>
+        /// <param name="that">Исходное обещание</param>
+        /// <param name="ctl">Элемент управления</param>
+        /// <returns>Новое обещание, обработчики которого будут выполнены в потоке элемента управления.</returns>
+        /// <exception cref="ArgumentNullException">Параметр не может быть <c>null</c>.</exception>
+        /// <example>
+        /// client
+        ///     .Get("description.txt") // returns a promise
+        ///     .DirectToControl(m_ctl) // handle the promise in the thread of the control
+        ///     .Then(
+        ///         description => m_ctl.Text = description // now it's safe
+        ///     )
+        /// </example>
+        public static Promise<T> DirectToControl<T>(this Promise<T> that, Control ctl)
+        {
+            if (that == null)
+                throw new ArgumentNullException("that");
+            if (ctl == null)
+                throw new ArgumentNullException("ctl");
+
+            var directed = new Promise<T>();
+
+            that.Then(
+                res =>
+                {
+                    if (ctl.InvokeRequired)
+                        ctl.Invoke(new Action<T>(directed.Resolve),res);
+                    else
+                        directed.Resolve(res);
+                },
+                err =>
+                {
+                    if (ctl.InvokeRequired)
+                        ctl.Invoke(new Action<Exception>(directed.Reject), err);
+                    else
+                        directed.Reject(err);
+                }
+            );
+
+            return directed;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab.Fx/Implab.Fx.csproj	Fri Sep 13 12:54:28 2013 +0400
@@ -0,0 +1,61 @@
+<?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>{06E706F8-6881-43EB-927E-FFC503AF6ABC}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Implab.Fx</RootNamespace>
+    <AssemblyName>Implab.Fx</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="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ControlHelpers.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Implab\Implab.csproj">
+      <Project>{99B95D0D-9CF9-4F70-8ADF-F4D0AA5CB0D9}</Project>
+      <Name>Implab</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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab.Fx/Properties/AssemblyInfo.cs	Fri Sep 13 12:54:28 2013 +0400
@@ -0,0 +1,36 @@
+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("Implab.Fx")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Implab.Fx")]
+[assembly: AssemblyCopyright("Copyright ©  2013")]
+[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("d239c29f-98e2-4942-9569-554a8511d07b")]
+
+// 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 Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
--- a/Implab.sln	Thu Aug 29 17:03:44 2013 +0400
+++ b/Implab.sln	Fri Sep 13 12:54:28 2013 +0400
@@ -12,6 +12,8 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Test", "Implab.Test\Implab.Test.csproj", "{63F92C0C-61BF-48C0-A377-8D67C3C661D0}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx", "Implab.Fx\Implab.Fx.csproj", "{06E706F8-6881-43EB-927E-FFC503AF6ABC}"
+EndProject
 Global
 	GlobalSection(TestCaseManagementSettings) = postSolution
 		CategoryFile = Implab.vsmdi
@@ -29,6 +31,10 @@
 		{63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.Build.0 = Release|Any CPU
+		{06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
Binary file Implab.suo has changed