forked from microsoftarchive/msdn-code-gallery-microsoft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sample code for sensorsandlocation
- Loading branch information
TerryFei
committed
May 21, 2020
1 parent
761a6a4
commit 72423fd
Showing
200 changed files
with
23,536 additions
and
0 deletions.
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
...ws7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/MsdnReader.exe.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="MsdnReader.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="SceReaderSample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="SCEReaderSample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="NewsReaderSample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
</sectionGroup> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="MsdnReader.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="SceReaderSample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="SCEReaderSample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="NewsReaderSample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<connectionStrings /> | ||
<applicationSettings> | ||
<MsdnReader.Properties.Settings> | ||
<setting name="DataFeedUri" serializeAs="String"> | ||
<value>http://windowsclient.net/appfeeds/masterfeed.xml</value> | ||
</setting> | ||
<setting name="UseDesignFeedInDebug" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="SubscriptionServiceUri" serializeAs="String"> | ||
<value>ipc://SubscriptionCenter/SubscriptionService</value> | ||
</setting> | ||
<setting name="CompanyName" serializeAs="String"> | ||
<value>MSDN Reader</value> | ||
</setting> | ||
<setting name="SubscriptionServiceSignalPrefix" serializeAs="String"> | ||
<value>SubscriptionCenter</value> | ||
</setting> | ||
<setting name="EnableJournalNavigationOnInput" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="ApplicationName" serializeAs="String"> | ||
<value>MsdnReader</value> | ||
</setting> | ||
<setting name="SavedDataExtension" serializeAs="String"> | ||
<value>.msdn-story</value> | ||
</setting> | ||
<setting name="ChannelPortName" serializeAs="String"> | ||
<value>MsdnReaderChannel</value> | ||
</setting> | ||
</MsdnReader.Properties.Settings> | ||
<SceReaderSample.Properties.Settings> | ||
<setting name="DataFeedUri" serializeAs="String"> | ||
<value>http://newsreader:8080/dp/masterfeed.xml</value> | ||
</setting> | ||
<setting name="LogUploadUri" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="CounterUploadUri" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DataUpdateFrequency" serializeAs="String"> | ||
<value>00:30:00</value> | ||
</setting> | ||
<setting name="UseDesignFeedInDebug" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="ApplicationName" serializeAs="String"> | ||
<value>Sample SCE Reader</value> | ||
</setting> | ||
<setting name="SavedDataExtension" serializeAs="String"> | ||
<value>.sample-sce-story</value> | ||
</setting> | ||
<setting name="SubscriptionServiceUri" serializeAs="String"> | ||
<value>ipc://SubscriptionCenter/SubscriptionService</value> | ||
</setting> | ||
<setting name="ChannelPortName" serializeAs="String"> | ||
<value>SampleSCEReaderChannel</value> | ||
</setting> | ||
<setting name="CompanyName" serializeAs="String"> | ||
<value>Sample</value> | ||
</setting> | ||
<setting name="SubscriptionServiceSignalPrefix" serializeAs="String"> | ||
<value>SubscriptionCenter</value> | ||
</setting> | ||
<setting name="EnableJournalNavigationOnInput" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
</SceReaderSample.Properties.Settings> | ||
</applicationSettings> | ||
<userSettings> | ||
<MsdnReader.Properties.Settings> | ||
<setting name="StoryViewerZoom" serializeAs="String"> | ||
<value>100</value> | ||
</setting> | ||
<setting name="TransitionsEnabled" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="FetchLocalDataSynchronously" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="MainWindowBounds" serializeAs="String"> | ||
<value>Empty</value> | ||
</setting> | ||
<setting name="SaveMainWindowBounds" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="MainWindowState" serializeAs="String"> | ||
<value>Normal</value> | ||
</setting> | ||
</MsdnReader.Properties.Settings> | ||
<SceReaderSample.Properties.Settings> | ||
<setting name="StoryViewerZoom" serializeAs="String"> | ||
<value>100</value> | ||
</setting> | ||
<setting name="TransitionsEnabled" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="FetchLocalDataSynchronously" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="MainWindowBounds" serializeAs="String"> | ||
<value>Empty</value> | ||
</setting> | ||
<setting name="SaveMainWindowBounds" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="MainWindowState" serializeAs="String"> | ||
<value>Normal</value> | ||
</setting> | ||
</SceReaderSample.Properties.Settings> | ||
</userSettings> | ||
</configuration> |
Binary file added
BIN
+45 KB
...le/Windows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/SLWrapper.dll
Binary file not shown.
Binary file added
BIN
+332 KB
...le/Windows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/SceReader.dll
Binary file not shown.
Binary file added
BIN
+76 KB
...ows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/SubscriptionSync.dll
Binary file not shown.
Binary file added
BIN
+140 KB
.../Windows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/sqlceer35EN.dll
Binary file not shown.
Binary file added
BIN
+54.6 KB
...le/Windows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/sqlceme35.dll
Binary file not shown.
Binary file added
BIN
+554 KB
...le/Windows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/sqlceqp35.dll
Binary file not shown.
Binary file added
BIN
+305 KB
...le/Windows7IntegrationLibrary_Sensor_and_Location/Demo/MSDN Reader/Binaries/sqlcese35.dll
Binary file not shown.
82 changes: 82 additions & 0 deletions
82
...Library_Sensor_and_Location/Demo/MSDN Reader/Sources/MsdnReader/Commands/debugcommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
//--------------------------------------------------------------------------- | ||
// | ||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF | ||
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A | ||
// PARTICULAR PURPOSE. | ||
// | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// | ||
//--------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Windows.Input; | ||
|
||
namespace MsdnReader | ||
{ | ||
#if DEBUG | ||
/// <summary> | ||
/// Debug-only commands | ||
/// </summary> | ||
public sealed class DebugCommands | ||
{ | ||
public static GarbageCollectCommand GarbageCollectCommand | ||
{ | ||
get { return _garbageCollectCommand; } | ||
} | ||
|
||
private static GarbageCollectCommand _garbageCollectCommand = new GarbageCollectCommand(); | ||
} | ||
|
||
public abstract class DebugCommand : ICommand | ||
{ | ||
#region ICommand Members | ||
|
||
public bool CanExecute(object parameter) | ||
{ | ||
return CanExecuteInternal(parameter); | ||
} | ||
|
||
public event EventHandler CanExecuteChanged | ||
{ | ||
add { CommandManager.RequerySuggested += value; } | ||
remove { CommandManager.RequerySuggested -= value; } | ||
} | ||
|
||
public void Execute(object parameter) | ||
{ | ||
ExecuteInternal(parameter); | ||
} | ||
|
||
#endregion | ||
|
||
|
||
protected virtual void ExecuteInternal(object parameter) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteInternal(object parameter) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Forces garbage collection | ||
/// </summary> | ||
public sealed class GarbageCollectCommand : DebugCommand | ||
{ | ||
protected override void ExecuteInternal(object parameter) | ||
{ | ||
GC.Collect(2); | ||
GC.WaitForPendingFinalizers(); | ||
GC.Collect(2); | ||
GC.WaitForPendingFinalizers(); | ||
} | ||
} | ||
#endif | ||
} |
105 changes: 105 additions & 0 deletions
105
...nLibrary_Sensor_and_Location/Demo/MSDN Reader/Sources/MsdnReader/Commands/msdncommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
//--------------------------------------------------------------------------- | ||
// | ||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF | ||
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A | ||
// PARTICULAR PURPOSE. | ||
// | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// | ||
//--------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.SceReader.View; | ||
using MsdnReader; | ||
using System.Windows.Input; | ||
using Microsoft.SceReader.Controls; | ||
|
||
namespace MsdnReader | ||
{ | ||
public class MsdnCommands | ||
{ | ||
public MsdnCommands(ViewManager viewManager) | ||
{ | ||
_msdnStartSyncCommand = new MsdnStartSyncCommand(viewManager as MsdnViewManager); | ||
_openImageViewerCommand = new OpenImageViewerCommand(viewManager as MsdnViewManager); | ||
} | ||
|
||
public MsdnStartSyncCommand MsdnStartSyncCommand | ||
{ | ||
get | ||
{ | ||
return _msdnStartSyncCommand; | ||
} | ||
} | ||
|
||
public OpenImageViewerCommand OpenImageViewerCommand | ||
{ | ||
get | ||
{ | ||
return _openImageViewerCommand; | ||
} | ||
} | ||
|
||
private OpenImageViewerCommand _openImageViewerCommand; | ||
private MsdnStartSyncCommand _msdnStartSyncCommand; | ||
} | ||
|
||
public class MsdnStartSyncCommand : ViewCommand | ||
{ | ||
public MsdnStartSyncCommand(MsdnViewManager viewManager) : base(viewManager) { } | ||
|
||
protected override bool CanExecuteInternal(object parameter) | ||
{ | ||
return (!MsdnServiceProvider.SubscriptionServiceManager.IsServiceUpdateInProgress | ||
&& ViewManager.SyncCommands.StartSyncCommand.CanExecute(parameter)); | ||
} | ||
|
||
protected override void ExecuteInternal(object parameter) | ||
{ | ||
if (ViewManager.SyncCommands.StartSyncCommand.CanExecute(parameter) && | ||
!MsdnServiceProvider.SubscriptionServiceManager.IsServiceUpdateInProgress) | ||
{ | ||
ViewManager.SyncCommands.StartSyncCommand.Execute(parameter); | ||
} | ||
} | ||
} | ||
|
||
public class OpenImageViewerCommand : ViewCommand | ||
{ | ||
public OpenImageViewerCommand(MsdnViewManager viewManager) : base(viewManager) { } | ||
|
||
/// <summary> | ||
/// CanExecute always returns true, since this comand is only attached to StoryImageControls in theory we cna always execute it | ||
/// </summary> | ||
/// <param name="parameter"></param> | ||
/// <returns></returns> | ||
protected override bool CanExecuteInternal(object parameter) | ||
{ | ||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// Execute ensures that parameter of the right type to get Story/ ImageReference Info | ||
/// </summary> | ||
/// <param name="parameter"></param> | ||
protected override void ExecuteInternal(object parameter) | ||
{ | ||
// Image viewer expands on the data in StoryImageControl, needs that control as parameter | ||
StoryImageControl control = parameter as StoryImageControl; | ||
if (control != null) | ||
{ | ||
// Have ViewManager open the window | ||
MsdnViewManager viewManager = this.ViewManager as MsdnViewManager; | ||
if (viewManager != null) | ||
{ | ||
viewManager.OpenImageViewerWindow(control); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.