Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Siegel <djsiegel@gmail.com>2013-04-06 06:18:16 +0400
committerDavid Siegel <djsiegel@gmail.com>2013-04-06 06:18:16 +0400
commit55c248014a8dca0cc8011dd37c671bee6edb73ab (patch)
treea3f2247282fdcc0dc824af1117194c85899e7ca1
parent5b4fb2606b8449e730d51b993fa0d0d849aa4037 (diff)
Add rakefile for assembling component
-rw-r--r--.gitignore3
-rw-r--r--Rakefile40
-rwxr-xr-x[-rw-r--r--]component/Details.md (renamed from xpkg/Details.md)0
-rwxr-xr-xcomponent/GettingStarted.md108
-rwxr-xr-xcomponent/License.md15
-rw-r--r--component/README (renamed from xpkg/README)0
-rw-r--r--[-rwxr-xr-x]component/build-package.sh (renamed from xpkg/build-package.sh)0
-rw-r--r--component/rx_128x128.png (renamed from xpkg/logo_128x128.png)bin12929 -> 12929 bytes
-rw-r--r--xpkg/sample_desc.txt1
9 files changed, 166 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..907b260
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+xpkg
+*.xam
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..2cb7191
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,40 @@
+require "rake/clean"
+
+CLEAN.include "*.xam"
+CLEAN.include "xpkg"
+
+COMPONENT = "rx-1.0.xam"
+
+file "xpkg/xpkg.exe" do
+ puts "* Downloading xpkg..."
+ mkdir "xpkg"
+ sh "curl -L https://components.xamarin.com/submit/xpkg > xpkg.zip"
+ sh "unzip -o xpkg.zip -d xpkg"
+ sh "rm xpkg.zip"
+end
+
+task :default => "xpkg/xpkg.exe" do
+ line = <<-END
+ mono xpkg/xpkg.exe create #{COMPONENT} \
+ --name="Reactive Extensions (Rx)" \
+ --publisher="Xamarin, Inc." \
+ --website="http://www.xamarin.com" \
+ --summary="A library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators." \
+ --license="Rx/NET/Source/license.txt" \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.Interfaces.dll \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.Core.dll \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.Linq.dll \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.PlatformServices.dll \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.Experimental.dll \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.Debugger.dll \
+ --library=android:external/rx/Rx/NET/Source/Rx_Xamarin/android/libs/System.Reactive.Providers.dll \
+ --details=component/Details.md \
+ --getting-started=component/GettingStarted.md \
+ --icon=component/rx_128x128.png \
+ --sample="GitHub API Client. Demonstrates Rx with GitHub":"external/rx/Rx/NET/Source/Rx_Xamarin/android/samples/GithubApiClientSample/GithubApiClientSample.sln"
+ END
+ puts "* Creating #{COMPONENT}..."
+ puts line.strip.gsub "\t\t", "\\\n "
+ sh line, :verbose => false
+ puts "* Created #{COMPONENT}"
+end
diff --git a/xpkg/Details.md b/component/Details.md
index 4f34acd..4f34acd 100644..100755
--- a/xpkg/Details.md
+++ b/component/Details.md
diff --git a/component/GettingStarted.md b/component/GettingStarted.md
new file mode 100755
index 0000000..9cc1bee
--- /dev/null
+++ b/component/GettingStarted.md
@@ -0,0 +1,108 @@
+This Reactive Extensions (Rx) component is to package Reactive Extensions (version 2.x) from Microsoft.
+
+Rx is published as an open source project and you can pick up sources from CodePlex (http://rx.codeplex.com). There is a dedicated web page section for Rx on MSDN website too: http://msdn.microsoft.com/en-us/data/gg577609.aspx
+
+This component contains Rx libraries that are suited for Xamarin.Android and Xamarin.iOS.
+
+We are not going to explain what is Rx and how the library works. To begin with basics of Rx, their website has lots of introductory materials on those websites. On this document, we explain how to use Rx in Xamarin products.
+
+# Adjusting Library References
+
+After adding this component to your project, you would notice that there are several dlls in this package. You would however most likely need to use the following four assemblies:
+
+* System.Reactive.Interfaces.dll
+* System.Reactive.Core.dll
+* System.Reactive.Linq.dll
+* System.Reactive.PlatformServices.dll
+
+All other assemblies are optional and you would like to use them only in certain scenarios. On the other hand, those four assemblies are essential. So far let's remove other assemblies in this package.
+
+![typical Rx assembly references](https://raw.github.com/mono/rx/rx-oss-v2.1/xpkg/ProjectReferences.png)
+
+(Note that Rx version 2.x is very different from Rx v1.0 in terms of assemblies; Rx 1.0 consists only of System.Reactive.dll, which does not exist in Rx v2.x.)
+
+# Sample: Transforming touch events into another event
+
+Here I show an example use of Observable.FromEventPattern() and Observable.ToEventPattern() methods to turn View.Touch event into "notify only when three fingers are moving" event (here I named it as "TripleTouch").
+
+Let's begin with a simple application project. After you created one, you will need some using statements for Rx:
+
+ using System.Reactive;
+ using System.Reactive.Linq;
+
+The "TripleTouch" event is defined and implemented as follows:
+
+ IEventPatternSource<View.TouchEventArgs> triple_touch_source;
+
+ public event EventHandler<View.TouchEventArgs> TripleTouch {
+ add { triple_touch_source.OnNext += value; }
+ remove { triple_touch_source.OnNext -= value; }
+ }
+
+This event is populated when the View is set up. In the simple application sample, I wrote this in the Activity's OnCreate():
+
+ ...
+ // this "surface" is the target View here.
+ // It can be "this" when you implement a custom component.
+ var surface = FindViewById<View> (Resource.Id.theToucheable);
+
+ triple_touch_source = Observable.FromEventPattern<View.TouchEventArgs> (surface, "Touch")
+ .Where (ev => ev.EventArgs.Event.Action == MotionEventActions.Move)
+ .Where (ev => ev.EventArgs.Event.PointerCount == 3)
+ .ToEventPattern ();
+ ...
+
+Then it could be consumed by the View users (in the sample, the first line of code is in OnCreate() method):
+
+ ...
+ TripleTouch += (sender, ev) => this.RunOnUiThread (() => text.Text = GetEventDescription (ev.Event));
+ ...
+
+ static string GetEventDescription (MotionEvent e)
+ {
+ return string.Format ("({0}, {1})", e.RawX, e.RawY);
+ }
+
+In the sample app project, we defined very simple UI in Main.axml:
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <View
+ android:id="@+id/theToucheable"
+ android:layout_width="fill_parent"
+ android:layout_height="440.7dp"
+ android:layout_marginBottom="0.0dp" />
+ <TextView
+ android:id="@+id/theText"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="(touch corrdinates shown here)" />
+ </LinearLayout>
+
+The sample is all done. Build and run the app on device. Then touch one finger. Nothing happens. Touch with one more finger. Still nothing happens. Add another finger. Then it starts showing the coordinate (of the first finger; this is just a sample so it doesn't give complicated action).
+
+What implements such behavior? Let's see the Observable part:
+
+ triple_touch_source = Observable.FromEventPattern<View.TouchEventArgs> (surface, "Touch")
+
+This converts View.Touch event into an IObservable.
+
+ .Where (ev => ev.EventArgs.Event.Action == MotionEventActions.Move)
+
+This filters out events that are not move events.
+
+ .Where (ev => ev.EventArgs.Event.PointerCount == 3)
+
+This filters out events that don't detect three fingers. Now that we have only three-fingered events, we want to convert this observables into another event source:
+
+ .ToEventPattern ();
+
+Once it's done, we use it to process the actual event. Note that since we are going to control UI, we need to invoke RunOnUiThread():
+
+ TripleTouch += (sender, ev) => this.RunOnUiThread (() => text.Text = GetEventDescription (ev.Event));
+
+Actually, if you don't convert the filtered observables into another event, you might want to use SynchronizationContext instead (we didn't do that in this example because having event processing all within the UI thread is not good):
+
+ (...) .SubscribeOn (Android.App.Application.SynchronizationContext) (...)
diff --git a/component/License.md b/component/License.md
new file mode 100755
index 0000000..5b47fbd
--- /dev/null
+++ b/component/License.md
@@ -0,0 +1,15 @@
+Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
+Microsoft Open Technologies would like to thank its contributors, a list
+of whom are at http://rx.codeplex.com/wikipage?title=Contributors.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you
+may not use this file except in compliance with the License. You may
+obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied. See the License for the specific language governing permissions
+and limitations under the License. \ No newline at end of file
diff --git a/xpkg/README b/component/README
index 229e3ab..229e3ab 100644
--- a/xpkg/README
+++ b/component/README
diff --git a/xpkg/build-package.sh b/component/build-package.sh
index 6d6c389..6d6c389 100755..100644
--- a/xpkg/build-package.sh
+++ b/component/build-package.sh
diff --git a/xpkg/logo_128x128.png b/component/rx_128x128.png
index 9da8fee..9da8fee 100644
--- a/xpkg/logo_128x128.png
+++ b/component/rx_128x128.png
Binary files differ
diff --git a/xpkg/sample_desc.txt b/xpkg/sample_desc.txt
deleted file mode 100644
index 045d291..0000000
--- a/xpkg/sample_desc.txt
+++ /dev/null
@@ -1 +0,0 @@
-GithubApiClientSample demonstrates use of Rx API