├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE
├── NuGet.Config
├── README.md
└── src
├── AgilePairingBacklog
├── AgilePairingBacklog.sln
└── AgilePairingBacklog
│ ├── AgilePairingBacklog.csproj
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Content
│ ├── people.png
│ ├── person.png
│ └── tasks.png
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Models
│ ├── AgilePairingBacklogProject.cs
│ ├── ApplicationCommandsEx.cs
│ ├── ModelBase.cs
│ ├── Pairing.cs
│ ├── Person.cs
│ ├── Task.cs
│ └── TaskStatus.cs
│ └── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── BuildProcessTemplates
├── DefaultTemplate.11.1.xaml
├── DefaultTemplate.xaml
├── LabDefaultTemplate.11.xaml
└── UpgradeTemplate.xaml
├── Code Snippets
└── propnpc.snippet
└── Microsoft.DwayneNeed
├── CustomBitmapDemo
├── App.xaml
├── App.xaml.cs
├── CustomBitmapDemo.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Window1.xaml
├── Window1.xaml.cs
└── app.config
├── D2DSamples
├── D2DSamples.cpp
├── D2DSamples.def
├── D2DSamples.vcxproj
├── D2DSamples.vcxproj.filters
├── GeometryRealization.cpp
├── GeometryRealization.h
├── GeometryRealizationSample.cpp
├── GeometryRealizationSample.h
├── RingBuffer.h
├── dllmain.cpp
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── DemoApp
├── App.xaml
├── App.xaml.cs
├── DemoApp.csproj
├── Demos
│ └── Airspace
│ │ ├── AirspaceDemo.xaml
│ │ ├── AirspaceDemo.xaml.cs
│ │ ├── AirspaceDemoMode.cs
│ │ ├── D2DSample.xaml
│ │ ├── D2DSample.xaml.cs
│ │ ├── Model
│ │ ├── MdiDemoColorGridContent.cs
│ │ ├── MdiDemoCommands.cs
│ │ ├── MdiDemoContent.cs
│ │ ├── MdiDemoOptions.cs
│ │ ├── MdiDemoPageContent.cs
│ │ └── MdiDemoWorkspace.cs
│ │ ├── OptionsDialog.xaml
│ │ ├── OptionsDialog.xaml.cs
│ │ ├── Topic.xaml
│ │ ├── Topic.xaml.cs
│ │ ├── WPFCubes.xaml
│ │ ├── WPFCubes.xaml.cs
│ │ ├── WPFDataForm.xaml
│ │ ├── WPFDataForm.xaml.cs
│ │ ├── WPFImage.xaml
│ │ ├── WPFImage.xaml.cs
│ │ ├── WPFMediaElement.xaml
│ │ ├── WPFMediaElement.xaml.cs
│ │ ├── WPFWebBrowser.xaml
│ │ ├── WPFWebBrowser.xaml.cs
│ │ ├── WinFormsCalendar.xaml
│ │ ├── WinFormsCalendar.xaml.cs
│ │ ├── WinFormsDataForm.xaml
│ │ ├── WinFormsDataForm.xaml.cs
│ │ ├── WinFormsMediaPlayer.xaml
│ │ ├── WinFormsMediaPlayer.xaml.cs
│ │ ├── WinFormsMix.xaml
│ │ ├── WinFormsMix.xaml.cs
│ │ ├── WinFormsRemoteDesktop.xaml
│ │ ├── WinFormsRemoteDesktop.xaml.cs
│ │ ├── WinFormsWebBrowser.xaml
│ │ └── WinFormsWebBrowser.xaml.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Model
│ ├── Index.cs
│ ├── ModelBase.cs
│ └── Topic.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── app.config
├── ExpressionTest
├── ExpressionTest.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── ValueExpression.cs
└── app.config
├── GlobeDemo
├── App.xaml
├── App.xaml.cs
├── GlobeDemo.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Trackball.cs
├── WorldMap.xaml
├── WorldMap.xaml.cs
└── app.config
├── HierarchicalDataDemo
├── App.xaml
├── App.xaml.cs
├── HeiankyoView.cs
├── HierarchicalDataDemo.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── SubspaceSet.cs
├── Window1.xaml
├── Window1.xaml.cs
└── app.config
├── Microsoft.DwayneNeed.Reactive.Contract
├── IMutableValue.cs
├── IObservableValue.cs
├── Microsoft.DwayneNeed.Reactive.Contract.csproj
└── Properties
│ └── AssemblyInfo.cs
├── Microsoft.DwayneNeed.Reactive.UnitTests
├── ConstantValueTests.cs
├── ExampleClass.cs
├── Microsoft.DwayneNeed.Reactive.UnitTests.csproj
├── MutableValueTests.cs
├── ObservableInstanceMethodTests.cs
├── ObservableMethodExpressionTests.cs
├── Properties
│ └── AssemblyInfo.cs
├── ReadOnlyValueTests.cs
└── packages.config
├── Microsoft.DwayneNeed.Reactive
├── ConstantValue.cs
├── Microsoft.DwayneNeed.Reactive.csproj
├── MutableValue.cs
├── ObservableExpression.cs
├── ObservableInstanceMethod.cs
├── Properties
│ └── AssemblyInfo.cs
├── ReadOnlyValue.cs
├── ValueExtensions.cs
└── packages.config
├── Microsoft.DwayneNeed.Win32
├── App.config
├── ComCtl32
│ ├── SUBCLASSPROC.cs
│ ├── StrongHWND.cs
│ ├── StrongHWNDSubclass.cs
│ └── WindowSubclass.cs
├── Common
│ └── ThreadAffinitizedHandle.cs
├── Documentation
│ ├── API.xlsx
│ └── readme.docx
├── DwmApi
│ └── DWM_EC.cs
├── Gdi32
│ ├── BI.cs
│ ├── BITMAPINFO.cs
│ ├── BKMODE.cs
│ ├── CHARSET.cs
│ ├── CLIP.cs
│ ├── COLOR.cs
│ ├── COLORREF.cs
│ ├── DIB.cs
│ ├── FF.cs
│ ├── FW.cs
│ ├── GDC.cs
│ ├── HBRUSH.cs
│ ├── HDC.cs
│ ├── HGDIOBJ.cs
│ ├── OBJ.cs
│ ├── OUTPRECIS.cs
│ ├── PITCH.cs
│ ├── PITCH_FF.cs
│ ├── QUALITY.cs
│ └── ROP.cs
├── Kernel32
│ ├── Error.cs
│ ├── MEM.cs
│ ├── PAGE.cs
│ ├── SEC.cs
│ ├── SYSTEM_INFO.cs
│ └── _PROCESSOR_INFO_UNION.cs
├── Microsoft.DwayneNeed.Win32.csproj
├── NativeMacros.cs
├── NativeMethods.cs
├── Properties
│ └── AssemblyInfo.cs
├── UrlMon
│ ├── INTERNETFEATURELIST.cs
│ └── SET_FEATURE.cs
└── User32
│ ├── CS.cs
│ ├── DT.cs
│ ├── GA.cs
│ ├── GCL.cs
│ ├── GCW.cs
│ ├── GW.cs
│ ├── GWL.cs
│ ├── HARDWAREINPUT.cs
│ ├── HWND.cs
│ ├── INPUT.cs
│ ├── KEYBDINPUT.cs
│ ├── KEYEVENTF.cs
│ ├── LWA.cs
│ ├── MA.cs
│ ├── MOUSEEVENTF.cs
│ ├── MOUSEINPUT.cs
│ ├── POINT.cs
│ ├── PW.cs
│ ├── RDW.cs
│ ├── RECT.cs
│ ├── SW.cs
│ ├── SWP.cs
│ ├── TIMERPROC.cs
│ ├── VK.cs
│ ├── WINDOWPOS.cs
│ ├── WM.cs
│ ├── WNDCLASSEX.cs
│ ├── WNDPROC.cs
│ ├── WS.cs
│ └── WS_EX.cs
├── Microsoft.DwayneNeed.sln
├── Microsoft.DwayneNeed
├── Controls
│ ├── ChildWindow.cs
│ ├── ColorGrid.cs
│ ├── ComponentPresenter.cs
│ ├── Decorator.cs
│ ├── ElementModalDialog.cs
│ ├── HwndSourceElement.cs
│ ├── IModalContent.cs
│ ├── MeshTextureCoordinateVisualizer.cs
│ ├── OldSchoolMdiWindow.cs
│ ├── SelectorEx.cs
│ ├── VisualWrapper.cs
│ └── WebBrowserEx.cs
├── Converters
│ ├── ContainerFromItemConverter.cs
│ ├── EnumToBoolConverter.cs
│ ├── MdiWindowEdgeThicknessConverter.cs
│ ├── MultiBindingBooleanConverter.cs
│ ├── PixelGridLengthConverter.cs
│ └── StarGridLengthConverter.cs
├── Extensions
│ ├── DispatcherExtensions.cs
│ ├── ElementExtensions.cs
│ ├── EventHandlerExtensions.cs
│ ├── HwndHostExtensions.cs
│ ├── HwndSourceExtensions.cs
│ ├── Int32CollectionExtensions.cs
│ ├── Int32RectExtensions.cs
│ ├── MeshGeometry3DExtensions.cs
│ ├── PresentationSourceExtensions.cs
│ ├── RectExtensions.cs
│ └── WebBrowserExtensions.cs
├── Geometry
│ ├── Box.cs
│ ├── Box1D.cs
│ ├── Box2D.cs
│ ├── Box3D.cs
│ ├── BoxExtensions.cs
│ ├── Point.cs
│ ├── Point1D.cs
│ ├── Point2D.cs
│ ├── Point3D.cs
│ ├── PointExtensions.cs
│ ├── Size.cs
│ ├── Size1D.cs
│ ├── Size2D.cs
│ ├── Size3D.cs
│ ├── SizeExtensions.cs
│ ├── Vector.cs
│ ├── Vector1D.cs
│ ├── Vector2D.cs
│ ├── Vector3D.cs
│ └── VectorExtensions.cs
├── Input
│ └── RoutedCommand.cs
├── Interop
│ ├── AirspaceDecorator.cs
│ ├── AirspaceMode.cs
│ ├── AirspaceScrollViewer.cs
│ ├── CallbackHwndHost.cs
│ ├── CopyBitsBehavior.cs
│ ├── DeviceContextCachePolicy.cs
│ ├── HwndHostCommands.cs
│ ├── HwndHostEx.cs
│ ├── HwndSourceHost.cs
│ ├── HwndSourceHostRoot.cs
│ ├── MouseActivateParameter.cs
│ ├── RedirectedHwndHost.cs
│ ├── RedirectedHwndSourceHost.cs
│ ├── RedirectedWindow.cs
│ ├── RedirectionVisibility.cs
│ ├── WindowBase.cs
│ ├── WindowClass.cs
│ ├── WindowClassType.cs
│ ├── WindowParameters.cs
│ └── WindowShowState.cs
├── MDI
│ ├── AdjustWindowRectParameter.cs
│ ├── MdiCommands.cs
│ ├── MdiFloater.cs
│ ├── MdiPanel.cs
│ ├── MdiView.cs
│ ├── MdiWindow.cs
│ ├── MdiWindowCollection.cs
│ ├── MdiWindowEdge.cs
│ └── MdiWindowThumb.cs
├── Media
│ ├── CacheScale.cs
│ ├── DynamicThickness.cs
│ ├── Imaging
│ │ ├── Bgra32Pixel.cs
│ │ ├── ChainedBitmap.cs
│ │ ├── ColorKeyBitmap.cs
│ │ ├── CustomBitmap.cs
│ │ ├── GrayscaleBitmap.cs
│ │ └── SepiaBitmap.cs
│ └── Shape3DMaterial.cs
├── Microsoft.DwayneNeed.csproj
├── Numerics
│ ├── Binary64.cs
│ ├── Binary64Exponent.cs
│ ├── Binary64InsignificantBits.cs
│ ├── Binary64Significand.cs
│ ├── ClosedInterval.cs
│ ├── Degree.cs
│ ├── Double42.cs
│ ├── DoubleExtensions.cs
│ ├── Int32Point.cs
│ ├── Interval.cs
│ ├── IntervalExtensions.cs
│ ├── MemoizeMath.cs
│ ├── NumberSet.cs
│ ├── OpenInterval.cs
│ ├── Radian.cs
│ └── Sign.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Shapes
│ ├── BoysSurface.cs
│ ├── Cone.cs
│ ├── Cylinder.cs
│ ├── Ellipsoid.cs
│ ├── Figure8Torus.cs
│ ├── MobiusStrip.cs
│ ├── ParametricShape3D.cs
│ ├── RomanSurface.cs
│ ├── Shape3D.cs
│ ├── Sphere.cs
│ ├── SuperEllipsoid.cs
│ ├── SuperToroid.cs
│ └── Torus.cs
├── Themes
│ └── Generic.xaml
├── Threading
│ ├── UIThreadPerfCounters.cs
│ ├── UIThreadPerfSample.cs
│ ├── UIThreadPool.cs
│ ├── UIThreadPoolDataGridColumn.cs
│ ├── UIThreadPoolDataGridTemplateColumn.cs
│ ├── UIThreadPoolRoot.cs
│ ├── UIThreadPoolThread.cs
│ └── VisualTargetPresentationSource.cs
└── Utilities
│ ├── Buffer2D.cs
│ ├── Buffer2DView.cs
│ ├── CommandLineParameterAttribute.cs
│ ├── CommandLineParameterException.cs
│ ├── CommandLineParser.cs
│ └── CommandLineUsageException.cs
├── MultiThreadDataGridDemo
├── App.xaml
├── App.xaml.cs
├── DataItem.cs
├── DataSet.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MultiThreadDataGridDemo.csproj
├── NotificationConfiguration.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── SomeEnum.cs
└── app.config
├── OldSchoolMdiDemo
├── 3DThing.xaml
├── 3DThing.xaml.cs
├── App.xaml
├── App.xaml.cs
├── Bing.xaml
├── Bing.xaml.cs
├── ClassicMdiChild.cs
├── ClassicMdiClient.cs
├── ClassicMdiFrame.cs
├── Jellyfish.jpg
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── NotifyMdiClientEventArgs.cs
├── OldSchoolMdiDemo.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TestElement.cs
└── app.config
├── TestCmd
├── App.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── TestCmd.csproj
├── VisualTargetDemo
├── App.xaml
├── App.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── VisualTargetDemo.csproj
├── Window1.xaml
├── Window1.xaml.cs
└── app.config
├── WeakEventDemo
├── App.xaml
├── App.xaml.cs
├── CompositionTargetRenderingEvent.cs
├── Event.cs
├── EventSubscription.cs
├── EventSubscriptionOwner.cs
├── InstanceEventExtensions.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── WeakEventDemo.csproj
└── WeakReference.cs
├── WindowsFormsControls
├── ControlMix.Designer.cs
├── ControlMix.cs
├── ControlMix.resx
├── DataForm.Designer.cs
├── DataForm.cs
├── DataForm.resx
├── MediaPlayer.Designer.cs
├── MediaPlayer.cs
├── MediaPlayer.resx
├── Properties
│ └── AssemblyInfo.cs
└── WindowsFormsControls.csproj
└── XnaControls
├── Properties
└── AssemblyInfo.cs
├── XnaControls.csproj
└── XnaHwndHost.cs
/.editorconfig:
--------------------------------------------------------------------------------
1 | ; Top-most http://editorconfig.org/ file
2 | root = true
3 |
4 | [*]
5 | end_of_line = CRLF
6 |
7 | ; 4-column tab indentation
8 | [*.{cs,csproj,xaml,xml,props,targets}]
9 | indent_style = space
10 | indent_size = 4
11 |
12 | [*.{md,yml}]
13 | indent_style = space
14 | indent_size = 2
15 |
16 |
17 | [*.cs]
18 | # WPF0011: Containing type should be used as registered owner.
19 | dotnet_diagnostic.WPF0011.severity = error
20 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Jan Karger ツ ☀
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 |
--------------------------------------------------------------------------------
/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Microsoft.DwayneNeed
2 | Samples and reusable code for accomplishing interesting scenarios in WPF (incl. Dwayne Need's WPF AirspaceDecorator). https://microsoftdwayneneed.codeplex.com
3 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgilePairingBacklog", "AgilePairingBacklog\AgilePairingBacklog.csproj", "{04039A18-004F-4EC5-812C-ED8A775C28E1}"
5 | EndProject
6 | Global
7 | GlobalSection(TeamFoundationVersionControl) = preSolution
8 | SccNumberOfProjects = 2
9 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
10 | SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs06
11 | SccLocalPath0 = .
12 | SccProjectUniqueName1 = AgilePairingBacklog\\AgilePairingBacklog.csproj
13 | SccProjectName1 = AgilePairingBacklog
14 | SccLocalPath1 = AgilePairingBacklog
15 | EndGlobalSection
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {04039A18-004F-4EC5-812C-ED8A775C28E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {04039A18-004F-4EC5-812C-ED8A775C28E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {04039A18-004F-4EC5-812C-ED8A775C28E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {04039A18-004F-4EC5-812C-ED8A775C28E1}.Release|Any CPU.Build.0 = Release|Any CPU
25 | EndGlobalSection
26 | GlobalSection(SolutionProperties) = preSolution
27 | HideSolutionNode = FALSE
28 | EndGlobalSection
29 | EndGlobal
30 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace AgilePairingBacklog
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Content/people.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MahApps/Microsoft.DwayneNeed/bba80214c5e38cdef0b75d2ebb335bab7a7ecc43/src/AgilePairingBacklog/AgilePairingBacklog/Content/people.png
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Content/person.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MahApps/Microsoft.DwayneNeed/bba80214c5e38cdef0b75d2ebb335bab7a7ecc43/src/AgilePairingBacklog/AgilePairingBacklog/Content/person.png
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Content/tasks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MahApps/Microsoft.DwayneNeed/bba80214c5e38cdef0b75d2ebb335bab7a7ecc43/src/AgilePairingBacklog/AgilePairingBacklog/Content/tasks.png
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Models/AgilePairingBacklogProject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.ComponentModel;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace AgilePairingBacklog.Models
10 | {
11 | public class AgilePairingBacklogProject : ModelBase
12 | {
13 | private ObservableCollection teamMembers = new ObservableCollection();
14 | private ObservableCollection tasks = new ObservableCollection();
15 |
16 | public ObservableCollection TeamMembers
17 | {
18 | get
19 | {
20 | return this.teamMembers;
21 | }
22 | }
23 |
24 | public ObservableCollection Tasks
25 | {
26 | get
27 | {
28 | return this.tasks;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Models/ModelBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace AgilePairingBacklog.Models
9 | {
10 | public class ModelBase : INotifyPropertyChanged
11 | {
12 | public event PropertyChangedEventHandler PropertyChanged;
13 |
14 | protected bool SetValue(string name, ref T storage, T value)
15 | {
16 | // Use the dynamic keyword to enable the use of operators like "!=".
17 | dynamic dStorage = storage;
18 |
19 | if (dStorage != value)
20 | {
21 | storage = value;
22 | RaisePropertyChanged(name);
23 |
24 | return true;
25 | }
26 |
27 | return false;
28 | }
29 |
30 | protected void RaisePropertyChanged(string name)
31 | {
32 | PropertyChangedEventHandler handler = PropertyChanged;
33 | if (handler != null)
34 | {
35 | handler(this, new PropertyChangedEventArgs(name));
36 | }
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Models/Pairing.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgilePairingBacklog.Models
8 | {
9 | public class Pairing : ModelBase
10 | {
11 | private Person firstPerson;
12 | private Person secondPerson;
13 | private Task task;
14 |
15 | public Person FirstPerson
16 | {
17 | get
18 | {
19 | return this.firstPerson;
20 | }
21 |
22 | set
23 | {
24 | base.SetValue("FirstPerson", ref this.firstPerson, value);
25 | }
26 | }
27 |
28 | public Person SecondPerson
29 | {
30 | get
31 | {
32 | return this.secondPerson;
33 | }
34 |
35 | set
36 | {
37 | base.SetValue("SecondPerson", ref this.secondPerson, value);
38 | }
39 | }
40 |
41 | public Task Task
42 | {
43 | get
44 | {
45 | return this.task;
46 | }
47 |
48 | set
49 | {
50 | base.SetValue("Task", ref this.task, value);
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Models/TaskStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgilePairingBacklog.Models
8 | {
9 | public enum TaskStatus
10 | {
11 | Proposed,
12 | Active,
13 | Blocked,
14 | Review,
15 | Completed
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34003
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 AgilePairingBacklog.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 |
--------------------------------------------------------------------------------
/src/AgilePairingBacklog/AgilePairingBacklog/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/CustomBitmapDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/CustomBitmapDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Windows;
6 |
7 | namespace CustomBitmapDemo
8 | {
9 | ///
10 | /// Interaction logic for App.xaml
11 | ///
12 | public partial class App : Application
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/CustomBitmapDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
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 CustomBitmapDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/CustomBitmapDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/CustomBitmapDemo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/D2DSamples/D2DSamples.cpp:
--------------------------------------------------------------------------------
1 | // D2DSamples.cpp : Defines the exported functions for the DLL application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/D2DSamples/D2DSamples.def:
--------------------------------------------------------------------------------
1 | LIBRARY "D2DSamples.dll"
2 |
3 | EXPORTS
4 | CreateDemoHelloWorldApp
5 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/D2DSamples/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | BOOL APIENTRY DllMain( HMODULE hModule,
5 | DWORD ul_reason_for_call,
6 | LPVOID lpReserved
7 | )
8 | {
9 | switch (ul_reason_for_call)
10 | {
11 | case DLL_PROCESS_ATTACH:
12 | case DLL_THREAD_ATTACH:
13 | case DLL_THREAD_DETACH:
14 | case DLL_PROCESS_DETACH:
15 | break;
16 | }
17 | return TRUE;
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/D2DSamples/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // D2DSamples.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/D2DSamples/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace DemoApp
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/AirspaceDemoMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DemoApp.Demos.Airspace
7 | {
8 | public enum AirspaceDemoMode
9 | {
10 | None,
11 | Clipping,
12 | Redirection,
13 | Custom
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/D2DSample.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/D2DSample.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 | using Microsoft.DwayneNeed.Interop;
17 | using Microsoft.DwayneNeed.Win32.User32;
18 |
19 | namespace DemoApp.Demos.Airspace
20 | {
21 | ///
22 | /// Interaction logic for D2DSample.xaml
23 | ///
24 | public partial class D2DSample : Grid
25 | {
26 | public D2DSample()
27 | {
28 | InitializeComponent();
29 |
30 | // TODO: DestroyWindow
31 | CallbackHwndHost hwndHost = new CallbackHwndHost((parent) => CreateDemoHelloWorldApp(parent), (hwnd) => { });
32 |
33 | TheGrid.Children.Add(hwndHost);
34 | }
35 |
36 | [DllImport("D2DSamples.dll")]
37 | private static extern HWND CreateDemoHelloWorldApp(HWND parent);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/Model/MdiDemoColorGridContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls.Primitives;
6 | using System.Windows.Media;
7 |
8 | namespace DemoApp.Demos.Airspace.Model
9 | {
10 | public class MdiDemoColorGridContent : MdiDemoContent
11 | {
12 | #region NumElements
13 | ///
14 | /// The number of cells in the color grid.
15 | ///
16 | public int NumberOfCells
17 | {
18 | get { return _numberOfCells; }
19 | set
20 | {
21 | SetValue("NumberOfCells", ref _numberOfCells, value);
22 | }
23 | }
24 |
25 | private int _numberOfCells;
26 | #endregion
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/Model/MdiDemoCommands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 |
7 | namespace DemoApp.Demos.Airspace.Model
8 | {
9 | public static class MdiDemoCommands
10 | {
11 | public static RoutedCommand NewWorkspace = new RoutedCommand("NewWorkspace", typeof(MdiDemoCommands));
12 | public static RoutedCommand OpenWorkspace = new RoutedCommand("OpenWorkspace", typeof(MdiDemoCommands));
13 | public static RoutedCommand SaveWorkspace = new RoutedCommand("SaveWorkspace", typeof(MdiDemoCommands));
14 | public static RoutedCommand SaveWorkspaceAs = new RoutedCommand("SaveWorkspaceAs", typeof(MdiDemoCommands));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/Model/MdiDemoContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using DemoApp.Model;
6 | using System.Windows;
7 |
8 | namespace DemoApp.Demos.Airspace.Model
9 | {
10 | public class MdiDemoContent : ModelBase
11 | {
12 | #region WindowRect
13 | public Rect WindowRect
14 | {
15 | get { return _windowRect; }
16 | set { SetValue("WindowRect", ref _windowRect, value); }
17 | }
18 |
19 | private Rect _windowRect = new Rect(0,0,300,200);
20 | #endregion
21 |
22 | #region Title
23 | public string Title
24 | {
25 | get { return _title; }
26 | set { SetValue("Title", ref _title, value); }
27 | }
28 |
29 | private string _title = String.Empty;
30 | #endregion
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/Model/MdiDemoPageContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DemoApp.Demos.Airspace.Model
7 | {
8 | public class MdiDemoPageContent : MdiDemoContent
9 | {
10 | public Uri Uri
11 | {
12 | get { return _uri; }
13 | set { SetValue("Uri", ref _uri, value); }
14 | }
15 |
16 | private Uri _uri;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/Topic.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/Topic.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace DemoApp.Demos.Airspace
16 | {
17 | ///
18 | /// Interaction logic for Topic.xaml
19 | ///
20 | public partial class Topic : DemoApp.Model.Topic
21 | {
22 | public Topic()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WPFCubes.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace DemoApp.Demos.Airspace
16 | {
17 | ///
18 | /// Interaction logic for WPFCubes.xaml
19 | ///
20 | public partial class WPFCubes : Grid
21 | {
22 | public WPFCubes()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WPFDataForm.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WPFDataForm.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace DemoApp.Demos.Airspace
16 | {
17 | ///
18 | /// Interaction logic for WPFDataForm.xaml
19 | ///
20 | public partial class WPFDataForm : Grid
21 | {
22 | public WPFDataForm()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WPFMediaElement.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | C:\Users\Public\Videos\Sample Videos\Wildlife.wmv
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WPFWebBrowser.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | http://www.bing.com
12 | http://www.youtube.com
13 | http://www.google.com
14 | http://www.msn.com
15 | http://www.msnbc.com
16 | http://ie.microsoft.com/testdrive
17 | http://www.youtube.com/watch?v=jYa1eI1hpDE&ob=av2e
18 | http://www.chriscavanagh.com/Chris/CJC.Bullet/BulletDemo1.xbap
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsCalendar.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsCalendar.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Windows.Forms.Integration;
15 |
16 | namespace DemoApp.Demos.Airspace
17 | {
18 | ///
19 | /// Interaction logic for WinFormsCalendar.xaml
20 | ///
21 | public partial class WinFormsCalendar : WindowsFormsHost
22 | {
23 | public WinFormsCalendar()
24 | {
25 | System.Windows.Forms.Application.EnableVisualStyles();
26 | PropertyMap.Remove("Background");
27 | EnableWindowsFormsInterop();
28 |
29 | InitializeComponent();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsDataForm.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsDataForm.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Windows.Forms.Integration;
15 |
16 | namespace DemoApp.Demos.Airspace
17 | {
18 | ///
19 | /// Interaction logic for WinFormsMix.xaml
20 | ///
21 | public partial class WinFormsDataForm : WindowsFormsHost
22 | {
23 | public WinFormsDataForm()
24 | {
25 | System.Windows.Forms.Application.EnableVisualStyles();
26 | PropertyMap.Remove("Background");
27 | EnableWindowsFormsInterop();
28 |
29 | InitializeComponent();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsMediaPlayer.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsMix.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Demos/Airspace/WinFormsMix.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Windows.Forms.Integration;
15 |
16 | namespace DemoApp.Demos.Airspace
17 | {
18 | ///
19 | /// Interaction logic for WinFormsMix.xaml
20 | ///
21 | public partial class WinFormsMix : WindowsFormsHost
22 | {
23 | public WinFormsMix()
24 | {
25 | System.Windows.Forms.Application.EnableVisualStyles();
26 | PropertyMap.Remove("Background");
27 | EnableWindowsFormsInterop();
28 |
29 | InitializeComponent();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace DemoApp
16 | {
17 | ///
18 | /// Interaction logic for MainPage.xaml
19 | ///
20 | public partial class MainPage : Page
21 | {
22 | public MainPage()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 | using System.Windows.Navigation;
14 |
15 | namespace DemoApp
16 | {
17 | public partial class MainWindow : NavigationWindow
18 | {
19 | public MainWindow()
20 | {
21 | InitializeComponent();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Model/Index.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Collections.ObjectModel;
6 | using System.Windows.Markup;
7 |
8 | namespace DemoApp.Model
9 | {
10 | [ContentProperty("Topics")]
11 | public class Index : ModelBase
12 | {
13 | public ObservableCollection Topics { get { return _topics; } }
14 |
15 | private ObservableCollection _topics = new ObservableCollection();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Model/ModelBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.ComponentModel;
6 |
7 | namespace DemoApp.Model
8 | {
9 | public class ModelBase : INotifyPropertyChanged
10 | {
11 | public event PropertyChangedEventHandler PropertyChanged;
12 |
13 | protected bool SetValue(string name, ref T storage, T value)
14 | {
15 | // Use the dynamic keyword to enable the use of operators like "!=".
16 | dynamic dStorage = storage;
17 |
18 | if (dStorage != value)
19 | {
20 | storage = value;
21 | RaisePropertyChanged(name);
22 |
23 | return true;
24 | }
25 |
26 | return false;
27 | }
28 |
29 | protected void RaisePropertyChanged(string name)
30 | {
31 | PropertyChangedEventHandler handler = PropertyChanged;
32 | if (handler != null)
33 | {
34 | handler(this, new PropertyChangedEventArgs(name));
35 | }
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Model/Topic.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Documents;
6 | using System.Windows.Markup;
7 |
8 | namespace DemoApp.Model
9 | {
10 | [ContentProperty("Summary")]
11 | public class Topic : ModelBase
12 | {
13 | public string Title { get { return _title; } set { SetValue("Title", ref _title, value); } }
14 | public DateTime PublishDate { get { return _publishDate; } set { SetValue("PublishDate", ref _publishDate, value); } }
15 | public string Summary { get { return _summary; } set { SetValue("Summary", ref _summary, value); } }
16 | public Uri DemoUri { get { return _demoUri; } set { SetValue("DemoUri", ref _demoUri, value); } }
17 | public Uri BlogUri { get { return _blogUri; } set { SetValue("BlogUri", ref _blogUri, value); } }
18 | public Uri CodeUri { get { return _codeUri; } set { SetValue("CodeUri", ref _codeUri, value); } }
19 |
20 | private string _title;
21 | private DateTime _publishDate;
22 | private string _summary = String.Empty;
23 | private Uri _demoUri;
24 | private Uri _blogUri;
25 | private Uri _codeUri;
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.17929
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 DemoApp.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/DemoApp/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/ExpressionTest/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ExpressionTest
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | ValueExpression a = new ValueExpression(5);
13 | ValueExpression b = new ValueExpression(6);
14 | object c = a + b;
15 |
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/ExpressionTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ExpressionTest")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft IT")]
12 | [assembly: AssemblyProduct("ExpressionTest")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f8517bb8-00ab-4b48-835c-958b839e4b96")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/ExpressionTest/ValueExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ExpressionTest
7 | {
8 | // Eventually consider a family of classes/interfaces:
9 | //
10 | // IValueExpression (GetValue).
11 | // IChangeableValueExpression (Changed event)
12 | // I
13 |
14 | class ValueExpression
15 | {
16 | public ValueExpression(T value)
17 | {
18 | _value = value;
19 | }
20 |
21 | public static implicit operator T(ValueExpression valueExpression)
22 | {
23 | return valueExpression._value;
24 | }
25 |
26 | private T _value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/ExpressionTest/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/GlobeDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/GlobeDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace GlobeDemo
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/GlobeDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
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 GlobeDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/GlobeDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/GlobeDemo/WorldMap.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace GlobeDemo
16 | {
17 | ///
18 | /// Interaction logic for WorldMap.xaml
19 | ///
20 | public partial class WorldMap : UserControl
21 | {
22 | public WorldMap()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/GlobeDemo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace HierarchicalDataDemo
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
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 HierarchicalDataDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/Window1.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Diagnostics;
15 |
16 | namespace HierarchicalDataDemo
17 | {
18 | ///
19 | /// Interaction logic for Window1.xaml
20 | ///
21 | public partial class Window1 : Window
22 | {
23 | public Window1()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | private void Button_Click(object sender, RoutedEventArgs e)
29 | {
30 | HeiankyoView h = new HeiankyoView();
31 | Rect rc1 = h.Add(new Size(4, 2));
32 | Rect rc2 = h.Add(new Size(2, 4));
33 | Rect rc3 = h.Add(new Size(2, 2));
34 | Debug.WriteLine(rc1);
35 | Debug.WriteLine("done");
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/HierarchicalDataDemo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive.Contract/IMutableValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.DwayneNeed.Reactive.Contract
8 | {
9 | ///
10 | /// Represents a value that can be changed as well as observed.
11 | ///
12 | /// The value type.
13 | public interface IMutableValue : IObservableValue
14 | {
15 | ///
16 | /// Sets the current value.
17 | ///
18 | /// The value to be set.
19 | void SetValue(T value);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive.Contract/IObservableValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.DwayneNeed.Reactive.Contract
8 | {
9 | ///
10 | /// Represents a value that can be observed.
11 | ///
12 | /// The value type.
13 | public interface IObservableValue
14 | {
15 | ///
16 | /// Returns the current value.
17 | ///
18 | T GetValue();
19 |
20 | ///
21 | /// Presents a sequence of values as the value changes.
22 | ///
23 | ///
24 | /// When an observer subscribes, they will be notified of the current
25 | /// value. The sequence may complete if the value is guaranteed not
26 | /// to change.
27 | ///
28 | IObservable Changed { get; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive.Contract/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Microsoft.DwayneNeed.Reactive.Contract")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Microsoft.DwayneNeed.Reactive.Contract")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ab65b3cf-ce1c-4e31-9eba-9c1be548b9a8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive.UnitTests/ConstantValueTests.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using FluentAssertions;
8 | using Microsoft.DwayneNeed.Reactive.Contract;
9 |
10 | namespace Microsoft.DwayneNeed.Reactive.UnitTests
11 | {
12 | [TestClass]
13 | public class ConstantValueTests
14 | {
15 | [TestMethod]
16 | public void ConstantValueShouldReturnValuePassedToConstructor()
17 | {
18 | var value = new ConstantValue(10);
19 | var changedValues = new List();
20 | var changedCompleted = false;
21 |
22 | value.Changed.Subscribe((v) => changedValues.Add(v), () => changedCompleted = true);
23 |
24 | value.GetValue().Should().Be(10);
25 | changedValues.Count.Should().Be(1);
26 | changedValues[0].Should().Be(10);
27 | changedCompleted.Should().BeTrue();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive.UnitTests/ObservableMethodExpressionTests.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Microsoft.DwayneNeed.Reactive.UnitTests
9 | {
10 | [TestClass]
11 | public class ObservableMethodExpressionTests
12 | {
13 | [TestMethod]
14 | public void TryItOut()
15 | {
16 | var sampleClass = new SampleClass(10);
17 | var observableMethodExpression = new ObservableExpression(() => sampleClass.Method());
18 | }
19 |
20 | private class SampleClass
21 | {
22 | public SampleClass(int value)
23 | {
24 | this.Field = value;
25 | }
26 |
27 | public int Field;
28 |
29 | public int Property
30 | {
31 | get
32 | {
33 | return this.Field;
34 | }
35 |
36 | set
37 | {
38 | this.Field = value;
39 | }
40 | }
41 |
42 | public int Method()
43 | {
44 | return this.Property;
45 | }
46 |
47 | public void Method(int value)
48 | {
49 | this.Property = value;
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive.UnitTests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive/ConstantValue.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DwayneNeed.Reactive.Contract;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Reactive.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Microsoft.DwayneNeed.Reactive
10 | {
11 | ///
12 | /// ConstantValue implements the IObservableValue interface for a value
13 | /// that cannot change.
14 | ///
15 | /// The value type.
16 | public class ConstantValue : IObservableValue
17 | {
18 | private T value;
19 | private IObservable changed;
20 |
21 | public ConstantValue(T value)
22 | {
23 | this.value = value;
24 | this.changed = Observable.Return(this.value);
25 | }
26 |
27 | public T GetValue()
28 | {
29 | return this.value;
30 | }
31 |
32 | public IObservable Changed
33 | {
34 | get
35 | {
36 | return this.changed;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive/ObservableExpression.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DwayneNeed.Reactive.Contract;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Linq.Expressions;
8 |
9 | namespace Microsoft.DwayneNeed.Reactive
10 | {
11 | public class ObservableExpression : IObservableValue
12 | {
13 | public ObservableExpression(Expression> expression)
14 | {
15 | Expression body = expression.Body;
16 | if (body.NodeType != ExpressionType.Call)
17 | {
18 | throw new ArgumentException("The Expression must be a method call.");
19 | }
20 |
21 | MethodCallExpression methodCall = body as MethodCallExpression;
22 | }
23 |
24 | public T GetValue()
25 | {
26 | throw new NotImplementedException();
27 | }
28 |
29 |
30 | public IObservable Changed
31 | {
32 | get { throw new NotImplementedException(); }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Microsoft.DwayneNeed.Reactive")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Microsoft.DwayneNeed.Reactive")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("41443a06-1147-4c4d-aa25-cb0771ba0057")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive/ReadOnlyValue.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DwayneNeed.Reactive.Contract;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Reactive.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Microsoft.DwayneNeed.Reactive
10 | {
11 | ///
12 | /// ReadOnlyValue exposes only the IObservableValue interface.
13 | ///
14 | /// The value type.
15 | public class ReadOnlyValue : IObservableValue
16 | {
17 | private IObservableValue value;
18 |
19 | public ReadOnlyValue(IObservableValue value)
20 | {
21 | if (value == null)
22 | {
23 | throw new ArgumentNullException("value");
24 | }
25 |
26 | this.value = value;
27 | }
28 |
29 | public T GetValue()
30 | {
31 | return this.value.GetValue();
32 | }
33 |
34 | public IObservable Changed
35 | {
36 | get
37 | {
38 | return this.value.Changed;
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive/ValueExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.DwayneNeed.Reactive.Contract;
7 |
8 | namespace Microsoft.DwayneNeed.Reactive
9 | {
10 | public static class ValueExtensions
11 | {
12 | public static ReadOnlyValue AsReadOnly(this IObservableValue value)
13 | {
14 | return new ReadOnlyValue(value);
15 | }
16 |
17 | public static ConstantValue AsConstant(this IObservableValue value)
18 | {
19 | return new ConstantValue(value.GetValue());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Reactive/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/ComCtl32/SUBCLASSPROC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Win32.User32;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.ComCtl32
8 | {
9 | // It would be great to use the HWND type for hwnd, but this is not
10 | // possible because you will get a MarshalDirectiveException complaining
11 | // that the unmanaged code cannot pass in a SafeHandle. This is because
12 | // native code is calling this callback, and native code doesn't know how
13 | // to create a managed SafeHandle for the native handle. I was a little
14 | // surprised that the marshaller can't do this automatically, but
15 | // apparently it can't.
16 | //
17 | // Instead, most classes that use a SUBCLASSPROC will expose their own
18 | // virtual that creates new HWND instances for the incomming handles.
19 | public delegate IntPtr SUBCLASSPROC(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, IntPtr id, IntPtr data);
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/ComCtl32/StrongHWNDSubclass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Win32.User32;
6 | using Microsoft.DwayneNeed.Win32;
7 |
8 | namespace Microsoft.DwayneNeed.Win32.ComCtl32
9 | {
10 | internal class StrongHWNDSubclass : WindowSubclass
11 | {
12 |
13 | public StrongHWNDSubclass(StrongHWND strongHwnd) : base(new HWND(strongHwnd.DangerousGetHandle()))
14 | {
15 | // Note that we passed a new "weak" HWND handle to the base class.
16 | // This is because we don't want the StrongHWNDSubclass processing
17 | // a partially disposed handle in its own Dispose methods.
18 | _strongHwnd = strongHwnd;
19 | }
20 |
21 | protected override void Dispose(bool disposing)
22 | {
23 | // call the base class to let it disconnect the window proc.
24 | HWND hwnd = Hwnd;
25 | base.Dispose(disposing);
26 |
27 | NativeMethods.DestroyWindow(hwnd);
28 | _strongHwnd.OnHandleReleased();
29 | }
30 |
31 | private StrongHWND _strongHwnd;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Documentation/API.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MahApps/Microsoft.DwayneNeed/bba80214c5e38cdef0b75d2ebb335bab7a7ecc43/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Documentation/API.xlsx
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Documentation/readme.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MahApps/Microsoft.DwayneNeed/bba80214c5e38cdef0b75d2ebb335bab7a7ecc43/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Documentation/readme.docx
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/DwmApi/DWM_EC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.DwmApi
7 | {
8 | public enum DWM_EC : int
9 | {
10 | DISABLECOMPOSITION = 0,
11 | ENABLECOMPOSITION = 1
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/BI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | ///
9 | /// Constants for the BITMAPINFO biCompression field
10 | ///
11 | public enum BI : int
12 | {
13 | RGB = 0,
14 | RLE8 = 1,
15 | RLE4 = 2,
16 | BITFIELDS = 3,
17 | JPEG = 4,
18 | PNG = 5
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/BITMAPINFO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.Gdi32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct BITMAPINFO
11 | {
12 | public Int32 biSize;
13 | public Int32 biWidth;
14 | public Int32 biHeight;
15 | public Int16 biPlanes;
16 | public Int16 biBitCount;
17 | public BI biCompression;
18 | public Int32 biSizeImage;
19 | public Int32 biXPelsPerMeter;
20 | public Int32 biYPelsPerMeter;
21 | public Int32 biClrUsed;
22 | public Int32 biClrImportant;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/BKMODE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public enum BKMODE : int
9 | {
10 | TRANSPARENT = 1,
11 | OPAQUE = 2
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/CHARSET.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public enum CHARSET : int
9 | {
10 | ANSI = 0,
11 | DEFAULT = 1,
12 | SYMBOL = 2,
13 | SHIFTJIS = 128,
14 | HANGEUL = 129,
15 | HANGUL = 129,
16 | GB2312 = 134,
17 | CHINESEBIG5 = 136,
18 | OEM = 255,
19 | JOHAB = 130,
20 | HEBREW = 177,
21 | ARABIC = 178,
22 | GREEK = 161,
23 | TURKISH = 162,
24 | VIETNAMESE = 163,
25 | THAI = 222,
26 | EASTEUROPE = 238,
27 | RUSSIAN = 204,
28 | MAC = 77,
29 | BALTIC = 186
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/COLORREF.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public struct COLORREF
9 | {
10 | public COLORREF(uint cr)
11 | {
12 | _value = cr;
13 | }
14 |
15 | public COLORREF(byte red, byte green, byte blue)
16 | {
17 | _value = (uint)(red | ((short)green) << 8 | ((int)blue) << 16);
18 | }
19 |
20 | public uint Value
21 | {
22 | get
23 | {
24 | return _value;
25 | }
26 | }
27 |
28 | private uint _value;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/DIB.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | ///
9 | /// DIB color table identifiers
10 | ///
11 | public enum DIB : int
12 | {
13 | RGB_COLORS = 0, /* color table in RGBs */
14 | PAL_COLORS = 1 /* color table in palette indices */
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/FF.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public enum FF : int
9 | {
10 | ///
11 | /// Use default font.
12 | ///
13 | DONTCARE = (0<<4),
14 |
15 | ///
16 | /// Fonts with variable stroke width and with serifs. MS Serif is an
17 | /// example.
18 | ///
19 | ROMAN = (1<<4),
20 |
21 | ///
22 | /// Fonts with variable stroke width and without serifs. MS Sans Serif
23 | /// is an example.
24 | ///
25 | SWISS = (2<<4),
26 |
27 | ///
28 | /// Fonts with constant stroke width, with or without serifs. Pica,
29 | /// Elite, and Courier New are examples.
30 | ///
31 | MODERN = (3<<4),
32 |
33 | ///
34 | /// Fonts designed to look like handwriting. Script and Cursive are
35 | /// examples.
36 | ///
37 | SCRIPT = (4<<4),
38 |
39 | ///
40 | /// Novelty fonts. Old English is an example.
41 | ///
42 | DECORATIVE = (5<<4)
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/FW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public enum FW : int
9 | {
10 | DONTCARE = 0,
11 | THIN = 100,
12 | EXTRALIGHT = 200,
13 | ULTRALIGHT = 200,
14 | LIGHT = 300,
15 | NORMAL = 400,
16 | REGULAR = 400,
17 | MEDIUM = 500,
18 | SEMIBOLD = 600,
19 | DEMIBOLD = 600,
20 | BOLD = 700,
21 | EXTRABOLD = 800,
22 | ULTRABOLD = 800,
23 | HEAVY = 900,
24 | BLACK = 900
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/HBRUSH.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Microsoft.DwayneNeed.Win32.Gdi32
9 | {
10 | public class HBRUSH : HGDIOBJ
11 | {
12 | private HBRUSH()
13 | {
14 | }
15 |
16 | public HBRUSH(IntPtr handle)
17 | {
18 | SetHandle(handle);
19 | }
20 |
21 | public HBRUSH(COLORREF color)
22 | {
23 | HBRUSH hbrush = CreateSolidBrush(color.Value);
24 | this.SetHandle(hbrush.DangerousGetHandle());
25 | this.DangerousOwnsHandle = true;
26 | }
27 |
28 | #region PInvoke
29 | [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
30 | private static extern HBRUSH CreateSolidBrush(uint color);
31 | #endregion
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/OBJ.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.Gdi32
8 | {
9 | ///
10 | /// The type of a GDI object.
11 | ///
12 | public enum OBJ : int
13 | {
14 | PEN = 1,
15 | BRUSH = 2,
16 | DC = 3,
17 | METADC = 4,
18 | PAL = 5,
19 | FONT = 6,
20 | BITMAP = 7,
21 | REGION = 8,
22 | METAFILE = 9,
23 | MEMDC = 10,
24 | EXTPEN = 11,
25 | ENHMETADC = 12,
26 | ENHMETAFILE = 13,
27 | COLORSPACE = 14
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/PITCH.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public enum PITCH : int
9 | {
10 | DEFAULT = 0,
11 | FIXED = 1,
12 | VARIABLE = 2
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/PITCH_FF.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | ///
9 | /// A union of a PITCH and a FF value.
10 | ///
11 | public struct PITCH_FF
12 | {
13 | public PITCH_FF(PITCH pitch = PITCH.DEFAULT, FF family = FF.DONTCARE)
14 | {
15 | _value = (int)pitch | (int)family;
16 | }
17 |
18 | public static implicit operator PITCH_FF(PITCH pitch)
19 | {
20 | return new PITCH_FF(pitch);
21 | }
22 |
23 | public static implicit operator PITCH_FF(FF family)
24 | {
25 | return new PITCH_FF(PITCH.DEFAULT, family);
26 | }
27 |
28 | public int Value
29 | {
30 | get
31 | {
32 | return _value;
33 | }
34 | }
35 |
36 | private int _value;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Gdi32/ROP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Gdi32
7 | {
8 | public enum ROP : int
9 | {
10 | SRCCOPY = 0x00CC0020, // dest = source
11 | SRCPAINT = 0x00EE0086, // dest = source OR dest
12 | SRCAND = 0x008800C6, // dest = source AND dest
13 | SRCINVERT = 0x00660046, // dest = source XOR dest
14 | SRCERASE = 0x00440328, // dest = source AND (NOT dest)
15 | NOTSRCCOPY = 0x00330008, // dest = (NOT source)
16 | NOTSRCERASE = 0x001100A6, // dest = (NOT src) AND (NOT dest)
17 | MERGECOPY = 0x00C000CA, // dest = (source AND pattern)
18 | MERGEPAINT = 0x00BB0226, // dest = (NOT source) OR dest
19 | PATCOPY = 0x00F00021, // dest = pattern
20 | PATPAINT = 0x00FB0A09, // dest = DPSnoo
21 | PATINVERT = 0x005A0049, // dest = pattern XOR dest
22 | DSTINVERT = 0x00550009, // dest = (NOT dest)
23 | BLACKNESS = 0x00000042, // dest = BLACK
24 | WHITENESS = 0x00FF0062, // dest = WHITE
25 | NOMIRRORBITMAP = unchecked((int)0x80000000), // Do not Mirror the bitmap in this call
26 | CAPTUREBLT = 0x40000000, // Include layered windows
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Kernel32/MEM.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Kernel32
7 | {
8 | public enum MEM : int
9 | {
10 | COMMIT = 0x1000,
11 | RESERVE = 0x2000,
12 | DECOMMIT = 0x4000,
13 | RELEASE = 0x8000,
14 | FREE = 0x10000,
15 | PRIVATE = 0x20000,
16 | MAPPED = 0x40000,
17 | RESET = 0x80000,
18 | TOP_DOWN = 0x100000,
19 | WRITE_WATCH = 0x200000,
20 | PHYSICAL = 0x400000,
21 | ROTATE = 0x800000,
22 | IMAGE = 0x1000000,
23 | LARGE_PAGES = 0x20000000,
24 | FOUR_MB_PAGES = unchecked((int)0x80000000) // slight rename because it can't start with a digit
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Kernel32/PAGE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Kernel32
7 | {
8 | public enum PAGE : int
9 | {
10 | NOACCESS = 0x01,
11 | READONLY = 0x02,
12 | READWRITE = 0x04,
13 | WRITECOPY = 0x08,
14 | EXECUTE = 0x10,
15 | EXECUTE_READ = 0x20,
16 | EXECUTE_READWRITE = 0x40,
17 | EXECUTE_WRITECOPY = 0x80,
18 | GUARD = 0x100,
19 | NOCACHE = 0x200,
20 | WRITECOMBINE = 0x400
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Kernel32/SEC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.Kernel32
7 | {
8 | [Flags]
9 | public enum SEC : int
10 | {
11 | NONE = 0, // optional
12 | FILE = 0x800000,
13 | IMAGE = 0x1000000,
14 | PROTECTED_IMAGE = 0x2000000,
15 | RESERVE = 0x4000000,
16 | COMMIT = 0x8000000,
17 | NOCACHE = 0x10000000,
18 | WRITECOMBINE = 0x40000000,
19 | LARGE_PAGES = unchecked((int)0x80000000)
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Kernel32/SYSTEM_INFO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.Kernel32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct SYSTEM_INFO
11 | {
12 | internal _PROCESSOR_INFO_UNION uProcessorInfo;
13 | public uint dwPageSize;
14 | public IntPtr lpMinimumApplicationAddress;
15 | public IntPtr lpMaximumApplicationAddress;
16 | public IntPtr dwActiveProcessorMask;
17 | public uint dwNumberOfProcessors;
18 | public uint dwProcessorType;
19 | public uint dwAllocationGranularity;
20 | public ushort dwProcessorLevel;
21 | public ushort dwProcessorRevision;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Kernel32/_PROCESSOR_INFO_UNION.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.Kernel32
8 | {
9 | [StructLayout(LayoutKind.Explicit)]
10 | public struct _PROCESSOR_INFO_UNION
11 | {
12 | [FieldOffset(0)]
13 | internal uint dwOemId;
14 | [FieldOffset(0)]
15 | internal ushort wProcessorArchitecture;
16 | [FieldOffset(2)]
17 | internal ushort wReserved;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/NativeMacros.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DwayneNeed.Win32.Gdi32;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Win32
8 | {
9 | public static class NativeMacros
10 | {
11 | public static ushort HIWORD(uint dword)
12 | {
13 | return (ushort)((dword >> 16) & 0xFFFF);
14 | }
15 |
16 | public static ushort LOWORD(uint dword)
17 | {
18 | return (ushort)dword;
19 | }
20 |
21 | public static int GET_X_LPARAM(uint dword)
22 | {
23 | return unchecked((int)(short)LOWORD(dword));
24 | }
25 |
26 | public static int GET_Y_LPARAM(uint dword)
27 | {
28 | return unchecked((int)(short)HIWORD(dword));
29 | }
30 |
31 | public static COLORREF RGB(byte r, byte g, byte b)
32 | {
33 | return new COLORREF(r, g, b);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Microsoft.DwayneNeed.Win32")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Microsoft.DwayneNeed.Win32")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fa0042ec-fcfe-4158-907c-e942202499a5")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/UrlMon/INTERNETFEATURELIST.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.UrlMon
7 | {
8 | public enum INTERNETFEATURELIST
9 | {
10 | OBJECT_CACHING = 0,
11 | ZONE_ELEVATION = 1,
12 | MIME_HANDLING = 2,
13 | MIME_SNIFFING = 3,
14 | WINDOW_RESTRICTIONS = 4,
15 | WEBOC_POPUPMANAGEMENT = 5,
16 | BEHAVIORS = 6,
17 | DISABLE_MK_PROTOCOL = 7,
18 | LOCALMACHINE_LOCKDOWN = 8,
19 | SECURITYBAND = 9,
20 | RESTRICT_ACTIVEXINSTALL = 10,
21 | VALIDATE_NAVIGATE_URL = 11,
22 | RESTRICT_FILEDOWNLOAD = 12,
23 | ADDON_MANAGEMENT = 13,
24 | PROTOCOL_LOCKDOWN = 14,
25 | HTTP_USERNAME_PASSWORD_DISABLE = 15,
26 | SAFE_BINDTOOBJECT = 16,
27 | UNC_SAVEDFILECHECK = 17,
28 | GET_URL_DOM_FILEPATH_UNENCODED = 18,
29 | TABBED_BROWSING = 19,
30 | SSLUX = 20,
31 | DISABLE_NAVIGATION_SOUNDS = 21,
32 | DISABLE_LEGACY_COMPRESSION = 22,
33 | FORCE_ADDR_AND_STATUS = 23,
34 | XMLHTTP = 24,
35 | DISABLE_TELNET_PROTOCOL = 25,
36 | FEEDS = 26,
37 | BLOCK_INPUT_PROMPTS = 27,
38 | //ENTRY_COUNT = 28
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/UrlMon/SET_FEATURE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.UrlMon
7 | {
8 | public enum SET_FEATURE
9 | {
10 | ON_THREAD = 0x00000001,
11 | ON_PROCESS = 0x00000002,
12 | IN_REGISTRY = 0x00000004,
13 | ON_THREAD_LOCALMACHINE = 0x00000008,
14 | ON_THREAD_INTRANET = 0x00000010,
15 | ON_THREAD_TRUSTED = 0x00000020,
16 | ON_THREAD_INTERNET = 0x00000040,
17 | ON_THREAD_RESTRICTED = 0x00000080
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/CS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Class styles
10 | ///
11 | public enum CS : int
12 | {
13 | VREDRAW = 0x0001,
14 | HREDRAW = 0x0002,
15 | DBLCLKS = 0x0008,
16 | OWNDC = 0x0020,
17 | CLASSDC = 0x0040,
18 | PARENTDC = 0x0080,
19 | NOCLOSE = 0x0200,
20 | SAVEBITS = 0x0800,
21 | BYTEALIGNCLIENT = 0x1000,
22 | BYTEALIGNWINDOW = 0x2000,
23 | GLOBALCLASS = 0x4000,
24 | IME = 0x00010000,
25 | DROPSHADOW = 0x00020000
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/DT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | [Flags]
9 | public enum DT : int
10 | {
11 | TOP = 0x00000000,
12 | LEFT = 0x00000000,
13 | CENTER = 0x00000001,
14 | RIGHT = 0x00000002,
15 | VCENTER = 0x00000004,
16 | BOTTOM = 0x00000008,
17 | WORDBREAK = 0x00000010,
18 | SINGLELINE = 0x00000020,
19 | EXPANDTABS = 0x00000040,
20 | TABSTOP = 0x00000080,
21 | NOCLIP = 0x00000100,
22 | EXTERNALLEADING = 0x00000200,
23 | CALCRECT = 0x00000400,
24 | NOPREFIX = 0x00000800,
25 | INTERNAL = 0x00001000
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/GA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// The "real" ancestor window
10 | ///
11 | public enum GA : int
12 | {
13 | PARENT = 1,
14 | ROOT = 2,
15 | ROOTOWNER = 3
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/GCL.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Class field offsets for GetClassLong
10 | ///
11 | public enum GCL : int
12 | {
13 | MENUNAME = -8,
14 | HBRBACKGROUND = -10,
15 | HCURSOR = -12,
16 | HICON = -14,
17 | HMODULE = -16,
18 | CBWNDEXTRA = -18,
19 | CBCLSEXTRA = -20,
20 | WNDPROC = -24,
21 | STYLE = -26,
22 | HICONSM = -34
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/GCW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Class field offsets for GetClassWord
10 | ///
11 | public enum GCW : int
12 | {
13 | ATOM = -32
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/GW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// GetWindow() Constants
10 | ///
11 | public enum GW : int
12 | {
13 | HWNDFIRST = 0,
14 | HWNDLAST = 1,
15 | HWNDNEXT = 2,
16 | HWNDPREV = 3,
17 | OWNER = 4,
18 | CHILD = 5,
19 | ENABLEDPOPUP = 6,
20 | MAX = 6
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/GWL.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Window field offsets for GetWindowLong
10 | ///
11 | public enum GWL : int
12 | {
13 | WNDPROC = -4,
14 | HINSTANCE = -6,
15 | HWNDPARENT = -8,
16 | STYLE = -16,
17 | EXSTYLE = -20,
18 | USERDATA = -21,
19 | ID = -12
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/HARDWAREINPUT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct HARDWAREINPUT
11 | {
12 | public int uMsg;
13 | public short wParamL;
14 | public short wParamH;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/INPUT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | // TODO: User32 names this enum type INPUT, which conflicts with the struct INPUT...
10 | public enum INPUTTYPE : int
11 | {
12 | MOUSE = 0,
13 | KEYBOARD = 1,
14 | HARDWARE = 2
15 | }
16 |
17 | [StructLayout(LayoutKind.Explicit)]
18 | public struct INPUT
19 | {
20 | [FieldOffset(0)]
21 | public INPUTTYPE type;
22 |
23 | [FieldOffset(4)]
24 | public MOUSEINPUT mouseInput;
25 |
26 | [FieldOffset(4)]
27 | public KEYBDINPUT keyboardInput;
28 |
29 | [FieldOffset(4)]
30 | public HARDWAREINPUT hardwareInput;
31 | } ;
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/KEYBDINPUT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct KEYBDINPUT
11 | {
12 | public short wVk;
13 | public short wScan;
14 | public KEYEVENTF dwFlags;
15 | public int time;
16 | public IntPtr dwExtraInfo;
17 | } ;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/KEYEVENTF.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | [Flags]
9 | public enum KEYEVENTF
10 | {
11 | ///
12 | /// If specified, the scan code was preceded by a prefix byte that
13 | /// has the value 0xE0 (224).
14 | ///
15 | EXTENDEDKEY = 0x0001,
16 |
17 | ///
18 | /// If specified, the key is being released. If not specified, the
19 | /// key is being pressed.
20 | ///
21 | KEYUP = 0x0002,
22 |
23 | ///
24 | /// If specified, wScan identifies the key and wVk is ignored.
25 | ///
26 | SCANCODE = 0x0008,
27 |
28 | ///
29 | /// If specified, the system synthesizes a VK_PACKET keystroke. The
30 | /// wVk parameter must be zero. This flag can only be combined with
31 | /// the KEYUP flag.
32 | ///
33 | UNICODE = 0x0004
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/LWA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Flags for SetLayeredWindowAttributes
10 | ///
11 | [Flags]
12 | public enum LWA : int
13 | {
14 | COLORKEY = 0x1,
15 | ALPHA = 0x2
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/MA.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// WM_MOUSEACTIVATE Return Codes
10 | ///
11 | public enum MA : int
12 | {
13 | ACTIVATE = 1,
14 | ACTIVATEANDEAT = 2,
15 | NOACTIVATE = 3,
16 | NOACTIVATEANDEAT = 4
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/MOUSEINPUT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct MOUSEINPUT
11 | {
12 | public int dx;
13 | public int dy;
14 | public int mouseData;
15 | public MOUSEEVENTF dwFlags;
16 | public int time;
17 | public IntPtr dwExtraInfo;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/POINT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 | using Microsoft.DwayneNeed.Win32;
7 |
8 | namespace Microsoft.DwayneNeed.Win32.User32
9 | {
10 | [StructLayout(LayoutKind.Sequential)]
11 | public struct POINT
12 | {
13 | public POINT(int x, int y)
14 | {
15 | this.x = x;
16 | this.y = y;
17 | }
18 |
19 | public static POINT FromParam(uint param)
20 | {
21 | int x = NativeMacros.GET_X_LPARAM(param);
22 | int y = NativeMacros.GET_Y_LPARAM(param);
23 |
24 | return new POINT(x, y);
25 | }
26 |
27 | public uint ToParam()
28 | {
29 | uint param_x = unchecked((ushort)(short)x);
30 | uint param_y = unchecked((ushort)(short)y);
31 |
32 | return (param_y << 16) | param_x;
33 | }
34 |
35 | public int x;
36 | public int y;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/PW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | public enum PW : int
9 | {
10 | DEFAULT = 0,
11 | CLIENTONLY =0x00000001
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/RDW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | public enum RDW : int
9 | {
10 | INVALIDATE = 0x0001,
11 | INTERNALPAINT = 0x0002,
12 | ERASE = 0x0004,
13 | VALIDATE = 0x0008,
14 | NOINTERNALPAINT = 0x0010,
15 | NOERASE = 0x0020,
16 | NOCHILDREN = 0x0040,
17 | ALLCHILDREN = 0x0080,
18 | UPDATENOW = 0x0100,
19 | ERASENOW = 0x0200,
20 | FRAME = 0x0400,
21 | NOFRAME = 0x0800
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/RECT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct RECT
11 | {
12 | public int left;
13 | public int top;
14 | public int right;
15 | public int bottom;
16 |
17 | public int width { get { return right - left; } }
18 | public int height { get { return bottom - top; } }
19 |
20 | public override string ToString()
21 | {
22 | return "(" + left + ", " + top + "), (" + width + " x " + height + ")";
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/SW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// ShowWindow() Commands
10 | ///
11 | public enum SW : int
12 | {
13 | HIDE = 0,
14 | SHOWNORMAL = 1,
15 | NORMAL = 1,
16 | SHOWMINIMIZED = 2,
17 | SHOWMAXIMIZED = 3,
18 | MAXIMIZE = 3,
19 | SHOWNOACTIVATE = 4,
20 | SHOW = 5,
21 | MINIMIZE = 6,
22 | SHOWMINNOACTIVE = 7,
23 | SHOWNA = 8,
24 | RESTORE = 9,
25 | SHOWDEFAULT = 10,
26 | FORCEMINIMIZE = 11,
27 | MAX = 11
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/SWP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// SetWindowPos Flags
10 | ///
11 | public enum SWP : int
12 | {
13 | NOSIZE = 0x0001,
14 | NOMOVE = 0x0002,
15 | NOZORDER = 0x0004,
16 | NOREDRAW = 0x0008,
17 | NOACTIVATE = 0x0010,
18 | FRAMECHANGED = 0x0020, /* The frame changed: send WM_NCCALCSIZE */
19 | SHOWWINDOW = 0x0040,
20 | HIDEWINDOW = 0x0080,
21 | NOCOPYBITS = 0x0100,
22 | NOOWNERZORDER = 0x0200, /* Don't do owner Z ordering */
23 | NOSENDCHANGING = 0x0400, /* Don't send WM_WINDOWPOSCHANGING */
24 | DRAWFRAME = FRAMECHANGED,
25 | NOREPOSITION = NOOWNERZORDER,
26 | DEFERERASE = 0x2000,
27 | ASYNCWINDOWPOS = 0x4000
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/TIMERPROC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | public delegate void TIMERPROC(IntPtr hwnd, int msg, IntPtr idEvent, int dwTime);
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/WINDOWPOS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct WINDOWPOS
11 | {
12 | public IntPtr hwnd;
13 | public IntPtr hwndInsertAfter;
14 | public int x;
15 | public int y;
16 | public int cx;
17 | public int cy;
18 | public SWP flags;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/WNDCLASSEX.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Microsoft.DwayneNeed.Win32.User32
8 | {
9 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
10 | public struct WNDCLASSEX
11 | {
12 | public int cbSize;
13 | public CS style;
14 | public WNDPROC lpfnWndProc;
15 | public int cbClsExtra;
16 | public int cbWndExtra;
17 | public IntPtr hInstance;
18 | public IntPtr hIcon;
19 | public IntPtr hCursor;
20 | public IntPtr hbrBackground;
21 | public IntPtr lpszMenuName;
22 | public string lpszClassName;
23 | public IntPtr hIconSm;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/WNDPROC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | // It would be great to use the HWND type for hwnd, but this is not
9 | // possible because you will get a MarshalDirectiveException complaining
10 | // that the unmanaged code cannot pass in a SafeHandle. Instead, most
11 | // classes that use a WNDPROC will expose its own virtual that creates
12 | // new HWND instances for the incomming handles.
13 | public delegate IntPtr WNDPROC(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam);
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/WS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Window Styles
10 | ///
11 | [Flags]
12 | public enum WS : int
13 | {
14 | OVERLAPPED = 00000000,
15 | POPUP = unchecked((int)0x80000000),
16 | CHILD = 0x40000000,
17 | MINIMIZE = 0x20000000,
18 | VISIBLE = 0x10000000,
19 | DISABLED = 0x08000000,
20 | CLIPSIBLINGS = 0x04000000,
21 | CLIPCHILDREN = 0x02000000,
22 | MAXIMIZE = 0x01000000,
23 | CAPTION = BORDER | DLGFRAME,
24 | BORDER = 0x00800000,
25 | DLGFRAME = 0x00400000,
26 | VSCROLL = 0x00200000,
27 | HSCROLL = 0x00100000,
28 | SYSMENU = 0x00080000,
29 | THICKFRAME = 0x00040000,
30 | GROUP = 0x00020000,
31 | TABSTOP = 0x00010000,
32 | MINIMIZEBOX = 0x00020000,
33 | MAXIMIZEBOX = 0x00010000,
34 | TILED = OVERLAPPED,
35 | ICONIC = MINIMIZE,
36 | SIZEBOX = THICKFRAME,
37 | TILEDWINDOW = OVERLAPPEDWINDOW,
38 | OVERLAPPEDWINDOW = OVERLAPPED | CAPTION | SYSMENU | THICKFRAME | MINIMIZEBOX | MAXIMIZEBOX,
39 | POPUPWINDOW = POPUP | BORDER | SYSMENU,
40 | CHILDWINDOW = CHILD
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed.Win32/User32/WS_EX.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Win32.User32
7 | {
8 | ///
9 | /// Extended Window Styles
10 | ///
11 | [Flags]
12 | public enum WS_EX
13 | {
14 | DLGMODALFRAME = 0x00000001,
15 | NOPARENTNOTIFY = 0x00000004,
16 | TOPMOST = 0x00000008,
17 | ACCEPTFILES = 0x00000010,
18 | TRANSPARENT = 0x00000020,
19 | MDICHILD = 0x00000040,
20 | TOOLWINDOW = 0x00000080,
21 | WINDOWEDGE = 0x00000100,
22 | CLIENTEDGE = 0x00000200,
23 | CONTEXTHELP = 0x00000400,
24 | RIGHT = 0x00001000,
25 | LEFT = 0x00000000,
26 | RTLREADING = 0x00002000,
27 | LTRREADING = 0x00000000,
28 | LEFTSCROLLBAR = 0x00004000,
29 | RIGHTSCROLLBAR = 0x00000000,
30 | CONTROLPARENT = 0x00010000,
31 | STATICEDGE = 0x00020000,
32 | APPWINDOW = 0x00040000,
33 | OVERLAPPEDWINDOW = (WINDOWEDGE | CLIENTEDGE),
34 | PALETTEWINDOW = (WINDOWEDGE | TOOLWINDOW | TOPMOST),
35 | LAYERED = 0x00080000,
36 | NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
37 | LAYOUTRTL = 0x00400000, // Right to left mirroring
38 | COMPOSITED = 0x02000000,
39 | NOACTIVATE = 0x08000000
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Controls/ChildWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace Microsoft.DwayneNeed.Controls
16 | {
17 | public class ChildWindow : Control
18 | {
19 | static ChildWindow()
20 | {
21 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ChildWindow), new FrameworkPropertyMetadata(typeof(ChildWindow)));
22 | }
23 |
24 | public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
25 | "Source",
26 | typeof(Uri),
27 | typeof(ChildWindow),
28 | new FrameworkPropertyMetadata(null));
29 |
30 | public Uri Source
31 | {
32 | get { return (Uri)GetValue(SourceProperty); }
33 | set { SetValue(SourceProperty, value); }
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Controls/IModalContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 |
7 | namespace Microsoft.DwayneNeed.Controls
8 | {
9 | public interface IModalContent
10 | {
11 | T Accept();
12 | void Cancel();
13 | FrameworkElement Content { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Converters/MdiWindowEdgeThicknessConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.MDI;
6 | using System.Globalization;
7 | using System.Windows.Data;
8 | using System.Windows;
9 |
10 | namespace Microsoft.DwayneNeed.Converters
11 | {
12 | [ValueConversion(typeof(Thickness), typeof(Thickness))]
13 | public class MdiWindowEdgeThicknessConverter : IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | Thickness thickness = (Thickness)value;
18 | MdiWindowEdge edges = (MdiWindowEdge)Enum.Parse(typeof(MdiWindowEdge), (string)parameter);
19 |
20 | if ((edges & MdiWindowEdge.Left) == 0)
21 | {
22 | thickness.Left = 0;
23 | }
24 | if ((edges & MdiWindowEdge.Top) == 0)
25 | {
26 | thickness.Top = 0;
27 | }
28 | if ((edges & MdiWindowEdge.Right) == 0)
29 | {
30 | thickness.Right = 0;
31 | }
32 | if ((edges & MdiWindowEdge.Bottom) == 0)
33 | {
34 | thickness.Bottom = 0;
35 | }
36 | return thickness;
37 | }
38 |
39 | public object ConvertBack(object value, Type targetType,
40 | object parameter, CultureInfo culture)
41 | {
42 | return null;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Converters/PixelGridLengthConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Data;
6 | using System.Windows;
7 | using System.Globalization;
8 |
9 | namespace Microsoft.DwayneNeed.Converters
10 | {
11 | [ValueConversion(typeof(double), typeof(GridLength))]
12 | public class PixelGridLengthConverter : IValueConverter
13 | {
14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15 | {
16 | return new GridLength((double)value, GridUnitType.Pixel);
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20 | {
21 | return ((GridLength)value).Value;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Converters/StarGridLengthConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Data;
7 | using System.Globalization;
8 |
9 | namespace Microsoft.DwayneNeed.Converters
10 | {
11 | [ValueConversion(typeof(double), typeof(GridLength))]
12 | public class StarGridLengthConverter : IValueConverter
13 | {
14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15 | {
16 | return new GridLength((double)value, GridUnitType.Star);
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20 | {
21 | return ((GridLength)value).Value;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Extensions/DispatcherExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Threading;
6 | using System.Runtime.InteropServices;
7 | using System.ComponentModel;
8 |
9 | namespace Microsoft.DwayneNeed.Extensions
10 | {
11 | public static class DispatcherExtensions
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Extensions/EventHandlerExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Extensions
7 | {
8 | public static class EventHandlerExtensions
9 | {
10 | public static void RaiseEvent(this EventHandler handler, object sender, T args) where T:EventArgs
11 | {
12 | if (handler != null)
13 | {
14 | handler(sender, args);
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Extensions/Int32CollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Media;
6 |
7 | namespace Microsoft.DwayneNeed.Extensions
8 | {
9 | public static class Int32CollectionExtensions
10 | {
11 | public static void Add(this Int32Collection _this, Tuple tuple)
12 | {
13 | _this.Add(tuple.Item1);
14 | _this.Add(tuple.Item2);
15 | _this.Add(tuple.Item3);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Extensions/Int32RectExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 |
7 | namespace Microsoft.DwayneNeed.Extensions
8 | {
9 | public static class Int32RectExtensions
10 | {
11 | public static Int32Rect Union(this Int32Rect rect1, Int32Rect rect2)
12 | {
13 | if (rect1.IsEmpty)
14 | {
15 | return rect2;
16 | }
17 | else if (rect2.IsEmpty)
18 | {
19 | return rect1;
20 | }
21 | else
22 | {
23 | int left = rect1.X < rect2.X ? rect1.X : rect2.X;
24 | int top = rect1.Y < rect2.Y ? rect1.Y : rect2.Y;
25 | int right = (rect1.X + rect1.Width) > (rect2.X + rect2.Width) ? (rect1.X + rect1.Width) : (rect2.X + rect2.Width);
26 | int bottom = (rect1.Y + rect1.Height) > (rect2.Y + rect2.Height) ? (rect1.Y + rect1.Height) : (rect2.Y + rect2.Height);
27 |
28 | return new Int32Rect(left, top, right - left, bottom - top);
29 | }
30 | }
31 |
32 | public static int GetArea(this Int32Rect rect)
33 | {
34 | if (rect.IsEmpty)
35 | {
36 | return 0;
37 | }
38 | else
39 | {
40 | return rect.Width * rect.Height;
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Extensions/RectExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 |
7 | namespace Microsoft.DwayneNeed.Extensions
8 | {
9 | public static class RectExtensions
10 | {
11 | public static Rect ConstrainWithin(this Rect rect, Rect constraint)
12 | {
13 | // Constrain the size.
14 | if (rect.Width > constraint.Width)
15 | {
16 | rect.Width = constraint.Width;
17 | }
18 | if (rect.Height > constraint.Height)
19 | {
20 | rect.Height = constraint.Height;
21 | }
22 |
23 | // Constrain the position.
24 | if (rect.Left < constraint.Left)
25 | {
26 | rect.X = constraint.Left;
27 | }
28 | if (rect.Right > constraint.Right)
29 | {
30 | rect.X = constraint.Right - rect.Width;
31 | }
32 | if (rect.Top < constraint.Top)
33 | {
34 | rect.Y = constraint.Top;
35 | }
36 | if (rect.Bottom > constraint.Bottom)
37 | {
38 | rect.Y = constraint.Bottom - rect.Height;
39 | }
40 |
41 | return rect;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Box1D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Numerics;
6 |
7 | namespace Microsoft.DwayneNeed.Geometry
8 | {
9 | ///
10 | /// A generic interface for a 1-dimensional box.
11 | ///
12 | public interface IBox1D
13 | {
14 | Interval Width { get; }
15 | }
16 |
17 | ///
18 | /// A simple implementation of a 1-dimensional box.
19 | ///
20 | public struct Box1D : IBox1D
21 | {
22 | public Box1D(IPoint1D point, IVector1D vector) : this()
23 | {
24 | dynamic startWidth = point.X;
25 | dynamic endWidth = startWidth + vector.DeltaX;
26 | if (startWidth <= endWidth)
27 | {
28 | Width = new Interval(startWidth, true, endWidth, true);
29 | }
30 | else
31 | {
32 | Width = new Interval(endWidth, true, startWidth, true);
33 | }
34 | }
35 |
36 | public Box1D(Interval width) : this()
37 | {
38 | Width = width;
39 | }
40 |
41 | public Interval Width { get; private set; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/BoxExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | public static class BoxExtensions
9 | {
10 | public static IBox AsBox(this IBox1D box1D)
11 | {
12 | return new Box(box1D.Width);
13 | }
14 |
15 | public static IBox AsBox(this IBox2D box2D)
16 | {
17 | return new Box(box2D.Width, box2D.Height);
18 | }
19 |
20 | public static IBox AsBox(this IBox3D box3D)
21 | {
22 | return new Box(box3D.Width, box3D.Height, box3D.Depth);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Point.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for an n-dimensional point.
10 | ///
11 | public interface IPoint
12 | {
13 | int Dimensions { get; }
14 | T GetCoordinate(int dimension);
15 | }
16 |
17 | ///
18 | /// A simple implementation of an n-dimensional point.
19 | ///
20 | public struct Point : IPoint
21 | {
22 | public Point(params T[] coordinates)
23 | {
24 | _coordinates = coordinates.ToArray();
25 | }
26 |
27 | public Point(IEnumerable coordinates)
28 | {
29 | _coordinates = coordinates.ToArray();
30 | }
31 |
32 | public int Dimensions
33 | {
34 | get
35 | {
36 | return _coordinates == null ? 0 : _coordinates.Length;
37 | }
38 | }
39 |
40 | public T GetCoordinate(int dimension)
41 | {
42 | if (dimension < 0 || _coordinates == null || dimension >= _coordinates.Length)
43 | {
44 | throw new IndexOutOfRangeException();
45 | }
46 |
47 | return _coordinates[dimension];
48 | }
49 |
50 | private T[] _coordinates;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Point1D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for a 1-dimensional point.
10 | ///
11 | public interface IPoint1D
12 | {
13 | T X { get; }
14 | }
15 |
16 | ///
17 | /// A simple implementation of a 1-dimensional point.
18 | ///
19 | public struct Point1D : IPoint1D
20 | {
21 | public Point1D(T x) : this()
22 | {
23 | X = x;
24 | }
25 |
26 | public T X { get; private set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Point2D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for a 2-dimensional point.
10 | ///
11 | public interface IPoint2D
12 | {
13 | T X { get; }
14 | T Y { get; }
15 | }
16 |
17 | ///
18 | /// A simple implementation of a 2-dimensional point.
19 | ///
20 | public struct Point2D : IPoint2D
21 | {
22 | public Point2D(T x, T y) : this()
23 | {
24 | X = x;
25 | Y = y;
26 | }
27 |
28 | public T X { get; private set; }
29 | public T Y { get; private set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Point3D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for q 3-dimensional point.
10 | ///
11 | public interface IPoint3D
12 | {
13 | T X { get; }
14 | T Y { get; }
15 | T Z { get; }
16 | }
17 |
18 | ///
19 | /// A simple implementation of a 3-dimensional point.
20 | ///
21 | public struct Point3D : IPoint3D
22 | {
23 | public Point3D(T x, T y, T z) : this()
24 | {
25 | X = x;
26 | Y = y;
27 | Z = z;
28 | }
29 |
30 | public T X { get; private set; }
31 | public T Y { get; private set; }
32 | public T Z { get; private set; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/PointExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | public static class PointExtensions
9 | {
10 | public static IPoint AsPoint(this IPoint1D point1D)
11 | {
12 | return new Point(point1D.X);
13 | }
14 |
15 | public static IPoint AsPoint(this IPoint2D point2D)
16 | {
17 | return new Point(point2D.X, point2D.Y);
18 | }
19 |
20 | public static IPoint AsPoint(this IPoint3D point3D)
21 | {
22 | return new Point(point3D.X, point3D.Y, point3D.Z);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Size1D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Numerics;
6 |
7 | namespace Microsoft.DwayneNeed.Geometry
8 | {
9 | ///
10 | /// A generic interface for a 1-dimensional size.
11 | ///
12 | public interface ISize1D
13 | {
14 | T Length { get; }
15 | }
16 |
17 | ///
18 | /// A simple implementation of a 1-dimensional size.
19 | ///
20 | public struct Size1D : ISize1D
21 | {
22 | public Size1D(T length) : this()
23 | {
24 | T nZero = default(T);
25 | dynamic nLength = length;
26 | if (nLength < nZero)
27 | {
28 | throw new InvalidOperationException("Size extents may not be negative.");
29 | }
30 |
31 | Length = length;
32 | }
33 |
34 | public T Length { get; private set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Size2D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Numerics;
6 |
7 | namespace Microsoft.DwayneNeed.Geometry
8 | {
9 | ///
10 | /// A generic interface for a 2-dimensional size.
11 | ///
12 | public interface ISize2D
13 | {
14 | T Width { get; }
15 | T Height { get; }
16 | }
17 |
18 | ///
19 | /// A simple implementation of a 2-dimensional size.
20 | ///
21 | public struct Size2D : ISize2D
22 | {
23 | public Size2D(T width, T height) : this()
24 | {
25 | T nZero = default(T);
26 | dynamic nWidth = width;
27 | dynamic nHeight = height;
28 | if (nWidth < nZero || nHeight < nZero)
29 | {
30 | throw new InvalidOperationException("Size extents may not be negative.");
31 | }
32 |
33 | Width = width;
34 | Height = height;
35 | }
36 |
37 | public T Width { get; private set; }
38 | public T Height { get; private set; }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Size3D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Numerics;
6 |
7 | namespace Microsoft.DwayneNeed.Geometry
8 | {
9 | ///
10 | /// A generic interface for a 3-dimensional size.
11 | ///
12 | public interface ISize3D
13 | {
14 | T Width { get; }
15 | T Height { get; }
16 | T Depth { get; }
17 | }
18 |
19 | ///
20 | /// A simple implementation of a 3-dimensional size.
21 | ///
22 | public struct Size3D : ISize3D
23 | {
24 | public Size3D(T width, T height, T depth) : this()
25 | {
26 | T nZero = default(T);
27 | dynamic nWidth = width;
28 | dynamic nHeight = height;
29 | dynamic nDepth = depth;
30 | if (nWidth < nZero || nHeight < nZero || nDepth < nZero)
31 | {
32 | throw new InvalidOperationException("Size extents may not be negative.");
33 | }
34 |
35 | Width = width;
36 | Height = height;
37 | Depth = depth;
38 | }
39 |
40 | public T Width { get; private set; }
41 | public T Height { get; private set; }
42 | public T Depth { get; private set; }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/SizeExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | public static class SizeExtensions
9 | {
10 | public static ISize AsSize(this ISize1D size1D)
11 | {
12 | return new Size(size1D.Length);
13 | }
14 |
15 | public static ISize AsSize(this ISize2D size2D)
16 | {
17 | return new Size(size2D.Width, size2D.Height);
18 | }
19 |
20 | public static ISize AsSize(this ISize3D size3D)
21 | {
22 | return new Size(size3D.Width, size3D.Height, size3D.Depth);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Vector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Numerics;
6 |
7 | namespace Microsoft.DwayneNeed.Geometry
8 | {
9 | ///
10 | /// A generic interface for an n-dimensional vector.
11 | ///
12 | public interface IVector
13 | {
14 | int Dimensions { get; }
15 | T GetDelta(int dimension);
16 | }
17 |
18 | ///
19 | /// A simple implementation of an n-dimensional vector.
20 | ///
21 | public struct Vector : IVector
22 | {
23 | public Vector(params T[] deltas)
24 | : this((IEnumerable)deltas)
25 | {
26 | }
27 |
28 | public Vector(IEnumerable deltas)
29 | {
30 | _deltas = deltas.ToArray();
31 | }
32 |
33 | public int Dimensions
34 | {
35 | get
36 | {
37 | return _deltas == null ? 0 : _deltas.Length;
38 | }
39 | }
40 |
41 | public T GetDelta(int dimension)
42 | {
43 | if (dimension < 0 || _deltas == null || dimension >= _deltas.Length)
44 | {
45 | throw new IndexOutOfRangeException();
46 | }
47 |
48 | return _deltas[dimension];
49 | }
50 |
51 | private T[] _deltas;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Vector1D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for a 1-dimensional vector.
10 | ///
11 | public interface IVector1D
12 | {
13 | T DeltaX { get; }
14 | }
15 |
16 | ///
17 | /// A simple implementation of a 1-dimensional vector.
18 | ///
19 | public struct Vector1D : IVector1D
20 | {
21 | public Vector1D(T deltaX) : this()
22 | {
23 | DeltaX = deltaX;
24 | }
25 |
26 | public T DeltaX { get; private set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Vector2D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for a 2-dimensional vector.
10 | ///
11 | public interface IVector2D
12 | {
13 | T DeltaX { get; }
14 | T DeltaY { get; }
15 | }
16 |
17 | ///
18 | /// A simple implementation of a 2-dimensional point.
19 | ///
20 | public struct Vector2D : IVector2D
21 | {
22 | public Vector2D(T deltaX, T deltaY) : this()
23 | {
24 | DeltaX = deltaX;
25 | DeltaY = deltaY;
26 | }
27 |
28 | public T DeltaX { get; private set; }
29 | public T DeltaY { get; private set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/Vector3D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | ///
9 | /// A generic interface for a 3-dimensional vector.
10 | ///
11 | public interface IVector3D
12 | {
13 | T DeltaX { get; }
14 | T DeltaY { get; }
15 | T DeltaZ { get; }
16 | }
17 |
18 | ///
19 | /// A simple implementation of a 3-dimensional vector.
20 | ///
21 | public struct Vector3D : IVector3D
22 | {
23 | public Vector3D(T deltaX, T deltaY, T deltaZ)
24 | : this()
25 | {
26 | DeltaX = deltaX;
27 | DeltaY = deltaY;
28 | DeltaZ = deltaZ;
29 | }
30 |
31 | public T DeltaX { get; private set; }
32 | public T DeltaY { get; private set; }
33 | public T DeltaZ { get; private set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Geometry/VectorExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Geometry
7 | {
8 | public static class VectorExtensions
9 | {
10 | public static IVector AsVector(this IVector1D vector1D)
11 | {
12 | return new Vector(vector1D.DeltaX);
13 | }
14 |
15 | public static IVector AsVector(this IVector2D vector2D)
16 | {
17 | return new Vector(vector2D.DeltaX, vector2D.DeltaY);
18 | }
19 |
20 | public static IVector AsVector(this IVector3D vector3D)
21 | {
22 | return new Vector(vector3D.DeltaX, vector3D.DeltaY, vector3D.DeltaZ);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Input/RoutedCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 | using System.Windows;
7 |
8 | namespace Microsoft.DwayneNeed.Input
9 | {
10 | ///
11 | /// A simple generic version of RoutedCommand that provides new
12 | /// strongly typed methods to support command parameters of type T.
13 | ///
14 | public class RoutedCommand : RoutedCommand
15 | {
16 | public RoutedCommand() { }
17 | public RoutedCommand(string name, Type ownerType) : base(name, ownerType) { }
18 | public RoutedCommand(string name, Type ownerType, InputGestureCollection inputGestures) : base(name, ownerType, inputGestures) { }
19 |
20 | ///
21 | /// Determines whether this command can execute on the specified
22 | /// target.
23 | ///
24 | public bool CanExecute(T parameter, IInputElement target)
25 | {
26 | return base.CanExecute(parameter, target);
27 | }
28 |
29 | ///
30 | /// Executes the command on the specified target.
31 | ///
32 | public void Execute(T parameter, IInputElement target)
33 | {
34 | base.Execute(parameter, target);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/AirspaceMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Interop
7 | {
8 | public enum AirspaceMode
9 | {
10 | None,
11 | Clip,
12 | Redirect
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/CallbackHwndHost.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 | using System.Windows.Interop;
7 | using Microsoft.DwayneNeed;
8 | using Microsoft.DwayneNeed.Win32.User32;
9 | using System.Diagnostics;
10 |
11 | namespace Microsoft.DwayneNeed.Interop
12 | {
13 | ///
14 | /// A simple HwndHost that accepts callbacks for creating and
15 | /// destroying the hosted window.
16 | ///
17 | public class CallbackHwndHost : HwndHostEx
18 | {
19 | public CallbackHwndHost(Func buildWindow, Action destroyWindow)
20 | {
21 | _buildWindow = buildWindow;
22 | _destroyWindow = destroyWindow;
23 | }
24 |
25 | protected override HWND BuildWindowOverride(HWND hwndParent)
26 | {
27 | return _buildWindow(hwndParent);
28 | }
29 |
30 | protected override void DestroyWindowOverride(HWND hwnd)
31 | {
32 | _destroyWindow(hwnd);
33 | }
34 |
35 | private Func _buildWindow;
36 | private Action _destroyWindow;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/DeviceContextCachePolicy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Interop
7 | {
8 | public enum DeviceContextCachePolicy
9 | {
10 | Global,
11 | WindowClass,
12 | Window
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/HwndHostCommands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 | using Microsoft.DwayneNeed.Input;
7 |
8 | namespace Microsoft.DwayneNeed.Interop
9 | {
10 | public static class HwndHostCommands
11 | {
12 | public static RoutedCommand MouseActivate = new RoutedCommand("MouseActivate", typeof(HwndHostCommands));
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/MouseActivateParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Interop
7 | {
8 | public class MouseActivateParameter
9 | {
10 | public bool Activate;
11 | public bool EatMessage;
12 | public bool HandleMessage;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/RedirectionVisibility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Interop
7 | {
8 | public enum RedirectionVisibility
9 | {
10 | Hidden,
11 | Visible,
12 | Interactive
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/WindowClassType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Interop
7 | {
8 | public enum WindowClassType
9 | {
10 | System,
11 | ApplicationLocal,
12 | ApplicationGlobal
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/WindowParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using Microsoft.DwayneNeed.Win32.User32;
7 |
8 | namespace Microsoft.DwayneNeed.Interop
9 | {
10 | public class WindowParameters
11 | {
12 | public object Tag { get; set; }
13 | public IntPtr HINSTANCE { get; set; }
14 | public Int32Rect WindowRect { get; set; }
15 | public String Name { get; set; }
16 | public WS Style { get; set; }
17 | public WS_EX ExtendedStyle { get; set; }
18 |
19 | public HWND Parent
20 | {
21 | get
22 | {
23 | // never return null
24 | return _parent ?? HWND.NULL;
25 | }
26 |
27 | set
28 | {
29 | _parent = value;
30 | }
31 | }
32 |
33 | HWND _parent;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Interop/WindowShowState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Interop
7 | {
8 | public enum WindowShowState
9 | {
10 | Default,
11 | Current,
12 | Normal,
13 | Minimized,
14 | Maximized
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/MDI/AdjustWindowRectParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 |
7 | namespace Microsoft.DwayneNeed.MDI
8 | {
9 | public class AdjustWindowRectParameter
10 | {
11 | public AdjustWindowRectParameter()
12 | {
13 | }
14 |
15 | public AdjustWindowRectParameter(Vector delta, MdiWindowEdge interactiveEdges)
16 | {
17 | Delta = delta;
18 | InteractiveEdges = interactiveEdges;
19 | }
20 |
21 | ///
22 | /// The amount to adjust the window rect by.
23 | ///
24 | public Vector Delta { get; set; }
25 |
26 | ///
27 | /// The edges of the window rect to adust.
28 | ///
29 | ///
30 | /// Specifying None means to move the window rect by the Delta
31 | /// amount.
32 | ///
33 | public MdiWindowEdge InteractiveEdges { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/MDI/MdiWindowEdge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.MDI
7 | {
8 | [Flags]
9 | public enum MdiWindowEdge
10 | {
11 | None = 0,
12 | Left = 1,
13 | Top = 2,
14 | Right = 4,
15 | Bottom = 8
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Media/CacheScale.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Media
7 | {
8 | public class CacheScale
9 | {
10 | public static CacheScale Auto
11 | {
12 | get
13 | {
14 | if (_auto == null)
15 | {
16 | _auto = new CacheScale(null);
17 | }
18 |
19 | return _auto;
20 | }
21 | }
22 |
23 | public CacheScale(double scale)
24 | : this((double?)scale)
25 | {
26 | }
27 |
28 | public bool IsAuto
29 | {
30 | get
31 | {
32 | return !_scale.HasValue;
33 | }
34 | }
35 |
36 | public double Scale
37 | {
38 | get
39 | {
40 | return _scale.Value;
41 | }
42 | }
43 |
44 | private CacheScale(double? scale)
45 | {
46 | _scale = scale;
47 | }
48 |
49 | private static CacheScale _auto;
50 | private double? _scale;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Media/Imaging/Bgra32Pixel.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.DwayneNeed.Media.Imaging
2 | {
3 | ///
4 | /// The Bgra32Pixel struct defines the memory layout of a Bgra32 pixel.
5 | ///
6 | public struct Bgra32Pixel
7 | {
8 | public byte Blue;
9 | public byte Green;
10 | public byte Red;
11 | public byte Alpha;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/Binary64Exponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// The Binary64Exponent struct represents the exponent of a
10 | /// double-precision IEEE 754 floating point number.
11 | ///
12 | ///
13 | /// The IEEE 754 standard calls for biasing the exponent by 1023.
14 | /// Biasing provides a simple scheme for encoding both positive and
15 | /// negative numbers in an unsigned field.
16 | ///
17 | public struct Binary64Exponent
18 | {
19 | public Binary64Exponent(uint exponent)
20 | {
21 | if (exponent > 2047)
22 | {
23 | throw new ArgumentOutOfRangeException("exponent");
24 | }
25 |
26 | _exponent = exponent;
27 | }
28 |
29 | public uint UnbiasedValue { get { return _exponent; } }
30 | public int BiasedValue { get { return (int)_exponent - (int)Bias; } }
31 | public Sign Sign { get { return new Sign(_exponent < Bias); } }
32 |
33 | public const uint Bias = 1023;
34 |
35 | uint _exponent;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/Binary64InsignificantBits.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// Contains an integer between 0 and 52.
10 | ///
11 | public struct Binary64InsignificantBits
12 | {
13 | public Binary64InsignificantBits(uint insignificantBits)
14 | : this()
15 | {
16 | if (insignificantBits > 52)
17 | {
18 | throw new ArgumentOutOfRangeException("significandBits");
19 | }
20 |
21 | Value = insignificantBits;
22 | }
23 |
24 | public static implicit operator uint(Binary64InsignificantBits value)
25 | {
26 | return value.Value;
27 | }
28 |
29 | public static implicit operator Binary64InsignificantBits(uint value)
30 | {
31 | return new Binary64InsignificantBits(value);
32 | }
33 |
34 | public static implicit operator int(Binary64InsignificantBits value)
35 | {
36 | return (int) value.Value;
37 | }
38 |
39 | public static implicit operator Binary64InsignificantBits(int value)
40 | {
41 | return new Binary64InsignificantBits((uint) value);
42 | }
43 |
44 | public uint Value { get; private set; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/Binary64Significand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// A numeric type for representing a fraction.
10 | ///
11 | public struct Binary64Significand
12 | {
13 | public Binary64Significand(ulong value, bool isSubNormal) : this()
14 | {
15 | // Only 52 bits can be specified.
16 | ulong mask = ((ulong)1 << 52) - 1;
17 | if ((value & ~mask) != 0)
18 | {
19 | throw new ArgumentOutOfRangeException("significand");
20 | }
21 |
22 | Value = value;
23 | IsSubnormal = isSubNormal;
24 | }
25 |
26 | public ulong Value { get; private set;}
27 | public bool IsSubnormal { get; private set; }
28 |
29 | public double Fraction
30 | {
31 | get
32 | {
33 | ulong denominator = (ulong)1 << 52;
34 | ulong numerator = Value;
35 | if (!IsSubnormal)
36 | {
37 | numerator += denominator;
38 | }
39 |
40 | return (double)numerator / (double)denominator;
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/ClosedInterval.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// An interface representing a connected portion of the real line
10 | /// where each of the endpoints is closed.
11 | ///
12 | public interface IClosedInterval
13 | {
14 | T Min { get; }
15 | T Max { get; }
16 | }
17 |
18 | ///
19 | /// A simple implementation of a closed interval.
20 | ///
21 | public struct ClosedInterval : IClosedInterval
22 | {
23 | public T Min { get; private set; }
24 | public T Max { get; private set; }
25 |
26 |
27 | // Use the standard notation for intervals.
28 | public override string ToString()
29 | {
30 | return String.Format("({0},{1})",
31 | Min,
32 | Max);
33 | }
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/Int32Point.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | public struct Int32Point
9 | {
10 | public Int32Point(int x, int y)
11 | {
12 | X = x;
13 | Y = y;
14 | }
15 |
16 | public int X;
17 | public int Y;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/Interval.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// An interface representing a connected portion of the real line
10 | /// where each of the endpoints can be open or closed.
11 | ///
12 | public interface IInterval
13 | {
14 | T Min { get; }
15 | bool IsMinClosed { get; }
16 |
17 | T Max { get; }
18 | bool IsMaxClosed { get; }
19 | }
20 |
21 | ///
22 | /// A simple interval implementation that can have endpoints that are
23 | /// either open or closed.
24 | ///
25 | public struct Interval : IInterval
26 | {
27 | public Interval(T min, bool isMinClosed, T max, bool isMaxClosed) : this()
28 | {
29 | Min = min;
30 | IsMinClosed = isMinClosed;
31 | Max = max;
32 | IsMaxClosed = isMaxClosed;
33 | }
34 |
35 | public T Min {get; private set;}
36 | public bool IsMinClosed {get; private set;}
37 |
38 | public T Max {get; private set;}
39 | public bool IsMaxClosed {get; private set;}
40 |
41 | public override string ToString()
42 | {
43 | return String.Format("{0}{1},{2}{3}",
44 | IsMinClosed ? "(" : "[",
45 | Min,
46 | Max,
47 | IsMaxClosed ? ")" : "]");
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/IntervalExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | public static class IntervalExtensions
9 | {
10 | // Support converting any ICloseInterval to an IInterval
11 | public static IInterval AsInterval(this IClosedInterval closedInterval)
12 | {
13 | return new Interval(closedInterval.Min, true, closedInterval.Max, true);
14 | }
15 |
16 | // Support converting any IOpenInterval to an IInterval
17 | public static IInterval AsInterval(this IOpenInterval openInterval)
18 | {
19 | return new Interval(openInterval.Min, false, openInterval.Max, false);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/OpenInterval.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// An interface representing a connected portion of the real line
10 | /// where each of the endpoints is open.
11 | ///
12 | public interface IOpenInterval
13 | {
14 | T Min { get; }
15 | T Max { get; }
16 | }
17 |
18 | ///
19 | /// A simple implementation of an open interval.
20 | ///
21 | public struct OpenInterval : IOpenInterval
22 | {
23 | public T Min { get; private set; }
24 | public T Max { get; private set; }
25 |
26 | // Use the standard notation for intervals.
27 | public override string ToString()
28 | {
29 | return String.Format("[{0},{1}]",
30 | Min,
31 | Max);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Numerics/Sign.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Numerics
7 | {
8 | ///
9 | /// A simple type representing the sign of a numeric.
10 | ///
11 | public struct Sign
12 | {
13 | public Sign(bool isNegative)
14 | {
15 | _isNegative = isNegative;
16 | }
17 |
18 | public bool IsPositive { get { return !_isNegative; } }
19 | public bool IsNegative { get { return _isNegative; } }
20 |
21 | public static readonly Sign Positive = new Sign(false);
22 | public static readonly Sign Negative = new Sign(true);
23 |
24 | private bool _isNegative;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
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 Microsoft.DwayneNeed.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Shapes/BoysSurface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media.Media3D;
7 | using System.Windows.Media;
8 | using System.Windows.Markup;
9 | using Microsoft.DwayneNeed.Media;
10 | using Microsoft.DwayneNeed.Numerics;
11 |
12 | namespace Microsoft.DwayneNeed.Shapes
13 | {
14 | public sealed class BoysSurface : ParametricShape3D
15 | {
16 | protected override Point3D Project(MemoizeMath u, MemoizeMath v)
17 | {
18 | double x = X(u, v);
19 | double y = Y(u, v);
20 | double z = Z(u, v);
21 |
22 | double x2 = x * x;
23 | double y2 = y * y;
24 | double z2 = z * z;
25 |
26 | double f = (2.0 * x2 - y2 - z2 + 2.0 * y * z * (y2 - z2) + z * x * (x2 - z2) + x * y * (y2 - x2)) / 2.0;
27 | double g = (y2 - z2 + (z * x * (z2 - x2) + x * y * (y2 - x2))) * Math.Sqrt(3) / 2.0;
28 | double h = (x + y + z) * (Math.Pow(x + y + z, 3) + 4.0 * (y - x) * (z - y) * (x - z));
29 | return new Point3D(f,g,h/8.0);
30 | }
31 |
32 | private double X(MemoizeMath u, MemoizeMath v)
33 | {
34 | return u.Cos * v.Sin;
35 | }
36 |
37 | private double Y(MemoizeMath u, MemoizeMath v)
38 | {
39 | return u.Sin * v.Sin;
40 | }
41 |
42 | private double Z(MemoizeMath u, MemoizeMath v)
43 | {
44 | return v.Cos;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Shapes/Cylinder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media.Media3D;
7 | using System.Windows.Media;
8 | using System.Windows.Markup;
9 | using Microsoft.DwayneNeed.Media;
10 | using Microsoft.DwayneNeed.Numerics;
11 |
12 | namespace Microsoft.DwayneNeed.Shapes
13 | {
14 | public sealed class Cylinder : ParametricShape3D
15 | {
16 | static Cylinder()
17 | {
18 | // The height of the cylinder is specified by MaxV, so make the
19 | // default MaxV property be 1.
20 | ParametricShape3D.MaxVProperty.OverrideMetadata(typeof(Cylinder), new PropertyMetadata(1.0));
21 | }
22 |
23 | protected override System.Windows.Media.Media3D.Point3D Project(MemoizeMath u, MemoizeMath v)
24 | {
25 | double radius = 1;
26 |
27 | double x = (radius * u.Sin);
28 | double y = (radius * u.Cos);
29 | double z = v.Value;
30 | return new Point3D(x, y, z);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Shapes/Ellipsoid.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Media.Media3D;
6 | using System.Windows.Media;
7 | using Microsoft.DwayneNeed.Media;
8 | using System.Windows;
9 | using Microsoft.DwayneNeed.Numerics;
10 |
11 | namespace Microsoft.DwayneNeed.Shapes
12 | {
13 | public class Ellipsoid : ParametricShape3D
14 | {
15 | protected override Point3D Project(MemoizeMath u, MemoizeMath v)
16 | {
17 | double xRadius = 1.0;
18 | double yRadius = 1.0;
19 | double zRadius = 1.0;
20 |
21 | double x = xRadius * u.Cos * v.Sin;
22 | double y = yRadius * u.Sin * v.Sin;
23 | double z = zRadius * v.Cos;
24 | return new Point3D(x, y, z);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Shapes/RomanSurface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media.Media3D;
7 | using System.Windows.Media;
8 | using System.Windows.Markup;
9 | using Microsoft.DwayneNeed.Media;
10 | using Microsoft.DwayneNeed.Numerics;
11 |
12 | namespace Microsoft.DwayneNeed.Shapes
13 | {
14 | public sealed class RomanSurface : ParametricShape3D
15 | {
16 | public static DependencyProperty AProperty =
17 | DependencyProperty.Register(
18 | "A",
19 | typeof(double),
20 | typeof(RomanSurface), new PropertyMetadata(
21 | 1.0, new PropertyChangedCallback(OnPropertyChangedAffectsModel)));
22 |
23 | public double A
24 | {
25 | get { return (double)GetValue(AProperty); }
26 | set { SetValue(AProperty, value); }
27 | }
28 |
29 | protected override Point3D Project(MemoizeMath u, MemoizeMath v)
30 | {
31 | double a = A;
32 |
33 | double x = (a * a * Math.Sin(2.0 * u.Value) * Math.Pow(v.Cos, 2)) / 2.0;
34 | double y = (a * a * u.Sin * Math.Sin(v.Value * 2.0)) / 2.0;
35 | double z = (a * a * u.Cos * Math.Sin(v.Value * 2.0)) / 2.0;
36 | return new Point3D(x, y, z);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Shapes/Sphere.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media.Media3D;
7 | using System.Windows.Media;
8 | using System.Windows.Markup;
9 | using Microsoft.DwayneNeed.Media;
10 | using Microsoft.DwayneNeed.Numerics;
11 |
12 | namespace Microsoft.DwayneNeed.Shapes
13 | {
14 | public sealed class Sphere : ParametricShape3D
15 | {
16 | protected override Point3D Project(MemoizeMath u, MemoizeMath v)
17 | {
18 | double radius = 1.0;
19 |
20 | double x = radius * u.Cos * v.Sin;
21 | double y = radius * u.Sin * v.Sin;
22 | double z = radius * v.Cos;
23 | return new Point3D(x, y, z);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Shapes/Torus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Media.Media3D;
6 | using System.Windows;
7 | using Microsoft.DwayneNeed.Numerics;
8 |
9 | namespace Microsoft.DwayneNeed.Shapes
10 | {
11 | public class Torus : ParametricShape3D
12 | {
13 | static Torus()
14 | {
15 | // So texture coordinates work out better, configure the default
16 | // MinV property to be PI.
17 | ParametricShape3D.MinVProperty.OverrideMetadata(typeof(Torus), new PropertyMetadata(Math.PI));
18 |
19 | // So texture coordinates work out better, configure the default
20 | // MaxV property to be 3*PI.
21 | ParametricShape3D.MaxVProperty.OverrideMetadata(typeof(Torus), new PropertyMetadata(Math.PI * 3.0));
22 | }
23 |
24 | protected override System.Windows.Media.Media3D.Point3D Project(MemoizeMath u, MemoizeMath v)
25 | {
26 | double centerRadius = 2.0;
27 | double crossSectionRadius = 1.0;
28 |
29 | double x = (centerRadius + crossSectionRadius * v.Cos) * Math.Cos(-u.Value);
30 | double y = (centerRadius + crossSectionRadius * v.Cos) * Math.Sin(-u.Value);
31 | double z = crossSectionRadius * v.Sin;
32 | return new Point3D(x, y, z);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Threading/UIThreadPerfSample.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Threading
7 | {
8 | ///
9 | /// This class represents a perf sample taken from a UI thread. The
10 | /// time stamp of the same is usually taken from the RenderingEventArgs
11 | ///
12 | ///
13 | internal class UIThreadPerfSample
14 | {
15 | public UIThreadPerfSample(TimeSpan sampleTime,
16 | int frameCount,
17 | Int64 processCycleTime,
18 | Int64 idleCycleTime)
19 | {
20 | SampleTime = sampleTime;
21 | FrameCount = frameCount;
22 | ProcessCycleTime = processCycleTime;
23 | IdleCycleTime = idleCycleTime;
24 | }
25 |
26 | public TimeSpan SampleTime { get; private set; }
27 | public int FrameCount { get; private set; }
28 | public Int64 ProcessCycleTime { get; private set; }
29 | public Int64 IdleCycleTime { get; private set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Threading/UIThreadPoolDataGridColumn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 |
7 | namespace Microsoft.DwayneNeed.Threading
8 | {
9 | //public class UIThreadPoolDataGridColumn : DataGridColumn
10 | //{
11 |
12 | //}
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Threading/UIThreadPoolDataGridTemplateColumn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 | using System.Windows;
7 |
8 | namespace Microsoft.DwayneNeed.Threading
9 | {
10 | public class UIThreadPoolDataGridTemplateColumn : DataGridTemplateColumn
11 | {
12 | public string PropertyName {get;set;}
13 |
14 | protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
15 | {
16 | // Get the cell template and make sure it is sealed because we need
17 | // to inflate it on the worker thread.
18 | DataTemplate cellTemplate = CellTemplate;
19 | if (!cellTemplate.IsSealed)
20 | {
21 | cellTemplate.Seal();
22 | }
23 |
24 | UIThreadPoolRoot root = new UIThreadPoolRoot();
25 | root.DataContext = dataItem;
26 | root.Content = cellTemplate;
27 | root.PropertyName = PropertyName;
28 |
29 | return root;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Threading/UIThreadPoolThread.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Windows.Threading;
7 | using Microsoft.DwayneNeed.Controls;
8 | using System.Windows.Media;
9 |
10 | namespace Microsoft.DwayneNeed.Threading
11 | {
12 | public sealed class UIThreadPoolThread : IDisposable
13 | {
14 | internal UIThreadPoolThread(Dispatcher dispatcher)
15 | {
16 | UIThreadPool.IncrementThread(dispatcher);
17 | Dispatcher = dispatcher;
18 | }
19 |
20 | ~UIThreadPoolThread()
21 | {
22 | Dispose(false);
23 | }
24 |
25 | public void Dispose()
26 | {
27 | Dispose(true);
28 | GC.SuppressFinalize(this);
29 | }
30 |
31 | private void Dispose(bool disposing)
32 | {
33 | if (Dispatcher == null)
34 | {
35 | throw new ObjectDisposedException("UIThreadPoolThread");
36 | }
37 |
38 | Dispatcher dispatcher = Dispatcher;
39 | Dispatcher = null;
40 |
41 | UIThreadPool.DecrementThread(dispatcher);
42 | }
43 |
44 | public Dispatcher Dispatcher { get; private set; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Utilities/Buffer2DView.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DwayneNeed.Numerics;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows;
7 | using System.Windows.Media;
8 | using System.Windows.Media.Imaging;
9 |
10 | namespace Microsoft.DwayneNeed.Utilities
11 | {
12 | public struct Buffer2DView where T : struct
13 | {
14 | public Buffer2DView(Buffer2D buffer)
15 | {
16 | _buffer = buffer;
17 | }
18 |
19 | public Buffer2DView(Buffer2D buffer, Int32Rect bounds)
20 | {
21 | _buffer = new Buffer2D(buffer, bounds);
22 | }
23 |
24 | public Buffer2DView(Buffer2DView buffer, Int32Rect bounds)
25 | {
26 | _buffer = new Buffer2D(buffer._buffer, bounds);
27 | }
28 |
29 | public bool CompareBits(Buffer2D srcBuffer, Int32Rect srcRect, Int32Point? dstPoint = null)
30 | {
31 | return _buffer.CompareBits(srcBuffer, srcRect, dstPoint);
32 | }
33 |
34 | public T this[int x, int y] { get { return _buffer[x,y]; } }
35 | public int Width { get { return _buffer.Width; } }
36 | public int Height { get { return _buffer.Height; } }
37 |
38 | public BitmapSource CreateBitmapSource(double dpiX, double dpiY, PixelFormat pixelFormat, BitmapPalette bitmapPalette)
39 | {
40 | return _buffer.CreateBitmapSource(dpiX, dpiY, pixelFormat, bitmapPalette);
41 | }
42 |
43 | internal Buffer2D _buffer;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Utilities/CommandLineParameterAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.DwayneNeed.Utilities
7 | {
8 | ///
9 | /// The CommandLineParameter attribute can be used to indicate how
10 | /// properties of a type are mapped to command line parameters.
11 | ///
12 | [AttributeUsage(AttributeTargets.Property)]
13 | public class CommandLineParameterAttribute : Attribute
14 | {
15 | public CommandLineParameterAttribute(string name)
16 | {
17 | this.Name = name;
18 | }
19 |
20 | public string Name;
21 | public string ShortDescription;
22 | public bool IsRequired;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Utilities/CommandLineParameterException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Utilities
8 | {
9 | [Serializable]
10 | public class CommandLineParameterException : Exception
11 | {
12 | public CommandLineParameterException()
13 | : base()
14 | {
15 | }
16 |
17 | public CommandLineParameterException(string message)
18 | : base(message)
19 | {
20 | }
21 |
22 | public CommandLineParameterException(string message, Exception innerException)
23 | : base(message, innerException)
24 | {
25 | }
26 |
27 | protected CommandLineParameterException(SerializationInfo info, StreamingContext context)
28 | : base(info, context)
29 | {
30 | if (info != null)
31 | {
32 | //this.fUserName = info.GetString("fUserName");
33 | }
34 | }
35 |
36 | public override void GetObjectData(SerializationInfo info, StreamingContext context)
37 | {
38 | base.GetObjectData(info, context);
39 |
40 | if (info != null)
41 | {
42 | // info.AddValue("fUserName", this.fUserName);
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/Microsoft.DwayneNeed/Utilities/CommandLineUsageException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 |
7 | namespace Microsoft.DwayneNeed.Utilities
8 | {
9 | [Serializable]
10 | public class CommandLineUsageException : Exception
11 | {
12 | public CommandLineUsageException()
13 | : base()
14 | {
15 | }
16 |
17 | public CommandLineUsageException(string message)
18 | : base(message)
19 | {
20 | }
21 |
22 | public CommandLineUsageException(string message, Exception innerException)
23 | : base(message, innerException)
24 | {
25 | }
26 |
27 | protected CommandLineUsageException(SerializationInfo info, StreamingContext context)
28 | : base(info, context)
29 | {
30 | if (info != null)
31 | {
32 | //this.fUserName = info.GetString("fUserName");
33 | }
34 | }
35 |
36 | public override void GetObjectData(SerializationInfo info, StreamingContext context)
37 | {
38 | base.GetObjectData(info, context);
39 |
40 | if (info != null)
41 | {
42 | // info.AddValue("fUserName", this.fUserName);
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/MultiThreadDataGridDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/MultiThreadDataGridDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace MultiThreadDataGridDemo
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/MultiThreadDataGridDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
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 MultiThreadDataGridDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/MultiThreadDataGridDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/MultiThreadDataGridDemo/SomeEnum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace MultiThreadDataGridDemo
7 | {
8 | public enum SomeEnum
9 | {
10 | Who,
11 | What,
12 | When,
13 | Where,
14 | Why,
15 | How
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/MultiThreadDataGridDemo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/3DThing.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace OldSchoolMdiDemo
16 | {
17 | ///
18 | /// Interaction logic for _3DThing.xaml
19 | ///
20 | public partial class _3DThing : Page
21 | {
22 | public _3DThing()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace OldSchoolMdiDemo
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/Bing.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/Bing.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace OldSchoolMdiDemo
16 | {
17 | ///
18 | /// Interaction logic for Page1.xaml
19 | ///
20 | public partial class Bing : Page
21 | {
22 | public Bing()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/ClassicMdiChild.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 | using System.ComponentModel;
7 | using System.Windows;
8 |
9 | namespace OldSchoolMdiDemo
10 | {
11 | public class ClassicMdiChild : ContentControl
12 | {
13 | public ClassicMdiChild()
14 | {
15 | if (!DesignerProperties.GetIsInDesignMode(this))
16 | {
17 | PresentationSource.AddSourceChangedHandler(this, OnPresentationSourceChanged);
18 | }
19 | }
20 |
21 | private void OnPresentationSourceChanged(object sender, SourceChangedEventArgs e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/Jellyfish.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MahApps/Microsoft.DwayneNeed/bba80214c5e38cdef0b75d2ebb335bab7a7ecc43/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/Jellyfish.jpg
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace OldSchoolMdiDemo
16 | {
17 | ///
18 | /// Interaction logic for MainWindow.xaml
19 | ///
20 | public partial class MainWindow : Window
21 | {
22 | public MainWindow()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/NotifyMdiClientEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Interop;
6 |
7 | namespace OldSchoolMdiDemo
8 | {
9 | public class NotifyMdiClientEventArgs : EventArgs
10 | {
11 | public NotifyMdiClientEventArgs(ClassicMdiClient client)
12 | {
13 | Client = client;
14 | }
15 |
16 | public ClassicMdiClient Client { get; private set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
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 OldSchoolMdiDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/TestElement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media;
7 |
8 | namespace OldSchoolMdiDemo
9 | {
10 | public class TestElement : FrameworkElement
11 | {
12 | protected override Size MeasureOverride(Size availableSize)
13 | {
14 | return base.MeasureOverride(availableSize);
15 | }
16 |
17 | protected override Size ArrangeOverride(Size finalSize)
18 | {
19 | return base.ArrangeOverride(finalSize);
20 | }
21 |
22 | protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
23 | {
24 | double rX = RenderSize.Width/2;
25 | double rY = RenderSize.Height/2;
26 | Point center = new Point(rX, rY);
27 | drawingContext.DrawEllipse(Brushes.Red, null, center, rX, rY);
28 | base.OnRender(drawingContext);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/OldSchoolMdiDemo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/TestCmd/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/TestCmd/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.DwayneNeed.Utilities;
7 |
8 | namespace TestCmd
9 | {
10 | class Program
11 | {
12 | [CommandLineParameter("pf")]
13 | public static bool PrivateFoo { get; set; }
14 |
15 | [CommandLineParameter("f", IsRequired = true)]
16 | public static bool Foo { get; set; }
17 |
18 | [CommandLineParameter("rf", ShortDescription="server name")]
19 | public static bool ReadonlyFoo { get { return true; } }
20 |
21 | [CommandLineParameter("b", ShortDescription="test case", IsRequired=true)]
22 | public static int Bar { get; set; }
23 |
24 | public static int IgnoreBar { get; set; }
25 |
26 | static void Main(string[] args)
27 | {
28 | try
29 | {
30 | CommandLineParser.Parse(args);
31 | }
32 | catch (CommandLineUsageException e)
33 | {
34 | CommandLineParser.PrintUsageException("TestCmd", e);
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/TestCmd/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestCmd")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestCmd")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("110fa9d4-e017-42d3-a766-44f001053e61")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/VisualTargetDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/VisualTargetDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Windows;
6 |
7 | namespace VisualTargetDemo
8 | {
9 | ///
10 | /// Interaction logic for App.xaml
11 | ///
12 | public partial class App : Application
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/VisualTargetDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
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 VisualTargetDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/VisualTargetDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/VisualTargetDemo/Window1.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/VisualTargetDemo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace WeakEventDemo
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/CompositionTargetRenderingEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 | using System.Windows.Media;
7 | using System.Windows.Threading;
8 |
9 | namespace WeakEventDemo
10 | {
11 | public class CompositionTargetRenderingEvent : Event
12 | {
13 | private CompositionTargetRenderingEvent()
14 | {
15 | }
16 |
17 | public static CompositionTargetRenderingEvent Singleton
18 | {
19 | get
20 | {
21 | return _singleton;
22 | }
23 | }
24 |
25 | private static CompositionTargetRenderingEvent _singleton = new CompositionTargetRenderingEvent();
26 |
27 | protected override object SubscribeCore(Dispatcher sender, Action handler)
28 | {
29 | EventHandler proxy = delegate(object proxySender, EventArgs proxyEventArgs)
30 | {
31 | handler((Dispatcher)proxySender, (RenderingEventArgs)proxyEventArgs);
32 | };
33 |
34 | CompositionTarget.Rendering += proxy;
35 |
36 | return proxy;
37 | }
38 |
39 | protected override void UnubscribeCore(Dispatcher sender, Action handler, object tag)
40 | {
41 | EventHandler proxy = (EventHandler)tag;
42 | CompositionTarget.Rendering -= proxy;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Windows.Threading;
15 |
16 | namespace WeakEventDemo
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | CompositionTargetRenderingEvent.Singleton.Subscribe(null, OnRendering);
27 | }
28 |
29 | private void OnRendering(Dispatcher sender, RenderingEventArgs e)
30 | {
31 | TheTextBox.Background = Brushes.Red;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
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 WeakEventDemo.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WeakEventDemo/WeakReference.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace WeakEventDemo
7 | {
8 | public class WeakReference : WeakReference where T : class
9 | {
10 | public WeakReference(T target)
11 | : base(target)
12 | {
13 | }
14 |
15 | public new T Target
16 | {
17 | get
18 | {
19 | return (T) Target;
20 | }
21 |
22 | set
23 | {
24 | Target = value;
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WindowsFormsControls/ControlMix.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace WindowsFormsControls
11 | {
12 | public partial class ControlMix : UserControl
13 | {
14 | public ControlMix()
15 | {
16 | InitializeComponent();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WindowsFormsControls/DataForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace WindowsFormsControls
11 | {
12 | public partial class DataForm : UserControl
13 | {
14 | public DataForm()
15 | {
16 | InitializeComponent();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WindowsFormsControls/MediaPlayer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | namespace WindowsFormsControls
11 | {
12 | public partial class MediaPlayer : UserControl
13 | {
14 | public MediaPlayer()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | public string URL
20 | {
21 | get
22 | {
23 | return axWindowsMediaPlayer1.URL;
24 | }
25 |
26 | set
27 | {
28 | axWindowsMediaPlayer1.URL = value;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/WindowsFormsControls/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("WindowsFormsControls")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("WindowsFormsControls")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b9dacfdc-b831-4a37-8bd4-bcf531f00995")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/XnaControls/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("XnaControls")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("XnaControls")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("930f4ba3-4270-4c27-9aed-0e259533a9ae")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Microsoft.DwayneNeed/XnaControls/XnaHwndHost.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Microsoft.DwayneNeed.Interop;
6 |
7 | namespace XnaControls
8 | {
9 | public class XnaHwndHost : HwndHostEx
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------