├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── ReactiveUI.Winforms.Samples.Bindings
├── App.config
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ReactiveUI.Winforms.Samples.Bindings.csproj
├── ViewModels
│ └── MainViewModel.cs
├── Views
│ ├── MainView.Designer.cs
│ ├── MainView.cs
│ └── MainView.resx
└── packages.config
├── ReactiveUI.Winforms.Samples.Commands
├── App.config
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ReactiveUI.Winforms.Samples.Commands.csproj
├── ViewModels
│ └── MainViewModel.cs
├── Views
│ ├── MainView.Designer.cs
│ ├── MainView.cs
│ └── MainView.resx
└── packages.config
├── ReactiveUI.Winforms.Samples.Routing
├── App.config
├── Bootstrapper.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ReactiveUI.Winforms.Samples.Routing.csproj
├── ViewModels
│ ├── AboutViewModel.cs
│ ├── ContactViewModel.cs
│ ├── HomeViewModel.cs
│ └── ShellViewModel.cs
├── Views
│ ├── AboutView.Designer.cs
│ ├── AboutView.cs
│ ├── AboutView.resx
│ ├── ContactView.Designer.cs
│ ├── ContactView.cs
│ ├── ContactView.resx
│ ├── HomeView.Designer.cs
│ ├── HomeView.cs
│ ├── HomeView.resx
│ ├── ShellView.Designer.cs
│ ├── ShellView.cs
│ └── ShellView.resx
└── packages.config
└── ReactiveUI.Winforms.Samples.sln
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Sebastian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ReactiveUI.Winforms.Samples
2 | This repository contains examples of ReactiveUI Winforms
3 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Program.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Bindings.Views;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace ReactiveUI.Winforms.Samples.Bindings
6 | {
7 | static class Program
8 | {
9 | [STAThread]
10 | static void Main()
11 | {
12 | Application.EnableVisualStyles();
13 | Application.SetCompatibleTextRenderingDefault(false);
14 | Application.Run(new MainView());
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("ReactiveUI.Winforms.Samples.Bindings")]
5 | [assembly: AssemblyDescription("")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("")]
8 | [assembly: AssemblyProduct("ReactiveUI.Winforms.Samples")]
9 | [assembly: AssemblyCopyright("Copyright © Asesjix 2018")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: Guid("e72f085f-4227-4563-a3ad-07a630239df5")]
16 |
17 | [assembly: AssemblyVersion("1.0.0.0")]
18 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion: 4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
7 | // der Code neu generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ReactiveUI.Winforms.Samples.Bindings.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
19 | // über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ReactiveUI.Winforms.Samples.Bindings.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
56 | /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ReactiveUI.Winforms.Samples.Bindings.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/ReactiveUI.Winforms.Samples.Bindings.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {16AEBB87-DDC5-444C-B22F-EF9E89835EF0}
8 | WinExe
9 | ReactiveUI.Winforms.Samples.Bindings
10 | ReactiveUI.Winforms.Samples.Bindings
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | ReactiveUI.Winforms.Samples.Bindings.Program
36 |
37 |
38 |
39 |
40 |
41 | ..\packages\ReactiveUI.8.0.1\lib\net461\ReactiveUI.dll
42 |
43 |
44 | ..\packages\ReactiveUI.WinForms.8.0.1\lib\net461\ReactiveUI.Winforms.dll
45 |
46 |
47 | ..\packages\Splat.4.0.0\lib\net461\Splat.dll
48 |
49 |
50 |
51 |
52 | ..\packages\System.Drawing.Primitives.4.3.0\lib\net45\System.Drawing.Primitives.dll
53 |
54 |
55 | ..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll
56 |
57 |
58 | ..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll
59 |
60 |
61 | ..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll
62 |
63 |
64 | ..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll
65 |
66 |
67 | ..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | Form
83 |
84 |
85 | MainView.cs
86 |
87 |
88 | ResXFileCodeGenerator
89 | Resources.Designer.cs
90 | Designer
91 |
92 |
93 | True
94 | Resources.resx
95 |
96 |
97 | MainView.cs
98 |
99 |
100 |
101 | SettingsSingleFileGenerator
102 | Settings.Designer.cs
103 |
104 |
105 | True
106 | Settings.settings
107 | True
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/ViewModels/MainViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ReactiveUI.Winforms.Samples.Bindings.ViewModels
4 | {
5 | public class MainViewModel : ReactiveObject
6 | {
7 | private string _applicationTitle;
8 | private string _valueOne;
9 | private long _valueTwo;
10 |
11 | public MainViewModel()
12 | {
13 | // Set properties
14 | ApplicationTitle = "ReactiveUI Winforms Samples by Asesjix - Bindings";
15 | ValueOne = "Type somthing";
16 | ValueTwo = DateTime.Now.Date.ToFileTime();
17 | }
18 |
19 | public string ApplicationTitle
20 | {
21 | get => _applicationTitle;
22 | set => this.RaiseAndSetIfChanged(ref _applicationTitle, value);
23 | }
24 |
25 | public string ValueOne
26 | {
27 | get => _valueOne;
28 | set => this.RaiseAndSetIfChanged(ref _valueOne, value);
29 | }
30 |
31 | public long ValueTwo
32 | {
33 | get => _valueTwo;
34 | set => this.RaiseAndSetIfChanged(ref _valueTwo, value);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Views/MainView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Bindings.Views
2 | {
3 | partial class MainView
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.tbInputOne = new System.Windows.Forms.TextBox();
32 | this.lOutputOne = new System.Windows.Forms.Label();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.label3 = new System.Windows.Forms.Label();
36 | this.label4 = new System.Windows.Forms.Label();
37 | this.dtpInputTwo = new System.Windows.Forms.DateTimePicker();
38 | this.lOutputTwo = new System.Windows.Forms.Label();
39 | this.SuspendLayout();
40 | //
41 | // tbInputOne
42 | //
43 | this.tbInputOne.Location = new System.Drawing.Point(52, 12);
44 | this.tbInputOne.Name = "tbInputOne";
45 | this.tbInputOne.Size = new System.Drawing.Size(100, 20);
46 | this.tbInputOne.TabIndex = 0;
47 | //
48 | // lOutputOne
49 | //
50 | this.lOutputOne.AutoSize = true;
51 | this.lOutputOne.Location = new System.Drawing.Point(210, 15);
52 | this.lOutputOne.MinimumSize = new System.Drawing.Size(50, 0);
53 | this.lOutputOne.Name = "lOutputOne";
54 | this.lOutputOne.Size = new System.Drawing.Size(50, 13);
55 | this.lOutputOne.TabIndex = 1;
56 | //
57 | // label1
58 | //
59 | this.label1.AutoSize = true;
60 | this.label1.Location = new System.Drawing.Point(162, 15);
61 | this.label1.Name = "label1";
62 | this.label1.Size = new System.Drawing.Size(42, 13);
63 | this.label1.TabIndex = 2;
64 | this.label1.Text = "Output:";
65 | //
66 | // label2
67 | //
68 | this.label2.AutoSize = true;
69 | this.label2.Location = new System.Drawing.Point(12, 15);
70 | this.label2.Name = "label2";
71 | this.label2.Size = new System.Drawing.Size(34, 13);
72 | this.label2.TabIndex = 3;
73 | this.label2.Text = "Input:";
74 | //
75 | // label3
76 | //
77 | this.label3.AutoSize = true;
78 | this.label3.Location = new System.Drawing.Point(12, 56);
79 | this.label3.Name = "label3";
80 | this.label3.Size = new System.Drawing.Size(34, 13);
81 | this.label3.TabIndex = 7;
82 | this.label3.Text = "Input:";
83 | //
84 | // label4
85 | //
86 | this.label4.AutoSize = true;
87 | this.label4.Location = new System.Drawing.Point(278, 56);
88 | this.label4.Name = "label4";
89 | this.label4.Size = new System.Drawing.Size(92, 13);
90 | this.label4.TabIndex = 6;
91 | this.label4.Text = "ViewModel Value:";
92 | //
93 | // dtpInputTwo
94 | //
95 | this.dtpInputTwo.Location = new System.Drawing.Point(52, 50);
96 | this.dtpInputTwo.Name = "dtpInputTwo";
97 | this.dtpInputTwo.Size = new System.Drawing.Size(220, 20);
98 | this.dtpInputTwo.TabIndex = 8;
99 | //
100 | // lOutputTwo
101 | //
102 | this.lOutputTwo.AutoSize = true;
103 | this.lOutputTwo.Location = new System.Drawing.Point(376, 56);
104 | this.lOutputTwo.MinimumSize = new System.Drawing.Size(50, 0);
105 | this.lOutputTwo.Name = "lOutputTwo";
106 | this.lOutputTwo.Size = new System.Drawing.Size(50, 13);
107 | this.lOutputTwo.TabIndex = 9;
108 | //
109 | // MainView
110 | //
111 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
112 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
113 | this.ClientSize = new System.Drawing.Size(800, 450);
114 | this.Controls.Add(this.lOutputTwo);
115 | this.Controls.Add(this.dtpInputTwo);
116 | this.Controls.Add(this.label3);
117 | this.Controls.Add(this.label4);
118 | this.Controls.Add(this.label2);
119 | this.Controls.Add(this.label1);
120 | this.Controls.Add(this.lOutputOne);
121 | this.Controls.Add(this.tbInputOne);
122 | this.Name = "MainView";
123 | this.Text = "MainView";
124 | this.ResumeLayout(false);
125 | this.PerformLayout();
126 |
127 | }
128 |
129 | #endregion
130 |
131 | private System.Windows.Forms.TextBox tbInputOne;
132 | private System.Windows.Forms.Label lOutputOne;
133 | private System.Windows.Forms.Label label1;
134 | private System.Windows.Forms.Label label2;
135 | private System.Windows.Forms.Label label3;
136 | private System.Windows.Forms.Label label4;
137 | private System.Windows.Forms.DateTimePicker dtpInputTwo;
138 | private System.Windows.Forms.Label lOutputTwo;
139 | }
140 | }
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Views/MainView.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Bindings.ViewModels;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace ReactiveUI.Winforms.Samples.Bindings.Views
6 | {
7 | public partial class MainView : Form, IViewFor
8 | {
9 | public MainView()
10 | {
11 | InitializeComponent();
12 |
13 | this.WhenActivated(d =>
14 | {
15 | // One way bind from viewmodel to view
16 | d(this.OneWayBind(ViewModel, vm => vm.ApplicationTitle, v => v.Text));
17 |
18 | // Two way bind for input (textbox) and one way bind for output (label)
19 | d(this.Bind(ViewModel, vm => vm.ValueOne, v => v.tbInputOne.Text));
20 | d(this.OneWayBind(ViewModel, vm => vm.ValueOne, v => v.lOutputOne.Text));
21 |
22 | // Two way bind for input (textbox) with convert and one way bind for output (label)
23 | d(this.Bind(ViewModel, vm => vm.ValueTwo, v => v.dtpInputTwo.Value, t => DateTime.FromFileTime(t), dt => dt.ToFileTime()));
24 | d(this.OneWayBind(ViewModel, vm => vm.ValueTwo, v => v.lOutputTwo.Text));
25 | });
26 |
27 | ViewModel = new MainViewModel();
28 | }
29 |
30 | public MainViewModel ViewModel { get; set; }
31 |
32 | object IViewFor.ViewModel
33 | {
34 | get => ViewModel;
35 | set => ViewModel = (MainViewModel)value;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/Views/MainView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Bindings/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Program.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Commands.Views;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace ReactiveUI.Winforms.Samples.Commands
6 | {
7 | static class Program
8 | {
9 | [STAThread]
10 | static void Main()
11 | {
12 | Application.EnableVisualStyles();
13 | Application.SetCompatibleTextRenderingDefault(false);
14 | Application.Run(new MainView());
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("ReactiveUI.Winforms.Samples.Commands")]
5 | [assembly: AssemblyDescription("")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("")]
8 | [assembly: AssemblyProduct("ReactiveUI.Winforms.Samples")]
9 | [assembly: AssemblyCopyright("Copyright © Asesjix 2018")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: Guid("e72f085f-4227-4563-a3ad-07a630239df5")]
16 |
17 | [assembly: AssemblyVersion("1.0.0.0")]
18 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion: 4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
7 | // der Code neu generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ReactiveUI.Winforms.Samples.Commands.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
19 | // über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ReactiveUI.Winforms.Samples.Commands.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
56 | /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ReactiveUI.Winforms.Samples.Commands.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/ReactiveUI.Winforms.Samples.Commands.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B0F115E5-0898-4E65-A6CE-BE3739820D14}
8 | WinExe
9 | ReactiveUI.Winforms.Samples.Commands
10 | ReactiveUI.Winforms.Samples.Commands
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | ReactiveUI.Winforms.Samples.Commands.Program
36 |
37 |
38 |
39 |
40 |
41 | ..\packages\ReactiveUI.8.0.1\lib\net461\ReactiveUI.dll
42 |
43 |
44 | ..\packages\ReactiveUI.WinForms.8.0.1\lib\net461\ReactiveUI.Winforms.dll
45 |
46 |
47 | ..\packages\Splat.4.0.0\lib\net461\Splat.dll
48 |
49 |
50 |
51 | ..\packages\System.Drawing.Primitives.4.3.0\lib\net45\System.Drawing.Primitives.dll
52 |
53 |
54 | ..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll
55 |
56 |
57 | ..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll
58 |
59 |
60 | ..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll
61 |
62 |
63 | ..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll
64 |
65 |
66 | ..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | Form
79 |
80 |
81 | MainView.cs
82 |
83 |
84 |
85 |
86 | ResXFileCodeGenerator
87 | Resources.Designer.cs
88 | Designer
89 |
90 |
91 | True
92 | Resources.resx
93 |
94 |
95 | MainView.cs
96 |
97 |
98 |
99 | SettingsSingleFileGenerator
100 | Settings.Designer.cs
101 |
102 |
103 | True
104 | Settings.settings
105 | True
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/ViewModels/MainViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.Reactive.Linq;
2 | using System.Windows;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Commands.ViewModels
5 | {
6 | public class MainViewModel : ReactiveObject
7 | {
8 | private string _applicationTitle;
9 | private string _withCanExecuteParameter;
10 |
11 | public MainViewModel()
12 | {
13 | // Set properties
14 | ApplicationTitle = "ReactiveUI Winforms Samples by Asesjix - Commands";
15 | // Create parameterless command
16 | ParameterlessCommand = ReactiveCommand.Create(Parameterless);
17 | // Create command with parameter
18 | WithParameterCommand = ReactiveCommand.Create(WithParameter);
19 | // Create command with can execute
20 | WithCanExecuteCommand = ReactiveCommand.Create(WithCanExecute,
21 | this.WhenAnyValue(vm => vm.WithCanExecuteParameter).Select(s => string.IsNullOrEmpty(s) == false));
22 | }
23 |
24 | public string ApplicationTitle
25 | {
26 | get => _applicationTitle;
27 | set => this.RaiseAndSetIfChanged(ref _applicationTitle, value);
28 | }
29 |
30 | public string WithCanExecuteParameter
31 | {
32 | get => _withCanExecuteParameter;
33 | set => this.RaiseAndSetIfChanged(ref _withCanExecuteParameter, value);
34 | }
35 |
36 | public ReactiveCommand ParameterlessCommand { get; }
37 | public ReactiveCommand WithParameterCommand { get; }
38 | public ReactiveCommand WithCanExecuteCommand { get; }
39 |
40 | private void Parameterless()
41 | {
42 | MessageBox.Show("You pressed the button!", ApplicationTitle, MessageBoxButton.OK);
43 | }
44 |
45 | private void WithParameter(string message)
46 | {
47 | MessageBox.Show(message, ApplicationTitle, MessageBoxButton.OK);
48 | }
49 |
50 | private void WithCanExecute()
51 | {
52 | MessageBox.Show(WithCanExecuteParameter, ApplicationTitle, MessageBoxButton.OK);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Views/MainView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Commands.Views
2 | {
3 | partial class MainView
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Windows Form-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btParameterless = new System.Windows.Forms.Button();
32 | this.btWithParameter = new System.Windows.Forms.Button();
33 | this.tbParameter = new System.Windows.Forms.TextBox();
34 | this.tbWithCanExecuteParameter = new System.Windows.Forms.TextBox();
35 | this.btWithCanExecute = new System.Windows.Forms.Button();
36 | this.label1 = new System.Windows.Forms.Label();
37 | this.SuspendLayout();
38 | //
39 | // btParameterless
40 | //
41 | this.btParameterless.Location = new System.Drawing.Point(39, 38);
42 | this.btParameterless.Name = "btParameterless";
43 | this.btParameterless.Size = new System.Drawing.Size(171, 23);
44 | this.btParameterless.TabIndex = 0;
45 | this.btParameterless.Text = "Parameterless Command";
46 | this.btParameterless.UseVisualStyleBackColor = true;
47 | //
48 | // btWithParameter
49 | //
50 | this.btWithParameter.Location = new System.Drawing.Point(39, 77);
51 | this.btWithParameter.Name = "btWithParameter";
52 | this.btWithParameter.Size = new System.Drawing.Size(197, 23);
53 | this.btWithParameter.TabIndex = 1;
54 | this.btWithParameter.Text = "With Parameter Command";
55 | this.btWithParameter.UseVisualStyleBackColor = true;
56 | //
57 | // tbParameter
58 | //
59 | this.tbParameter.Location = new System.Drawing.Point(266, 79);
60 | this.tbParameter.Name = "tbParameter";
61 | this.tbParameter.Size = new System.Drawing.Size(100, 20);
62 | this.tbParameter.TabIndex = 2;
63 | this.tbParameter.Text = "The parameter";
64 | //
65 | // tbWithCanExecuteParameter
66 | //
67 | this.tbWithCanExecuteParameter.Location = new System.Drawing.Point(266, 118);
68 | this.tbWithCanExecuteParameter.Name = "tbWithCanExecuteParameter";
69 | this.tbWithCanExecuteParameter.Size = new System.Drawing.Size(100, 20);
70 | this.tbWithCanExecuteParameter.TabIndex = 4;
71 | //
72 | // btWithCanExecute
73 | //
74 | this.btWithCanExecute.Location = new System.Drawing.Point(39, 116);
75 | this.btWithCanExecute.Name = "btWithCanExecute";
76 | this.btWithCanExecute.Size = new System.Drawing.Size(197, 23);
77 | this.btWithCanExecute.TabIndex = 3;
78 | this.btWithCanExecute.Text = "With Can Execute Command";
79 | this.btWithCanExecute.UseVisualStyleBackColor = true;
80 | //
81 | // label1
82 | //
83 | this.label1.AutoSize = true;
84 | this.label1.Location = new System.Drawing.Point(372, 121);
85 | this.label1.Name = "label1";
86 | this.label1.Size = new System.Drawing.Size(50, 13);
87 | this.label1.TabIndex = 5;
88 | this.label1.Text = "Required";
89 | //
90 | // ShellView
91 | //
92 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
93 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
94 | this.ClientSize = new System.Drawing.Size(800, 450);
95 | this.Controls.Add(this.label1);
96 | this.Controls.Add(this.tbWithCanExecuteParameter);
97 | this.Controls.Add(this.btWithCanExecute);
98 | this.Controls.Add(this.tbParameter);
99 | this.Controls.Add(this.btWithParameter);
100 | this.Controls.Add(this.btParameterless);
101 | this.Name = "ShellView";
102 | this.Text = "Form1";
103 | this.ResumeLayout(false);
104 | this.PerformLayout();
105 |
106 | }
107 |
108 | #endregion
109 |
110 | private System.Windows.Forms.Button btParameterless;
111 | private System.Windows.Forms.Button btWithParameter;
112 | private System.Windows.Forms.TextBox tbParameter;
113 | private System.Windows.Forms.TextBox tbWithCanExecuteParameter;
114 | private System.Windows.Forms.Button btWithCanExecute;
115 | private System.Windows.Forms.Label label1;
116 | }
117 | }
118 |
119 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Views/MainView.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Commands.ViewModels;
2 | using System.Windows.Forms;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Commands.Views
5 | {
6 | public partial class MainView : Form, IViewFor
7 | {
8 | public MainView()
9 | {
10 | InitializeComponent();
11 |
12 | this.WhenActivated(d =>
13 | {
14 | // Bind properties
15 | d(this.OneWayBind(ViewModel, vm => vm.ApplicationTitle, v => v.Text));
16 | // Bind property for command with can execute
17 | d(this.Bind(ViewModel, vm => vm.WithCanExecuteParameter, v => v.tbWithCanExecuteParameter.Text));
18 |
19 | // Bind parameterless command
20 | d(this.BindCommand(ViewModel, vm => vm.ParameterlessCommand, v => v.btParameterless));
21 | // Bind command with parameter
22 | d(this.BindCommand(ViewModel, vm => vm.WithParameterCommand, v => v.btWithParameter, this.WhenAnyValue(v => v.tbParameter.Text)));
23 | // Bind command with can execute
24 | d(this.BindCommand(ViewModel, vm => vm.WithCanExecuteCommand, v => v.btWithCanExecute));
25 | });
26 |
27 | ViewModel = new MainViewModel();
28 | }
29 |
30 | public MainViewModel ViewModel { get; set; }
31 |
32 | object IViewFor.ViewModel
33 | {
34 | get => ViewModel;
35 | set => ViewModel = (MainViewModel)value;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/Views/MainView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Commands/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Bootstrapper.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Routing.ViewModels;
2 | using ReactiveUI.Winforms.Samples.Routing.Views;
3 | using Splat;
4 | using System.Windows.Forms;
5 |
6 | namespace ReactiveUI.Winforms.Samples.Routing
7 | {
8 | public class Bootstrapper
9 | {
10 | public Bootstrapper()
11 | {
12 | ConfigureServices();
13 | }
14 |
15 | private void ConfigureServices()
16 | {
17 | // Register views
18 | Locator.CurrentMutable.Register(() => new ShellView(), typeof(IViewFor));
19 | Locator.CurrentMutable.Register(() => new HomeView(), typeof(IViewFor));
20 | Locator.CurrentMutable.Register(() => new AboutView(), typeof(IViewFor));
21 | Locator.CurrentMutable.Register(() => new ContactView(), typeof(IViewFor));
22 | }
23 |
24 | public void Run()
25 | {
26 | // Create ShellViewModel and register as IScreen
27 | var viewModel = new ShellViewModel();
28 | Locator.CurrentMutable.RegisterConstant(viewModel, typeof(IScreen));
29 | // Resolve view for ShellViewModel
30 | var view = ViewLocator.Current.ResolveView(viewModel);
31 | view.ViewModel = viewModel;
32 | // Run application
33 | Application.Run((Form)view);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Routing
5 | {
6 | static class Program
7 | {
8 | [STAThread]
9 | static void Main()
10 | {
11 | Application.EnableVisualStyles();
12 | Application.SetCompatibleTextRenderingDefault(false);
13 |
14 | // Create and run Bootstrapper
15 | var bootstrapper = new Bootstrapper();
16 | bootstrapper.Run();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("ReactiveUI.Winforms.Samples.Routing")]
5 | [assembly: AssemblyDescription("")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("")]
8 | [assembly: AssemblyProduct("ReactiveUI.Winforms.Samples")]
9 | [assembly: AssemblyCopyright("Copyright © Asesjix 2018")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: Guid("e72f085f-4227-4563-a3ad-07a630239df5")]
16 |
17 | [assembly: AssemblyVersion("1.0.0.0")]
18 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ReactiveUI.Winforms.Samples.Routing.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ReactiveUI.Winforms.Samples.Routing.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ReactiveUI.Winforms.Samples.Routing.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/ReactiveUI.Winforms.Samples.Routing.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E72F085F-4227-4563-A3AD-07A630239DF5}
8 | WinExe
9 | ReactiveUI.Winforms.Samples.Routing
10 | ReactiveUI.Winforms.Samples.Routing
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | ReactiveUI.Winforms.Samples.Routing.Program
36 |
37 |
38 |
39 |
40 |
41 | ..\packages\ReactiveUI.8.0.1\lib\net461\ReactiveUI.dll
42 |
43 |
44 | ..\packages\ReactiveUI.WinForms.8.0.1\lib\net461\ReactiveUI.Winforms.dll
45 |
46 |
47 | ..\packages\Splat.4.0.0\lib\net461\Splat.dll
48 |
49 |
50 |
51 |
52 |
53 | ..\packages\System.Drawing.Primitives.4.3.0\lib\net45\System.Drawing.Primitives.dll
54 |
55 |
56 | ..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll
57 |
58 |
59 | ..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll
60 |
61 |
62 | ..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll
63 |
64 |
65 | ..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll
66 |
67 |
68 | ..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | UserControl
86 |
87 |
88 | ContactView.cs
89 |
90 |
91 | UserControl
92 |
93 |
94 | HomeView.cs
95 |
96 |
97 | UserControl
98 |
99 |
100 | AboutView.cs
101 |
102 |
103 | Form
104 |
105 |
106 | ShellView.cs
107 |
108 |
109 | ResXFileCodeGenerator
110 | Resources.Designer.cs
111 | Designer
112 |
113 |
114 | True
115 | Resources.resx
116 | True
117 |
118 |
119 | ContactView.cs
120 |
121 |
122 | HomeView.cs
123 |
124 |
125 | AboutView.cs
126 |
127 |
128 | ShellView.cs
129 |
130 |
131 |
132 | SettingsSingleFileGenerator
133 | Settings.Designer.cs
134 |
135 |
136 | True
137 | Settings.settings
138 | True
139 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/ViewModels/AboutViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.ViewModels
2 | {
3 | public class AboutViewModel : ReactiveObject, IRoutableViewModel
4 | {
5 | private string _viewTitle;
6 |
7 | public AboutViewModel()
8 | {
9 | ViewTitle = "About View";
10 | }
11 |
12 | public string ViewTitle
13 | {
14 | get => _viewTitle;
15 | set => this.RaiseAndSetIfChanged(ref _viewTitle, value);
16 | }
17 |
18 | public IScreen HostScreen { get; protected set; }
19 | public string UrlPathSegment { get; protected set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/ViewModels/ContactViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.ViewModels
2 | {
3 | public class ContactViewModel : ReactiveObject, IRoutableViewModel
4 | {
5 | private string _viewTitle;
6 |
7 | public ContactViewModel()
8 | {
9 | ViewTitle = "Contact View";
10 | }
11 |
12 | public string ViewTitle
13 | {
14 | get => _viewTitle;
15 | set => this.RaiseAndSetIfChanged(ref _viewTitle, value);
16 | }
17 |
18 | public IScreen HostScreen { get; protected set; }
19 | public string UrlPathSegment { get; protected set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/ViewModels/HomeViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.ViewModels
2 | {
3 | public class HomeViewModel : ReactiveObject, IRoutableViewModel
4 | {
5 | private string _viewTitle;
6 |
7 | public HomeViewModel()
8 | {
9 | ViewTitle = "Home View";
10 | }
11 |
12 | public string ViewTitle
13 | {
14 | get => _viewTitle;
15 | set => this.RaiseAndSetIfChanged(ref _viewTitle, value);
16 | }
17 |
18 | public IScreen HostScreen { get; protected set; }
19 | public string UrlPathSegment { get; protected set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/ViewModels/ShellViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ReactiveUI.Winforms.Samples.Routing.ViewModels
4 | {
5 | public class ShellViewModel : ReactiveObject, IScreen
6 | {
7 | private string _applicationTitle;
8 |
9 | public ShellViewModel()
10 | {
11 | // Create router for IScreen
12 | Router = new RoutingState();
13 | // Set properties
14 | ApplicationTitle = "ReactiveUI Winforms Samples by Asesjix - Routing";
15 | // Create commands
16 | ShowHomeCommand = ReactiveCommand.Create(ShowHome);
17 | ShowAboutCommand = ReactiveCommand.Create(ShowAbout);
18 | ShowContactCommand = ReactiveCommand.Create(ShowContact);
19 | GoBackCommand = ReactiveCommand.Create(GoBack, Router.NavigateBack.CanExecute);
20 | // Navigate to HomeViewModel and reset NavigationStack (shows HomeView at application start)
21 | Router
22 | .NavigateAndReset
23 | .Execute(new HomeViewModel())
24 | .Subscribe();
25 | }
26 |
27 | public RoutingState Router { get; }
28 |
29 | public string ApplicationTitle
30 | {
31 | get => _applicationTitle;
32 | set => this.RaiseAndSetIfChanged(ref _applicationTitle, value);
33 | }
34 |
35 | public ReactiveCommand ShowHomeCommand { get; }
36 | public ReactiveCommand ShowAboutCommand { get; }
37 | public ReactiveCommand ShowContactCommand { get; }
38 | public ReactiveCommand GoBackCommand { get; }
39 |
40 | private void ShowHome()
41 | {
42 | // Navigate to HomeViewModel
43 | Router
44 | .Navigate
45 | .Execute(new HomeViewModel())
46 | .Subscribe();
47 | }
48 |
49 | private void ShowAbout()
50 | {
51 | // Navigate to AboutViewModel
52 | Router
53 | .Navigate
54 | .Execute(new AboutViewModel())
55 | .Subscribe();
56 | }
57 |
58 | private void ShowContact()
59 | {
60 | // Navigate to ContactViewModel
61 | Router
62 | .Navigate
63 | .Execute(new ContactViewModel())
64 | .Subscribe();
65 | }
66 |
67 | private void GoBack()
68 | {
69 | // Navigate back in NavigationStack
70 | // Note: You have to check the count to prevent an ArgumentOutOfRangeException or navigate to empty
71 | if (Router.NavigationStack.Count > 0)
72 | {
73 | Router
74 | .NavigateBack
75 | .Execute()
76 | .Subscribe();
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/AboutView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.Views
2 | {
3 | partial class AboutView
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lViewTitle = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // lViewTitle
35 | //
36 | this.lViewTitle.AutoSize = true;
37 | this.lViewTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
38 | this.lViewTitle.Location = new System.Drawing.Point(3, 13);
39 | this.lViewTitle.Name = "lViewTitle";
40 | this.lViewTitle.Size = new System.Drawing.Size(120, 25);
41 | this.lViewTitle.TabIndex = 2;
42 | this.lViewTitle.Text = "View Name";
43 | //
44 | // AboutView
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.Controls.Add(this.lViewTitle);
49 | this.Name = "AboutView";
50 | this.Size = new System.Drawing.Size(489, 327);
51 | this.ResumeLayout(false);
52 | this.PerformLayout();
53 |
54 | }
55 |
56 | #endregion
57 |
58 | private System.Windows.Forms.Label lViewTitle;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/AboutView.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Routing.ViewModels;
2 | using System.Windows.Forms;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Routing.Views
5 | {
6 | public partial class AboutView : UserControl, IViewFor
7 | {
8 | public AboutView()
9 | {
10 | InitializeComponent();
11 |
12 | this.WhenActivated(d =>
13 | {
14 | d(this.OneWayBind(ViewModel, vm => vm.ViewTitle, v => v.lViewTitle.Text));
15 | });
16 | }
17 |
18 | public AboutViewModel ViewModel { get; set; }
19 |
20 | object IViewFor.ViewModel
21 | {
22 | get => ViewModel;
23 | set => ViewModel = (AboutViewModel)value;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/AboutView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/ContactView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.Views
2 | {
3 | partial class ContactView
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lViewTitle = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // lViewTitle
35 | //
36 | this.lViewTitle.AutoSize = true;
37 | this.lViewTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
38 | this.lViewTitle.Location = new System.Drawing.Point(3, 11);
39 | this.lViewTitle.Name = "lViewTitle";
40 | this.lViewTitle.Size = new System.Drawing.Size(120, 25);
41 | this.lViewTitle.TabIndex = 1;
42 | this.lViewTitle.Text = "View Name";
43 | //
44 | // ContactView
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.Controls.Add(this.lViewTitle);
49 | this.Name = "ContactView";
50 | this.Size = new System.Drawing.Size(669, 330);
51 | this.ResumeLayout(false);
52 | this.PerformLayout();
53 |
54 | }
55 |
56 | #endregion
57 |
58 | private System.Windows.Forms.Label lViewTitle;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/ContactView.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Routing.ViewModels;
2 | using System.Windows.Forms;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Routing.Views
5 | {
6 | public partial class ContactView : UserControl, IViewFor
7 | {
8 | public ContactView()
9 | {
10 | InitializeComponent();
11 |
12 | this.WhenActivated(d =>
13 | {
14 | d(this.OneWayBind(ViewModel, vm => vm.ViewTitle, v => v.lViewTitle.Text));
15 | });
16 | }
17 |
18 | public ContactViewModel ViewModel { get; set; }
19 |
20 | object IViewFor.ViewModel
21 | {
22 | get => ViewModel;
23 | set => ViewModel = (ContactViewModel)value;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/ContactView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/HomeView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.Views
2 | {
3 | partial class HomeView
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lViewTitle = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // lViewTitle
35 | //
36 | this.lViewTitle.AutoSize = true;
37 | this.lViewTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
38 | this.lViewTitle.Location = new System.Drawing.Point(3, 10);
39 | this.lViewTitle.Name = "lViewTitle";
40 | this.lViewTitle.Size = new System.Drawing.Size(120, 25);
41 | this.lViewTitle.TabIndex = 0;
42 | this.lViewTitle.Text = "View Name";
43 | //
44 | // HomeView
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.Controls.Add(this.lViewTitle);
49 | this.Name = "HomeView";
50 | this.Size = new System.Drawing.Size(666, 409);
51 | this.ResumeLayout(false);
52 | this.PerformLayout();
53 |
54 | }
55 |
56 | #endregion
57 |
58 | private System.Windows.Forms.Label lViewTitle;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/HomeView.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Routing.ViewModels;
2 | using System.Windows.Forms;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Routing.Views
5 | {
6 | public partial class HomeView : UserControl, IViewFor
7 | {
8 | public HomeView()
9 | {
10 | InitializeComponent();
11 |
12 | this.WhenActivated(d =>
13 | {
14 | d(this.OneWayBind(ViewModel, vm => vm.ViewTitle, v => v.lViewTitle.Text));
15 | });
16 | }
17 |
18 | public HomeViewModel ViewModel { get; set; }
19 |
20 | object IViewFor.ViewModel
21 | {
22 | get => ViewModel;
23 | set => ViewModel = (HomeViewModel)value;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/HomeView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/ShellView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReactiveUI.Winforms.Samples.Routing.Views
2 | {
3 | partial class ShellView
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.routedControlHost = new ReactiveUI.Winforms.RoutedControlHost();
32 | this.btHome = new System.Windows.Forms.Button();
33 | this.btAbout = new System.Windows.Forms.Button();
34 | this.btGoBack = new System.Windows.Forms.Button();
35 | this.btContact = new System.Windows.Forms.Button();
36 | this.SuspendLayout();
37 | //
38 | // routedControlHost
39 | //
40 | this.routedControlHost.DefaultContent = null;
41 | this.routedControlHost.Location = new System.Drawing.Point(3, 55);
42 | this.routedControlHost.Name = "routedControlHost";
43 | this.routedControlHost.Router = null;
44 | this.routedControlHost.Size = new System.Drawing.Size(794, 392);
45 | this.routedControlHost.TabIndex = 4;
46 | this.routedControlHost.ViewLocator = null;
47 | //
48 | // btHome
49 | //
50 | this.btHome.Location = new System.Drawing.Point(12, 12);
51 | this.btHome.Name = "btHome";
52 | this.btHome.Size = new System.Drawing.Size(75, 23);
53 | this.btHome.TabIndex = 5;
54 | this.btHome.Text = "Show Home";
55 | this.btHome.UseVisualStyleBackColor = true;
56 | //
57 | // btAbout
58 | //
59 | this.btAbout.Location = new System.Drawing.Point(93, 12);
60 | this.btAbout.Name = "btAbout";
61 | this.btAbout.Size = new System.Drawing.Size(112, 23);
62 | this.btAbout.TabIndex = 6;
63 | this.btAbout.Text = "Show About";
64 | this.btAbout.UseVisualStyleBackColor = true;
65 | //
66 | // btGoBack
67 | //
68 | this.btGoBack.Location = new System.Drawing.Point(329, 12);
69 | this.btGoBack.Name = "btGoBack";
70 | this.btGoBack.Size = new System.Drawing.Size(75, 23);
71 | this.btGoBack.TabIndex = 7;
72 | this.btGoBack.Text = "Go Back";
73 | this.btGoBack.UseVisualStyleBackColor = true;
74 | //
75 | // btContact
76 | //
77 | this.btContact.Location = new System.Drawing.Point(211, 12);
78 | this.btContact.Name = "btContact";
79 | this.btContact.Size = new System.Drawing.Size(112, 23);
80 | this.btContact.TabIndex = 8;
81 | this.btContact.Text = "Show Contact";
82 | this.btContact.UseVisualStyleBackColor = true;
83 | //
84 | // ShellView
85 | //
86 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
87 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
88 | this.ClientSize = new System.Drawing.Size(800, 450);
89 | this.Controls.Add(this.btContact);
90 | this.Controls.Add(this.routedControlHost);
91 | this.Controls.Add(this.btHome);
92 | this.Controls.Add(this.btAbout);
93 | this.Controls.Add(this.btGoBack);
94 | this.Name = "ShellView";
95 | this.Text = "ShellForm";
96 | this.ResumeLayout(false);
97 |
98 | }
99 |
100 | #endregion
101 |
102 | private RoutedControlHost routedControlHost;
103 | private System.Windows.Forms.Button btHome;
104 | private System.Windows.Forms.Button btAbout;
105 | private System.Windows.Forms.Button btGoBack;
106 | private System.Windows.Forms.Button btContact;
107 | }
108 | }
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/ShellView.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI.Winforms.Samples.Routing.ViewModels;
2 | using System.Windows.Forms;
3 |
4 | namespace ReactiveUI.Winforms.Samples.Routing.Views
5 | {
6 | public partial class ShellView : Form, IViewFor
7 | {
8 | /*
9 | * To see the RoutedControlHost in the Designer you have to create it manually in the ShellView.Designer.cs
10 | *
11 | * private void InitializeComponent()
12 | * {
13 | * this.routedControlHost = new ReactiveUI.Winforms.RoutedControlHost();
14 | * ...
15 | * //
16 | * // routedControlHost
17 | * //
18 | * this.routedControlHost.DefaultContent = null;
19 | * this.routedControlHost.Location = new System.Drawing.Point(3, 55);
20 | * this.routedControlHost.Name = "routedControlHost";
21 | * this.routedControlHost.Router = null;
22 | * this.routedControlHost.Size = new System.Drawing.Size(794, 392);
23 | * this.routedControlHost.TabIndex = 4;
24 | * this.routedControlHost.ViewLocator = null;
25 | * ...
26 | * //
27 | * // ShellView
28 | * //
29 | * ...
30 | * this.Controls.Add(this.routedControlHost);
31 | * }
32 | *
33 | * private RoutedControlHost routedControlHost;
34 | *
35 | */
36 |
37 | public ShellView()
38 | {
39 | InitializeComponent();
40 |
41 | this.WhenActivated(b =>
42 | {
43 | // Bind router
44 | b(this.OneWayBind(ViewModel, vm => vm.Router, v => v.routedControlHost.Router));
45 |
46 | // Bind properties
47 | b(this.OneWayBind(ViewModel, vm => vm.ApplicationTitle, v => v.Text));
48 |
49 | // Bind commands
50 | b(this.BindCommand(ViewModel, vm => vm.ShowHomeCommand, v => v.btHome));
51 | b(this.BindCommand(ViewModel, vm => vm.ShowAboutCommand, v => v.btAbout));
52 | b(this.BindCommand(ViewModel, vm => vm.ShowContactCommand, v => v.btContact));
53 | b(this.BindCommand(ViewModel, vm => vm.GoBackCommand, v => v.btGoBack));
54 | });
55 | }
56 |
57 | public ShellViewModel ViewModel { get; set; }
58 |
59 | object IViewFor.ViewModel
60 | {
61 | get => ViewModel;
62 | set => ViewModel = (ShellViewModel)value;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/Views/ShellView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.Routing/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ReactiveUI.Winforms.Samples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27428.2037
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Winforms.Samples.Routing", "ReactiveUI.Winforms.Samples.Routing\ReactiveUI.Winforms.Samples.Routing.csproj", "{E72F085F-4227-4563-A3AD-07A630239DF5}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Winforms.Samples.Commands", "ReactiveUI.Winforms.Samples.Commands\ReactiveUI.Winforms.Samples.Commands.csproj", "{B0F115E5-0898-4E65-A6CE-BE3739820D14}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Winforms.Samples.Bindings", "ReactiveUI.Winforms.Samples.Bindings\ReactiveUI.Winforms.Samples.Bindings.csproj", "{16AEBB87-DDC5-444C-B22F-EF9E89835EF0}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {E72F085F-4227-4563-A3AD-07A630239DF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {E72F085F-4227-4563-A3AD-07A630239DF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {E72F085F-4227-4563-A3AD-07A630239DF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {E72F085F-4227-4563-A3AD-07A630239DF5}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {B0F115E5-0898-4E65-A6CE-BE3739820D14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {B0F115E5-0898-4E65-A6CE-BE3739820D14}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {B0F115E5-0898-4E65-A6CE-BE3739820D14}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {B0F115E5-0898-4E65-A6CE-BE3739820D14}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {16AEBB87-DDC5-444C-B22F-EF9E89835EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {16AEBB87-DDC5-444C-B22F-EF9E89835EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {16AEBB87-DDC5-444C-B22F-EF9E89835EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {16AEBB87-DDC5-444C-B22F-EF9E89835EF0}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {FE4FC381-5DE6-43ED-B35E-0CFDCCBDA1A7}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------