Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #771

Closed
wants to merge 180 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
ab643d8
initial documentation structure using mkdocs + rtd
ghuntley Dec 7, 2014
1a9124a
what is this doing here?
shiftkey Dec 22, 2014
d874f5e
linkify this
shiftkey Dec 22, 2014
b0d132f
stub a section for ReactiveObject
shiftkey Dec 22, 2014
6b47e3d
port over the old doc for ReactiveObject
shiftkey Dec 22, 2014
d302cb7
updated README to be more developer-focused
shiftkey Dec 22, 2014
ddfbe44
removed dropbox merge conflict
ghuntley Dec 22, 2014
5348fab
migrated release notes for rx6 and rx5
ghuntley Dec 22, 2014
086e21f
added out of the tarpit
ghuntley Dec 29, 2014
fff0f0e
added frp presentation by @shiftkey
ghuntley Jan 11, 2015
5d593f5
branch, pull and release based development workflow
ghuntley Jan 13, 2015
1c8877a
fleshed out error handling
ghuntley Feb 9, 2015
ab4ed0a
Create recovery-options.md
ghuntley Feb 9, 2015
4f73768
Create user-errors.md
ghuntley Feb 9, 2015
2276bff
start migrating legacy docs to new structure
rdavisau Feb 9, 2015
b495817
added versioning info
ghuntley Feb 10, 2015
b352b48
Update README.md
ghuntley Feb 10, 2015
e7d012a
Update README.md
ghuntley Feb 10, 2015
00797d3
added link to historical pdf
ghuntley Feb 10, 2015
c8ceebf
Short description with learning resources for Rx
DarekDan Feb 10, 2015
089f04a
Missed a hyphen
DarekDan Feb 10, 2015
e8357f3
Merge branch 'readthedocs' of https://github.com/ghuntley/ReactiveUI …
DarekDan Feb 10, 2015
978f6ec
A section on MVVM
DarekDan Feb 10, 2015
1ae6396
Missed a bracket
DarekDan Feb 10, 2015
5856d05
Typos
DarekDan Feb 10, 2015
12cd7af
Typos
DarekDan Feb 10, 2015
59dadb5
Typos
DarekDan Feb 10, 2015
257f36b
Updated Rx sample
DarekDan Feb 10, 2015
f2b6a2c
Added one more link to samples
DarekDan Feb 10, 2015
302fdef
Additional git ignores
DarekDan Feb 10, 2015
cfd2fa9
Added ReactiveUI 101. Need help with code formatting.
DarekDan Feb 11, 2015
fa6aebb
Missed a ref
DarekDan Feb 11, 2015
68898f5
Typos and formatting
DarekDan Feb 11, 2015
6d8c825
Attempt to reduce "bold code"
DarekDan Feb 11, 2015
920c644
Modified example for Flickr
DarekDan Mar 7, 2015
1582dc8
Create handling-exceptions-from-long-running-tasks.md
ghuntley Mar 12, 2015
8caf785
Update handling-exceptions-from-long-running-tasks.md
ghuntley Mar 12, 2015
63edb02
Update xamarin-forms.md
ghuntley Mar 17, 2015
9dbdbd3
Update index.md
ghuntley Mar 18, 2015
f89ef5f
Update index.md
ghuntley Mar 18, 2015
338e4a6
Update index.md
ghuntley Mar 18, 2015
c6c9d16
Update index.md
ghuntley Mar 18, 2015
1000a41
Update index.md
ghuntley Mar 18, 2015
5c2866b
Update index.md
ghuntley Mar 18, 2015
b75fa05
Update index.md
ghuntley Mar 18, 2015
1d0a985
Create misc.md
ghuntley Mar 27, 2015
79dacfd
Update reactiveui.md
ghuntley Mar 27, 2015
f5b671c
few small typos
rdavisau Apr 17, 2015
b252b3a
service location examples now use splat
rdavisau Apr 17, 2015
343bf70
Create apple-ios.md
ghuntley Apr 27, 2015
2fb71bd
Create ireactivecommand.md
ghuntley Apr 27, 2015
ef91c7c
Update mkdocs.yml
ghuntley Apr 27, 2015
2ee9449
Update reactive-command-async.md
ghuntley Apr 28, 2015
5851cc8
Update reactive-command-async.md
ghuntley Apr 28, 2015
0a61831
Create type-converters.md
ghuntley Apr 30, 2015
4fef148
Update mkdocs.yml
ghuntley Apr 30, 2015
7f4d506
Update mkdocs.yml
ghuntley Apr 30, 2015
9c4dd07
Update type-converters.md
ghuntley Apr 30, 2015
68fc540
Update type-converters.md
ghuntley Apr 30, 2015
8e33728
Update type-converters.md
ghuntley Apr 30, 2015
00698cd
Update type-converters.md
ghuntley Apr 30, 2015
9ef40ea
Update type-converters.md
ghuntley Apr 30, 2015
80595b8
Update type-converters.md
ghuntley Apr 30, 2015
2c2e539
Update type-converters.md
ghuntley Apr 30, 2015
15fff07
Update type-converters.md
ghuntley Apr 30, 2015
58ad16b
Update type-converters.md
ghuntley May 1, 2015
f57cc46
Update type-converters.md
ghuntley May 1, 2015
3f3dcfc
Update type-converters.md
ghuntley May 1, 2015
5be67b3
Update type-converters.md
ghuntley May 1, 2015
707d59f
removed duplicate.
ghuntley May 1, 2015
2dc516a
removed
ghuntley May 1, 2015
d054aa2
Update mkdocs.yml
ghuntley May 1, 2015
03fcc9c
Update .gitignore
ghuntley May 1, 2015
6e27c57
Fixes https://github.com/reactiveui/ReactiveUI/pull/833
ghuntley May 1, 2015
96de47a
Update ios.md
ghuntley May 2, 2015
2cd58cd
Create xaml.md
ghuntley May 2, 2015
2abcd15
Create android.md
ghuntley May 2, 2015
1aa40c3
added more info about conversionHints and how they work
ghuntley May 4, 2015
355d2d5
Create exception-handling.md
ghuntley May 7, 2015
5d304c3
Update index.md
ghuntley May 11, 2015
5214b52
added elm talk
ghuntley May 12, 2015
778fa9f
Create activation.md
ghuntley May 25, 2015
b9f5277
added shiftkeys presentation, restructured video section
ghuntley May 26, 2015
893a1f7
Fix typo in ReactiveUI.
andrewtobin Oct 22, 2015
f5765e1
Merge pull request #2 from andrewtobin/readthedocs
ghuntley Oct 22, 2015
f90a9c3
Create thread-troubleshooting.md
ghuntley Nov 28, 2015
8603d57
Update thread-troubleshooting.md
ghuntley Nov 29, 2015
eb1efbc
Rename thread-troubleshooting.md to threading.md
ghuntley Nov 29, 2015
b989d7c
added troubleshooting section.
ghuntley Nov 29, 2015
3e2f2ea
Update mkdocs.yml
ghuntley Nov 29, 2015
9868288
Flesh out the bindings documentation
flagbug Nov 30, 2015
baab104
The view should implement IViewFor
flagbug Nov 30, 2015
d2a1f7e
Explain the WireUpControls method
flagbug Nov 30, 2015
0611f52
Flesh out some explanations and move the ViewModel code to the front
flagbug Nov 30, 2015
fbf692d
Explain the return value of OneWayBind and friends and explain where …
flagbug Nov 30, 2015
6274ec8
ReactiveAsyncCommand -> ReactiveCommand
flagbug Nov 30, 2015
f652860
Write some words about the solution layout
flagbug Nov 30, 2015
9ba47c2
Shorten the code with C# 6
flagbug Nov 30, 2015
7ef8ccc
inlined link
shiftkey Nov 30, 2015
c77ffb1
Replace ObservableForProperty with WhenAnyValue
flagbug Dec 1, 2015
c1d6910
Pull the Select call down, for better readability
flagbug Dec 1, 2015
3c50252
Add a subscription to the "ThrownExceptions" of the ReactiveCommand
flagbug Dec 1, 2015
d48e8b8
Write some more details about the one-way bind conversion parameter
flagbug Dec 1, 2015
faa7926
Move the comment up
flagbug Dec 1, 2015
6b9da69
Fix some documentation around ReactiveCommand
flagbug Dec 1, 2015
47898dc
Merge pull request #6 from flagbug/fix-command-docs
flagbug Dec 2, 2015
65b9e32
Merge pull request #5 from flagbug/improve-documentation-2
flagbug Dec 2, 2015
35c7135
Merge pull request #3 from flagbug/improve-documentation-1
flagbug Dec 2, 2015
e57ca3a
added UWP support statement.
ghuntley Dec 17, 2015
26a5598
Create autoexec-commands.md
ghuntley Dec 21, 2015
8932d10
Update wpf.md
ghuntley Dec 21, 2015
75074b6
Update index.md
ghuntley Dec 21, 2015
2acd907
added caching section
ghuntley Dec 21, 2015
7a1c36f
Update mkdocs.yml
ghuntley Dec 21, 2015
fe1ff4c
added reminder that autoexecution should be done via view
ghuntley Dec 21, 2015
bda83ce
added exception handling section
ghuntley Dec 21, 2015
41ae5d0
added designtime section
ghuntley Dec 21, 2015
de37048
added design time example
ghuntley Dec 21, 2015
acb32f3
Update mkdocs.yml
ghuntley Dec 21, 2015
2ea9e05
added events/windows-forms.md
ghuntley Dec 21, 2015
ae915a9
created explanation of events packages.
ghuntley Dec 21, 2015
6c8db73
added link to espera.
ghuntley Dec 21, 2015
8c8559a
added more info about when to use WhenActivated
ghuntley Dec 21, 2015
57d8978
added when-activated
ghuntley Dec 21, 2015
fbe2611
added when activated
ghuntley Dec 21, 2015
dfa015d
added more detail.
ghuntley Dec 22, 2015
7c31169
added more info about dp leaks
ghuntley Dec 22, 2015
e0a6cd2
added rebracer information
ghuntley Dec 23, 2015
ad822c6
Mr Hyde was here …
ghuntley Dec 25, 2015
9970623
migrated to gitbooks
ghuntley Jan 1, 2016
861a695
moved to gitbooks
ghuntley Jan 1, 2016
eb9487e
migrated to gitbooks
ghuntley Jan 1, 2016
5beb760
moved to gitbooks
ghuntley Jan 1, 2016
a5c2aac
moved to gitbooks
ghuntley Jan 1, 2016
0e809fa
moved to gitbooks
ghuntley Jan 1, 2016
2435458
moved to gitbooks
ghuntley Jan 1, 2016
53bc6e1
moved to gitbooks
ghuntley Jan 1, 2016
825acb9
migrated to gitbooks
ghuntley Jan 1, 2016
f495c3d
Delete index.md
ghuntley Jan 1, 2016
424efdf
Delete autofac.md
ghuntley Jan 1, 2016
c099ebc
Delete type-converters.md
ghuntley Jan 1, 2016
a1b51ee
migrated to gitbooks
ghuntley Jan 1, 2016
3c20e50
migrated to gitbooks
ghuntley Jan 1, 2016
c21c145
migrated to github
ghuntley Jan 1, 2016
bd676ce
migrated to gitbooks
ghuntley Jan 1, 2016
78675d1
migrated to gitbooks
ghuntley Jan 1, 2016
6e7e95d
moved to gitbooks
ghuntley Jan 1, 2016
0bf154a
Delete index.md
ghuntley Jan 1, 2016
637c8f4
Delete branch-and-pull-based-workflow.png
ghuntley Jan 1, 2016
b5eba87
Delete automatic-execution.md
ghuntley Jan 1, 2016
e95c391
Delete exception-handling.md
ghuntley Jan 1, 2016
f210220
moved to gitbooks
ghuntley Jan 1, 2016
c931e2c
Delete ireactivecommand.md
ghuntley Jan 1, 2016
3f54ba6
Delete index.md
ghuntley Jan 1, 2016
c83e5dc
Delete misc.md
ghuntley Jan 2, 2016
4df1d11
Delete index.md
ghuntley Jan 2, 2016
e649b47
Delete recovery-options.md
ghuntley Jan 2, 2016
fa6f183
Delete user-errors.md
ghuntley Jan 2, 2016
283c35c
Delete index.md
ghuntley Jan 2, 2016
ae71ae5
Delete windows-forms.md
ghuntley Jan 2, 2016
fad74fa
Delete reactive-list-create-derived-collection.md
ghuntley Jan 2, 2016
a96f621
Delete when-activated.md
ghuntley Jan 2, 2016
40cd63f
Delete reactive-object.md
ghuntley Jan 2, 2016
b658e77
Delete reactive-list.md
ghuntley Jan 2, 2016
c9e1ebc
Delete solution-layout.md
ghuntley Jan 2, 2016
197013c
Delete index.md
ghuntley Jan 2, 2016
b5766dc
Delete ReactiveUI-101.md
ghuntley Jan 2, 2016
cd9406b
Delete index.md
ghuntley Jan 2, 2016
50cb0fc
Delete nlog.md
ghuntley Jan 2, 2016
bdf5912
Delete splat.md
ghuntley Jan 2, 2016
84e3952
Delete index.md
ghuntley Jan 2, 2016
5f06906
Delete xamarin-forms.md
ghuntley Jan 2, 2016
42b91c7
Delete reactiveui.md
ghuntley Jan 2, 2016
2b58336
Delete index.md
ghuntley Jan 2, 2016
25f3a45
Delete index.md
ghuntley Jan 2, 2016
f86cfd3
Delete index.md
ghuntley Jan 2, 2016
e54d6e8
Delete apple-ios.md
ghuntley Jan 2, 2016
d577292
Delete threading.md
ghuntley Jan 2, 2016
ff6d73d
Delete search.md
ghuntley Jan 2, 2016
24e0872
Delete release-notes.md
ghuntley Jan 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# User-specific files
*.suo
*.user
*.bak
*.sln.docstates

# Build results
Expand Down Expand Up @@ -206,5 +207,6 @@ ReactiveUI.Events/Nustache.*

ext/monodroid/18


# Exlcude compiled versions of the documentation
docs/_build/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to set this in your mkdocs.yml

site_dir: docs/_build/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build
35 changes: 35 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ReactiveUI Documentation

The source for ReactiveUI documentation is here under `sources/` and uses extended
Markdown, as implemented by [MkDocs](http://mkdocs.org).

These files are built and deployed to [docs.reactiveui.net](http://docs.reactiveui.net)
whenever `master` is updated.

## Contributing

### Pre-requisites

On Windows, you should use
[Chocolatey](http://chocolatey.org/) to setup your local environment:

# cinst python2
# cinst pip

On OS X, you should use [Homebrew](http://brew.sh/):

# brew install python

Once you've done that, install [MkDocs](http://mkdocs.org) from the command line:

# pip install mkdocs

### Build and Test

Run this command from the root of the ReactiveUI repository:

# mkdocs serve

And point your browser to `http://localhost:8000` to view the documentation running
locally. As files are changed, MkDocs will rebuild the documentation in the
background.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions docs/legacy/basics/application-boostraper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```cs
/* COOLSTUFF: What is the AppBootstrapper?
*
* The AppBootstrapper is like a ViewModel for the WPF Application class.
* Since Application isn't very testable (just like Window / UserControl),
* we want to create a class we can test. Since our application only has
* one "screen" (i.e. a place we present Routed Views), we can also use
* this as our IScreen.
*
* An IScreen is a ViewModel that contains a Router - practically speaking,
* it usually represents a Window (or the RootFrame of a WinRT app). We
* should technically create a MainWindowViewModel to represent the IScreen,
* but there isn't much benefit to split those up unless you've got multiple
* windows.
*
* AppBootstrapper is a good place to implement a lot of the "global
* variable" type things in your application. It's also the place where
* you should configure your IoC container. And finally, it's the place
* which decides which View to Navigate to when the application starts.
*/
```
File renamed without changes.
73 changes: 73 additions & 0 deletions docs/legacy/basics/data-binding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
is it still impossible to use RXUI binding inside ItemTemplate?

paulcbetts [5:35 AM]
Yes

ionoy [5:35 AM]
damn

paulcbetts [5:35 AM]
Well, inside an implicit DataTemplate

paulcbetts [5:36 AM]
You have to create a UserControl

paulcbetts [5:36 AM]
The good news is, if you use `OneWayBind` to set the ItemsSource, we'll set up a DataTemplate for you

ionoy [5:37 AM]
can you elaborate? if I have an Items collection and one way bind it to my list, how should I name this UserControl then? (for you to automatically set it as DataTemplate) (edited)

paulcbetts [5:38 AM]
You can name it whatever you want, as long as:
1. The UserControl implements `IViewFor<TheViewModelYourePuttingIntoThatList>`
2. You register the View: `Locator.CurrentMutable.Register(() => new MyUserControl, typeof(IViewFor< TheViewModelYourePuttingIntoThatList>));`

ionoy [5:38 AM]
oh, awesome

paulcbetts [5:39 AM]
The end result is, in ReactiveUI you end up writing a bit more UserControls, but your XAML is cleaner

ionoy [5:39 AM]
this is actually a very good solution

paulcbetts [5:39 AM]
Because your ListBox can now be as simple as `<ListBox x:Name="MyList" />`

ionoy [5:39 AM]
yep

ionoy [5:49 AM]
hm, one downside is that my design time data isn't displayed nicely anymore...

paulcbetts [5:59 AM]
Design time data is the best part of ReactiveUI

paulcbetts [5:59 AM]
So, the way you do design time data, is that you just *set the property* to whatever you want

paulcbetts [5:59 AM]
And at runtime, the RxUI binding will override it

paulcbetts [6:00 AM]
It works with ItemsControls too

paulcbetts [6:01 AM]
```<ListBox x:Name="Foo">
<ListBox.Items> <!-- At runtime, ItemsSource trumps Items -->
<MyControl />
<MyControl />
<MyControl />
</ListBox.Items>
</ListBox>


moswald [6:14 AM]
the only downside is that if you are setting your `ItemsSource` from within a call to `WhenActivated` , your design-time data ends up showing up for a frame or two

moswald [6:14 AM]
the solution is to manually clear your design-time data at the bottom of your constructor in those cases

ionoy [6:56 AM]
@moswald: I set design time data via '{Binding Source={d:DesignInstance Type=models:DesignTimeData, IsDesignTimeCreatable=True}}', so it doesn't show when app is started
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions docs/legacy/basics/presenters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
paulcbetts [8:59 AM]
@ghuntley: At a high level, the single View is being pushed on and off the IScreen, yeah

paulcbetts [9:00 AM]
Not familiar with the concept of Presenters

ghuntley [9:11 AM]
Customization of the behavior of views when navigating between ViewModels. For example pushing on and off UINavigationViewController, switching between uitabbarcontroller options, displaying as splitviewcontroller on iPad but hamburger on iPhone.

ghuntley [9:11 AM]
http://4.bp.blogspot.com/-Vg7F4u_Unew/UaXgifRFsfI/AAAAAAAAA2o/GIVg5-VM6tM/s1600/redblue1.png (27KB)


ghuntley [9:11 AM]
http://4.bp.blogspot.com/-6UzllelBSj4/UaXgjuLbkcI/AAAAAAAAA2w/Cs23N8j8sIM/s1600/redblue2.png (7KB)


paulcbetts [9:12 AM]
Ah, in that case you'd have to create your own `RoutedViewHost` which isn't too hard

ghuntley [9:13 AM]
:heart:

https://github.com/reactiveui/ReactiveUI/blob/master/ReactiveUI/Xaml/RoutedViewHost.cs
46 changes: 46 additions & 0 deletions docs/legacy/basics/project-layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
We suggest the following logical naming pattern when laying out your solution:

<img>


All application logic is stored within a core portable class library which is shared between and referenced in each specific platform application:

.Core
-----

A portable class library that will be the heart of the application and where you will spend most of your time. Profile259 is the recommended profile which should be used, you will need to select it when you create the project.

.Core.Tests
-----------

A standard class library that contains unit tests that confirm functionality of .Core.

.Droid
-------

A monodroid (Xamarin.Android) application which contains Android user interface code for both phone and tablet. Please note .Android namespace prefix is reserved by Google for Android internals and must not be used.

.iOS
-----

A monotouch (Xamarin.iOS) application which contains iOS user interface code for both iPhone and iPad.

.Mac
----

A monomac (Xamarin.Mac) application which contains OSX user interface code.

.WindowsPhone
-------------

A Windows Phone application which contains the user interface code.

.WindowsStore
-------------

Windows 8 Store application with contains the user interface code.

.Wpf
----

Windows Presentation Foundation applications with contains the user interface code.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
69 changes: 69 additions & 0 deletions docs/legacy/basics/view-location.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# View Location + IViewFor

View Location is a feature of ReactiveUI that allows you to associate Views with
ViewModels and set them up Automagically.

### ViewModelViewHost

The easiest way to use View Location is via the `ViewModelViewHost` control,
which is a View (on Cocoa, a UIView/NSView, and on XAML-based platforms a
Control) which has a single `ViewModel` property. When the ViewModel property is
set, View Location looks up the associated View and loads it into the container.
`ViewModelViewHost` is great for lists - so much so, that if you Bind to
`ItemsSource` on XAML-based platforms and don't set a DataTemplate, one gets
configured that just uses `ViewModelViewHost`.

```xml
<ListBox x:Name="ToasterList" />
```

```cs
// Now ListBox automatically gets a DataTemplate
this.OneWayBind(ViewModel, vm => vm.ToasterList, v => v.ToasterList.ItemsSource);
```

### Registering new Views

To use View Location, you must first register types, via Splat's Service Location feature.

```cs
Locator.CurrentMutable.Register(() => new ToasterView(), typeof(IViewFor<ToasterViewModel>));
```

View Location internally uses a class called `ViewLocator` which can either be
replaced, or the default one used. The `ResolveView` method will return the View
associated with a given ViewModel object.


### Registering multiple views for a single ViewModel
In order to register multiple views for the same ViewModel the contract parameter must be used on registration. Here I register 2 views with 2 contracts. Landscape and Portrait. There is no significance to the contract name. I just used these to be descriptive.

```cs
Locator.CurrentMutable.Register(() => new LandscapeLayoutView(), typeof(IViewFor<MainLayoutViewModel>), "Landscape");
Locator.CurrentMutable.Register(() => new PortraitLayoutView(), typeof(IViewFor<MainLayoutViewModel>), "Portrait");

```

To change your view (note that the view must be displayed in a `ViewModelViewHost`),create a new `ViewContractObservable` for the `ViewModelViewHost`.

For example, if I have a `ViewModelViewHost` named mainPanel declared in XAML, then I could setup changing its displayed view like this:

```cs
public partial class ShellView : Window, IViewFor<ShellViewModel>
{
var mainLayoutChange = new BehaviorSubject<string>("Landscape"); //start with landscape

//ViewContractObservable takes an IObservable<string>
this.mainPanel.ViewContractObservable = mainLayoutChange;
...
//to change between the views, fire the IObservable<string>
//OnNext with a valid contract identifier.
someSubsciption
.Where(_=> someCondition)
.Subscibe(_=> mainLayoutChange.OnNext("Portrait"));

someSubsciption
.Where(_=> someOtherCondition)
.Subscibe(_=> mainLayoutChange.OnNext("Landscape"));
}
```
21 changes: 21 additions & 0 deletions docs/legacy/basics/view-model-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```cs
/// <summary>
/// It's usually a good idea to create an interface for every ViewModel and
/// reference that instead of the implementation. This makes creating fake
/// versions or design-time versions of ViewModels much easier.
/// </summary>
public interface ITeamLoginTitleViewModel
{
[IgnoreDataMember]
ReactiveCommand<Object> LoginToThisTeam { get; }

[DataMember]
TeamWithUser Model { get; }
}


public class TeamLoginTitleViewModel : ReactiveObject, ITeamLoginTitleViewModel
{

}
```
File renamed without changes.
14 changes: 14 additions & 0 deletions docs/legacy/best-practices/command-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Don't
Don't suffix `ReactiveCommand` properties' names with `Command`; instead, name the property using a verb that describes the command's action. For example:

```cs

public ReactiveCommand Synchronize { get; private set; }

// and then in the ctor:

Synchronize = ReactiveCommand.CreateAsyncObservable(
_ => SynchronizeImpl(mergeInsteadOfRebase: !IsAhead));
```

When a `ReactiveCommand`'s implementation is too large or too complex for an anonymous delegate, name the implementation's method the same name as the command, but with `Impl` suffixed (for example, `SychronizeImpl` above).
39 changes: 39 additions & 0 deletions docs/legacy/best-practices/commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Prefer binding user interactions to commands rather than methods.

# Do

```cs
// In XAML
<Button Command="{Binding Delete}" .../>

public class RepositoryViewModel : ReactiveObject
{
public RepositoryViewModel()
{
Delete = ReactiveCommand.CreateAsyncObservable(x => DeleteImpl());
Delete.ThrownExceptions.Subscribe(ex => /*...*/);
}

public ReactiveAsyncCommand Delete { get; private set; }

public IObservable<Unit> DeleteImpl() {...}
}
```
# Don't

Use the Caliburn.Micro conventions for associating buttons and commands:

```
// In XAML
<Button x:Name="Delete" .../>

public class RepositoryViewModel : PropertyChangedBase
{
public void Delete() {...}
}
```

# Why?
- ReactiveCommand exposes the `CanExecute` property of the command to enable applications to introduce additional behaviour.
- It handles marshaling the result back to the UI thread.
- It tracks in-flight items.
3 changes: 3 additions & 0 deletions docs/legacy/best-practices/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The following recommendations are intended to help keep ReactiveUI code predictable, understandable, and fast.

They are, however, only a set of practices to help maintain sanity when building RxUI client applications distilled from hard lessons learned. Use best judgment when determining whether to apply the recommendations here to a given piece of code.
Loading