diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..1ff0c4230 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 2377b3337..5cc538a62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,79 +1,90 @@ -*.pidb -*.userprefs -*.swp -*.DS_Store -*.nib -*.suo -*.user -*.pfx -*/bin/* -*/obj/* -*/*/bin/* -*/*/obj/* -*/*/*/bin/* -*/*/*/obj/* -*_ReSharper.*/ -*/*/*/Resource.Designer.cs -MWC/MWC.Core/Bin/* -MWC/MWC.Droid/Bin/* -MWC/MWC.Droid/Resources/Resource.Designer.cs -MWC/MWC.WP7/Bin/* -MWC/MWC.Core.WP7/Bin/Debug/**.db -/TaskyPro/.bundle/ -/TaskyPro/.idea/ -/TaskyPro/.irb-history -RazorTodo/*/Components -/TaskyPro-Calabash/.irb-history -/TaskyPro-Calabash/.idea/ -/TaskyPro-Calabash/.bundle/ -/TaskyPro-Calabash/test_servers/881cf2ba5a1f5085e65ee49f9c92e00c_0.4.21.apk -/TaskyPro-Calabash/test_servers/ -/TaskyPro-Calabash/rake_env -TaskyPro-Calabash/screenshot*.png -/HelloTestCloudWorld/packages/ -/HelloTestCloudWorld/rake_env -/HelloTestCloudWorld/HelloWorld.Android/mono.samples.helloworld.apk -/HelloTestCloudWorld/.irb-history -/HelloTestCloudWorld/.idea/ -/HelloTestCloudWorld/test_servers/ -CreditCardValidation/CreditCardValidation-Calabash/.idea -CreditCardValidation/CreditCardValidation-UITest/packages/Xamarin.UITest.* -CreditCardValidation/.idea -CreditCardValidation/UITest/packages/Xamarin.UITest.0.5.0 -TaskyPro/packages/Xamarin.UITest.0.5.0 -TaskyPro/packages/Castle.Core.3.3.1 -TaskyPro/packages/Ninject.3.2.2.0 -TaskyPro/packages/Ninject.Extensions.Factory.3.2.1.0 -TaskyPro/packages/Portable.Ninject.3.3 -TaskyPro/packages/NUnit.2.6.3 -TaskyPro/packages/FluentAssertions.3.2.1 -.idea -TaskyPro/test_servers -TaskyPro/Components -TaskyPro/packages/Xamarin.UITest.0.5.1 -TaskyPro-Calabash/Components/calabash-10.1.1.png -TaskyPro-Calabash/Components/calabash-10.1.1.info -TaskyPro-Calabash/Components/calabash-10.1.1 -CreditCardValidation/UITest/packages/Xamarin.UITest.0.6.1 -CreditCardValidation/UITest/packages/NUnit.2.6.3 -CreditCardValidation/UITest/packages/Xamarin.UITest.0.6.4 -TestCloud/CreditCardValidation/CreditCardValidation-UITest/packages/NUnit.2.6.3 -TestCloud/CreditCardValidation/CreditCardValidation-UITest/packages/Xamarin.UITest.0.6.5 -TestCloud/CreditCardValidation/CreditCardValidation-UITest/Components -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Common/bin -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Common/obj -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Droid/obj -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.iOS/bin -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Droid/bin -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.iOS/obj -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Tests/obj -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Tests/bin -TestCloud/CreditCardValidation/CreditCardValidation-Calabash/calabash.framework -TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.iOS/obj -TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Droid/obj -TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Common/obj -TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Common/bin -TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Droid/bin -TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.iOS/bin -TestCloud/CreditCardValidation/CreditCardValidation-UITest/packages/Xamarin.UITest.0.6.6 -TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Tests/xtc-apikey \ No newline at end of file +Components +packages +bin +obj + +*.pidb +*.userprefs +*.swp +*.DS_Store +*.nib +*.suo +*.user +*.pfx +*.lock.json +*.nuget.props +*.nuget.targets +.vs + +# ignore Xamarin.Android Resource.Designer.cs files +**/*.Droid/**/[Rr]esource.[Dd]esigner.cs +**/*.Android/**/[Rr]esource.[Dd]esigner.cs +**/Android/**/[Rr]esource.[Dd]esigner.cs + +*/bin/* +*/obj/* +*/*/bin/* +*/*/obj/* +*/*/*/bin/* +*/*/*/obj/* +*_ReSharper.*/ + +MWC/MWC.Core/Bin/* +MWC/MWC.Droid/Bin/* +MWC/MWC.WP7/Bin/* +MWC/MWC.Core.WP7/Bin/Debug/**.db + +RazorTodo/*/Components + +/TaskyPro/.bundle/ +/TaskyPro/.idea/ +/TaskyPro/.irb-history +/TaskyPro-Calabash/.irb-history +/TaskyPro-Calabash/.idea/ +/TaskyPro-Calabash/.bundle/ +/TaskyPro-Calabash/test_servers/881cf2ba5a1f5085e65ee49f9c92e00c_0.4.21.apk +/TaskyPro-Calabash/test_servers/ +/TaskyPro-Calabash/rake_env + +/HelloTestCloudWorld/rake_env +/HelloTestCloudWorld/HelloWorld.Android/mono.samples.helloworld.apk +/HelloTestCloudWorld/.irb-history +/HelloTestCloudWorld/.idea/ +/HelloTestCloudWorld/test_servers/ + +CreditCardValidation/CreditCardValidation-Calabash/.idea +CreditCardValidation/CreditCardValidation-UITest/packages/Xamarin.UITest.* +CreditCardValidation/.idea +CreditCardValidation/UITest/packages/Xamarin.UITest.0.5.0 + +.idea + +TaskyPro/test_servers +TaskyPro-Calabash/screenshot*.png + +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Common/bin +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Common/obj +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Droid/obj +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.iOS/bin +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Droid/bin +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.iOS/obj +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Tests/obj +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Tests/bin +TestCloud/CreditCardValidation/CreditCardValidation-Calabash/calabash.framework +TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.iOS/obj +TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Droid/obj +TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Common/obj +TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Common/bin +TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.Droid/bin +TestCloud/CreditCardValidation/CreditCardValidation-Start/CreditCardValidation.iOS/bin +TestCloud/CreditCardValidation/CreditCardValidation-UITest/CreditCardValidation.Tests/xtc-apikey + +CoinTime/CoinTime/Assets/Content/animations/coinanimations.aeproperties +CoinTime/CoinTime/Assets/Content/animations/dooranimations.aeproperties +CoinTime/CoinTime/Assets/Content/animations/playeranimations.aeproperties +CoinTime/CoinTime/Assets/Content/animations/propanimations.aeproperties + +CCDrawNode/Screenshots/Thumbs.db +FruityFalls/FruityFalls/FruityFalls.Android/Assets/Content/Sounds/AndroidObj/ +FruityFalls/FruityFalls/FruityFalls.Android/Assets/Content/Sounds/iOSObj/ +.vscode/settings.json diff --git a/AnalogClock/AnalogClock.Android/AnalogClock.Android.csproj b/AnalogClock/AnalogClock.Android/AnalogClock.Android.csproj index e4eb83e1d..40f1a2be4 100644 --- a/AnalogClock/AnalogClock.Android/AnalogClock.Android.csproj +++ b/AnalogClock/AnalogClock.Android/AnalogClock.Android.csproj @@ -14,12 +14,11 @@ Resource Resources Assets - true + false AnalogClock.Android - - + v8.1 Properties\AndroidManifest.xml - armeabi,armeabi-v7a,x86 + armeabi-v7a,x86 @@ -57,9 +56,6 @@ - - ClockModel.cs - @@ -70,7 +66,8 @@ - + + diff --git a/AnalogClock/AnalogClock.Android/Properties/AndroidManifest.xml b/AnalogClock/AnalogClock.Android/Properties/AndroidManifest.xml index e5f819dd5..d31b6e89a 100644 --- a/AnalogClock/AnalogClock.Android/Properties/AndroidManifest.xml +++ b/AnalogClock/AnalogClock.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/AnalogClock/AnalogClock.Common/AnalogClock.Common.csproj b/AnalogClock/AnalogClock.Common/AnalogClock.Common.csproj deleted file mode 100644 index e57971bef..000000000 --- a/AnalogClock/AnalogClock.Common/AnalogClock.Common.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Debug - AnyCPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D} - Library - Properties - AnalogClock.Common - AnalogClock.Common - v4.5.1 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AnalogClock/AnalogClock.Common/AnalogClock.Common.projitems b/AnalogClock/AnalogClock.Common/AnalogClock.Common.projitems new file mode 100644 index 000000000..0f53e5207 --- /dev/null +++ b/AnalogClock/AnalogClock.Common/AnalogClock.Common.projitems @@ -0,0 +1,14 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {29808547-B68A-420A-801A-B1B2A7375B8F} + + + AnalogClock.Common + + + + + \ No newline at end of file diff --git a/AnalogClock/AnalogClock.Common/AnalogClock.Common.shproj b/AnalogClock/AnalogClock.Common/AnalogClock.Common.shproj new file mode 100644 index 000000000..4463ee1b8 --- /dev/null +++ b/AnalogClock/AnalogClock.Common/AnalogClock.Common.shproj @@ -0,0 +1,11 @@ + + + + {29808547-B68A-420A-801A-B1B2A7375B8F} + + + + + + + \ No newline at end of file diff --git a/AnalogClock/AnalogClock.Common/Properties/AssemblyInfo.cs b/AnalogClock/AnalogClock.Common/Properties/AssemblyInfo.cs deleted file mode 100644 index 6ca4b7751..000000000 --- a/AnalogClock/AnalogClock.Common/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AnalogClock.Common")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AnalogClock.Common")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4b9c2a0e-26a1-46c0-b544-9329f30ffe78")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AnalogClock/AnalogClock.WindowsPhone/AnalogClock.WindowsPhone.csproj b/AnalogClock/AnalogClock.WindowsPhone/AnalogClock.WindowsPhone.csproj deleted file mode 100644 index f5fe3fb6e..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/AnalogClock.WindowsPhone.csproj +++ /dev/null @@ -1,161 +0,0 @@ - - - - Debug - AnyCPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - AnalogClock.WindowsPhone - AnalogClock.WindowsPhone - WindowsPhone - v8.0 - $(TargetFrameworkVersion) - true - - - true - true - AnalogClock.WindowsPhone_$(Configuration)_$(Platform).xap - Properties\AppManifest.xml - AnalogClock.WindowsPhone.App - true - 11.0 - true - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - true - full - false - Bin\x86\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\x86\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - true - full - false - Bin\ARM\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\ARM\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - - ClockModel.cs - - - App.xaml - - - - MainPage.xaml - - - - True - True - AppResources.resx - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - Designer - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - PublicResXFileCodeGenerator - AppResources.Designer.cs - - - - - - - \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/App.xaml b/AnalogClock/AnalogClock.WindowsPhone/App.xaml deleted file mode 100644 index 2c19745ba..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/App.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/App.xaml.cs b/AnalogClock/AnalogClock.WindowsPhone/App.xaml.cs deleted file mode 100644 index 0e9c089f3..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/App.xaml.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using System.Diagnostics; -using System.Resources; -using System.Windows; -using System.Windows.Markup; -using System.Windows.Navigation; -using Microsoft.Phone.Controls; -using Microsoft.Phone.Shell; -using AnalogClock.WindowsPhone.Resources; - -namespace AnalogClock.WindowsPhone -{ - public partial class App : Application - { - /// - /// Provides easy access to the root frame of the Phone Application. - /// - /// The root frame of the Phone Application. - public static PhoneApplicationFrame RootFrame { get; private set; } - - /// - /// Constructor for the Application object. - /// - public App() - { - // Global handler for uncaught exceptions. - UnhandledException += Application_UnhandledException; - - // Standard XAML initialization - InitializeComponent(); - - // Phone-specific initialization - InitializePhoneApplication(); - - // Language display initialization - InitializeLanguage(); - - // Show graphics profiling information while debugging. - if (Debugger.IsAttached) - { - // Display the current frame rate counters. - Application.Current.Host.Settings.EnableFrameRateCounter = true; - - // Show the areas of the app that are being redrawn in each frame. - //Application.Current.Host.Settings.EnableRedrawRegions = true; - - // Enable non-production analysis visualization mode, - // which shows areas of a page that are handed off to GPU with a colored overlay. - //Application.Current.Host.Settings.EnableCacheVisualization = true; - - // Prevent the screen from turning off while under the debugger by disabling - // the application's idle detection. - // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run - // and consume battery power when the user is not using the phone. - PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; - } - - } - - // Code to execute when the application is launching (eg, from Start) - // This code will not execute when the application is reactivated - private void Application_Launching(object sender, LaunchingEventArgs e) - { - } - - // Code to execute when the application is activated (brought to foreground) - // This code will not execute when the application is first launched - private void Application_Activated(object sender, ActivatedEventArgs e) - { - } - - // Code to execute when the application is deactivated (sent to background) - // This code will not execute when the application is closing - private void Application_Deactivated(object sender, DeactivatedEventArgs e) - { - } - - // Code to execute when the application is closing (eg, user hit Back) - // This code will not execute when the application is deactivated - private void Application_Closing(object sender, ClosingEventArgs e) - { - } - - // Code to execute if a navigation fails - private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) - { - if (Debugger.IsAttached) - { - // A navigation has failed; break into the debugger - Debugger.Break(); - } - } - - // Code to execute on Unhandled Exceptions - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - if (Debugger.IsAttached) - { - // An unhandled exception has occurred; break into the debugger - Debugger.Break(); - } - } - - #region Phone application initialization - - // Avoid double-initialization - private bool phoneApplicationInitialized = false; - - // Do not add any additional code to this method - private void InitializePhoneApplication() - { - if (phoneApplicationInitialized) - return; - - // Create the frame but don't set it as RootVisual yet; this allows the splash - // screen to remain active until the application is ready to render. - RootFrame = new PhoneApplicationFrame(); - RootFrame.Navigated += CompleteInitializePhoneApplication; - - // Handle navigation failures - RootFrame.NavigationFailed += RootFrame_NavigationFailed; - - // Handle reset requests for clearing the backstack - RootFrame.Navigated += CheckForResetNavigation; - - // Ensure we don't initialize again - phoneApplicationInitialized = true; - } - - // Do not add any additional code to this method - private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) - { - // Set the root visual to allow the application to render - if (RootVisual != RootFrame) - RootVisual = RootFrame; - - // Remove this handler since it is no longer needed - RootFrame.Navigated -= CompleteInitializePhoneApplication; - } - - private void CheckForResetNavigation(object sender, NavigationEventArgs e) - { - // If the app has received a 'reset' navigation, then we need to check - // on the next navigation to see if the page stack should be reset - if (e.NavigationMode == NavigationMode.Reset) - RootFrame.Navigated += ClearBackStackAfterReset; - } - - private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) - { - // Unregister the event so it doesn't get called again - RootFrame.Navigated -= ClearBackStackAfterReset; - - // Only clear the stack for 'new' (forward) and 'refresh' navigations - if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) - return; - - // For UI consistency, clear the entire page stack - while (RootFrame.RemoveBackEntry() != null) - { - ; // do nothing - } - } - - #endregion - - // Initialize the app's font and flow direction as defined in its localized resource strings. - // - // To ensure that the font of your application is aligned with its supported languages and that the - // FlowDirection for each of those languages follows its traditional direction, ResourceLanguage - // and ResourceFlowDirection should be initialized in each resx file to match these values with that - // file's culture. For example: - // - // AppResources.es-ES.resx - // ResourceLanguage's value should be "es-ES" - // ResourceFlowDirection's value should be "LeftToRight" - // - // AppResources.ar-SA.resx - // ResourceLanguage's value should be "ar-SA" - // ResourceFlowDirection's value should be "RightToLeft" - // - // For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072. - // - private void InitializeLanguage() - { - try - { - // Set the font to match the display language defined by the - // ResourceLanguage resource string for each supported language. - // - // Fall back to the font of the neutral language if the Display - // language of the phone is not supported. - // - // If a compiler error is hit then ResourceLanguage is missing from - // the resource file. - RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage); - - // Set the FlowDirection of all elements under the root frame based - // on the ResourceFlowDirection resource string for each - // supported language. - // - // If a compiler error is hit then ResourceFlowDirection is missing from - // the resource file. - FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection); - RootFrame.FlowDirection = flow; - } - catch - { - // If an exception is caught here it is most likely due to either - // ResourceLangauge not being correctly set to a supported language - // code or ResourceFlowDirection is set to a value other than LeftToRight - // or RightToLeft. - - if (Debugger.IsAttached) - { - Debugger.Break(); - } - - throw; - } - } - } -} \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/AlignmentGrid.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/AlignmentGrid.png deleted file mode 100644 index f7d2e9780..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/AlignmentGrid.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/ApplicationIcon.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/ApplicationIcon.png deleted file mode 100644 index 7d95d4e08..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/ApplicationIcon.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileLarge.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileLarge.png deleted file mode 100644 index e0c59ac01..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileLarge.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileMedium.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileMedium.png deleted file mode 100644 index e93b89d60..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileMedium.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileSmall.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileSmall.png deleted file mode 100644 index 550b1b5e8..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/FlipCycleTileSmall.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/IconicTileMediumLarge.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/IconicTileMediumLarge.png deleted file mode 100644 index 686e6b53f..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/IconicTileMediumLarge.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/IconicTileSmall.png b/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/IconicTileSmall.png deleted file mode 100644 index d4b5ede1b..000000000 Binary files a/AnalogClock/AnalogClock.WindowsPhone/Assets/Tiles/IconicTileSmall.png and /dev/null differ diff --git a/AnalogClock/AnalogClock.WindowsPhone/LocalizedStrings.cs b/AnalogClock/AnalogClock.WindowsPhone/LocalizedStrings.cs deleted file mode 100644 index 3c8abf36e..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/LocalizedStrings.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AnalogClock.WindowsPhone.Resources; - -namespace AnalogClock.WindowsPhone -{ - /// - /// Provides access to string resources. - /// - public class LocalizedStrings - { - private static AppResources _localizedResources = new AppResources(); - - public AppResources LocalizedResources { get { return _localizedResources; } } - } -} \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/MainPage.xaml b/AnalogClock/AnalogClock.WindowsPhone/MainPage.xaml deleted file mode 100644 index c526ad1e4..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/MainPage.xaml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/MainPage.xaml.cs b/AnalogClock/AnalogClock.WindowsPhone/MainPage.xaml.cs deleted file mode 100644 index b36d5fb77..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/MainPage.xaml.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Navigation; -using Microsoft.Phone.Controls; -using Microsoft.Phone.Shell; -using AnalogClock.WindowsPhone.Resources; - -namespace AnalogClock.WindowsPhone -{ - public partial class MainPage : PhoneApplicationPage - { - // Constructor - public MainPage() - { - InitializeComponent(); - - // Sample code to localize the ApplicationBar - //BuildLocalizedApplicationBar(); - } - - // Sample code for building a localized ApplicationBar - //private void BuildLocalizedApplicationBar() - //{ - // // Set the page's ApplicationBar to a new instance of ApplicationBar. - // ApplicationBar = new ApplicationBar(); - - // // Create a new button and set the text value to the localized string from AppResources. - // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); - // appBarButton.Text = AppResources.AppBarButtonText; - // ApplicationBar.Buttons.Add(appBarButton); - - // // Create a new menu item with the localized string from AppResources. - // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); - // ApplicationBar.MenuItems.Add(appBarMenuItem); - //} - } -} \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/Properties/AppManifest.xml b/AnalogClock/AnalogClock.WindowsPhone/Properties/AppManifest.xml deleted file mode 100644 index 6712a1178..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/Properties/AppManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/AnalogClock/AnalogClock.WindowsPhone/Properties/AssemblyInfo.cs b/AnalogClock/AnalogClock.WindowsPhone/Properties/AssemblyInfo.cs deleted file mode 100644 index 9a6ab7c39..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AnalogClock.WindowsPhone")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AnalogClock.WindowsPhone")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4840441f-5a92-4556-8d65-fff029892702")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/AnalogClock/AnalogClock.WindowsPhone/Properties/WMAppManifest.xml b/AnalogClock/AnalogClock.WindowsPhone/Properties/WMAppManifest.xml deleted file mode 100644 index 7da47b96d..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/Properties/WMAppManifest.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - Assets\ApplicationIcon.png - - - - - - - - - - - - - - Assets\Tiles\FlipCycleTileSmall.png - 0 - Assets\Tiles\FlipCycleTileMedium.png - AnalogClock.WindowsPhone - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AnalogClock/AnalogClock.WindowsPhone/Resources/AppResources.Designer.cs b/AnalogClock/AnalogClock.WindowsPhone/Resources/AppResources.Designer.cs deleted file mode 100644 index 64b318420..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/Resources/AppResources.Designer.cs +++ /dev/null @@ -1,127 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17626 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace AnalogClock.WindowsPhone.Resources -{ - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class AppResources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal AppResources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager - { - get - { - if (object.ReferenceEquals(resourceMan, null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AnalogClock.WindowsPhone.Resources.AppResources", typeof(AppResources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to LeftToRight. - /// - public static string ResourceFlowDirection - { - get - { - return ResourceManager.GetString("ResourceFlowDirection", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to us-EN. - /// - public static string ResourceLanguage - { - get - { - return ResourceManager.GetString("ResourceLanguage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MY APPLICATION. - /// - public static string ApplicationTitle - { - get - { - return ResourceManager.GetString("ApplicationTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to button. - /// - public static string AppBarButtonText - { - get - { - return ResourceManager.GetString("AppBarButtonText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to menu item. - /// - public static string AppBarMenuItemText - { - get - { - return ResourceManager.GetString("AppBarMenuItemText", resourceCulture); - } - } - } -} diff --git a/AnalogClock/AnalogClock.WindowsPhone/Resources/AppResources.resx b/AnalogClock/AnalogClock.WindowsPhone/Resources/AppResources.resx deleted file mode 100644 index 529a19431..000000000 --- a/AnalogClock/AnalogClock.WindowsPhone/Resources/AppResources.resx +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - LeftToRight - Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language - - - en-US - Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language. - - - MY APPLICATION - - - add - - - Menu Item - - \ No newline at end of file diff --git a/AnalogClock/AnalogClock.iOS/AnalogClock.iOS.csproj b/AnalogClock/AnalogClock.iOS/AnalogClock.iOS.csproj index cd2eb5c3a..7b60a6e85 100644 --- a/AnalogClock/AnalogClock.iOS/AnalogClock.iOS.csproj +++ b/AnalogClock/AnalogClock.iOS/AnalogClock.iOS.csproj @@ -26,7 +26,8 @@ None Entitlements.plist true - i386 + i386, x86_64 + NSUrlSessionHandler full @@ -38,7 +39,8 @@ None false Entitlements.plist - i386 + i386, x86_64 + NSUrlSessionHandler true @@ -52,7 +54,8 @@ Entitlements.plist true iPhone Developer - ARMv7 + ARMv7, ARM64 + NSUrlSessionHandler full @@ -65,6 +68,7 @@ false iPhone Developer ARMv7, ARM64 + NSUrlSessionHandler full @@ -79,6 +83,7 @@ Automatic:AdHoc iPhone Distribution ARMv7, ARM64 + NSUrlSessionHandler full @@ -92,6 +97,7 @@ Automatic:AppStore iPhone Distribution ARMv7, ARM64 + NSUrlSessionHandler @@ -99,9 +105,6 @@ - - - @@ -111,9 +114,26 @@ - - ClockModel.cs - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..df3f4a695 --- /dev/null +++ b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,220 @@ +{ + "images": [ + { + "filename": "Icon40x40.png", + "size": "20x20", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon60x60.png", + "size": "20x20", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon58x58.png", + "size": "29x29", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon87x87.png", + "size": "29x29", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon80x80.png", + "size": "40x40", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon120x120.png", + "size": "40x40", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon120x120.png", + "size": "60x60", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon180x180.png", + "size": "60x60", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon20x20.png", + "size": "20x20", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon40x40.png", + "size": "20x20", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon29x29.png", + "size": "29x29", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon58x58.png", + "size": "29x29", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon40x40.png", + "size": "40x40", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon80x80.png", + "size": "40x40", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon167x167.png", + "size": "83.5x83.5", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon76x76.png", + "size": "76x76", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon152x152.png", + "size": "76x76", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon1024x1024.png", + "size": "1024x1024", + "scale": "1x", + "idiom": "ios-marketing" + }, + { + "role": "notificationCenter", + "size": "24x24", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "notificationCenter", + "size": "27.5x27.5", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "companionSettings", + "size": "29x29", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "companionSettings", + "size": "29x29", + "scale": "3x", + "idiom": "watch" + }, + { + "role": "appLauncher", + "size": "40x40", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "longLook", + "size": "44x44", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "quickLook", + "size": "86x86", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "quickLook", + "size": "98x98", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "size": "16x16", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "16x16", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "32x32", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "32x32", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "128x128", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "128x128", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "256x256", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "256x256", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "512x512", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "512x512", + "scale": "2x", + "idiom": "mac" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024x1024.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024x1024.png new file mode 100644 index 000000000..830b23933 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024x1024.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon120x120.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon120x120.png new file mode 100644 index 000000000..a91bfc568 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon120x120.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon152x152.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon152x152.png new file mode 100644 index 000000000..a2882210f Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon152x152.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon167x167.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon167x167.png new file mode 100644 index 000000000..2badfaa18 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon167x167.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon180x180.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon180x180.png new file mode 100644 index 000000000..c2f79a690 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon180x180.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon20x20.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon20x20.png new file mode 100644 index 000000000..2af5ac48d Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon20x20.png differ diff --git a/TaskyPortable/TaskyiOS/Resources/Icon-Small.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon29x29.png similarity index 100% rename from TaskyPortable/TaskyiOS/Resources/Icon-Small.png rename to AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon29x29.png diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon40x40.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon40x40.png new file mode 100644 index 000000000..ad7e66171 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon40x40.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon58x58.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon58x58.png new file mode 100644 index 000000000..39c9c087a Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon58x58.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon60x60.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon60x60.png new file mode 100644 index 000000000..70584f903 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon60x60.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon76x76.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon76x76.png new file mode 100644 index 000000000..f8ef4696c Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon76x76.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon80x80.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon80x80.png new file mode 100644 index 000000000..cc63bbf90 Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon80x80.png differ diff --git a/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon87x87.png b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon87x87.png new file mode 100644 index 000000000..ee697547a Binary files /dev/null and b/AnalogClock/AnalogClock.iOS/Assets.xcassets/AppIcon.appiconset/Icon87x87.png differ diff --git a/AnalogClock/AnalogClock.iOS/Info.plist b/AnalogClock/AnalogClock.iOS/Info.plist index a046d5f70..162ab2e1a 100644 --- a/AnalogClock/AnalogClock.iOS/Info.plist +++ b/AnalogClock/AnalogClock.iOS/Info.plist @@ -1,4 +1,4 @@ - + @@ -13,7 +13,7 @@ LSRequiresIPhoneOS MinimumOSVersion - 7.0 + 9.0 UIDeviceFamily 1 @@ -28,5 +28,9 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + CFBundleName + AnalogClock.iOS + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset diff --git a/AnalogClock/AnalogClock.sln b/AnalogClock/AnalogClock.sln index 41c4d319c..b69e76761 100644 --- a/AnalogClock/AnalogClock.sln +++ b/AnalogClock/AnalogClock.sln @@ -1,13 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalogClock.WindowsPhone", "AnalogClock.WindowsPhone\AnalogClock.WindowsPhone.csproj", "{B5049529-ADAE-489C-8C78-C2D18B2C4E00}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalogClock.iOS", "AnalogClock.iOS\AnalogClock.iOS.csproj", "{69DC2865-6BFF-4172-857F-64DA4787A033}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalogClock.Android", "AnalogClock.Android\AnalogClock.Android.csproj", "{992B695F-39B4-4D20-A4B4-DA619B9893C6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalogClock.Common", "AnalogClock.Common\AnalogClock.Common.csproj", "{3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}" +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AnalogClock.Common", "AnalogClock.Common\AnalogClock.Common.shproj", "{29808547-B68A-420A-801A-B1B2A7375B8F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -43,76 +41,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|ARM.Build.0 = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|ARM.Deploy.0 = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|Mixed Platforms.Build.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|Mixed Platforms.Deploy.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|x86.Build.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Ad-Hoc|x86.Deploy.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|Any CPU.Build.0 = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|Any CPU.Deploy.0 = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|ARM.ActiveCfg = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|ARM.Build.0 = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|ARM.Deploy.0 = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|Mixed Platforms.ActiveCfg = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|Mixed Platforms.Build.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|Mixed Platforms.Deploy.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|x86.ActiveCfg = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|x86.Build.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.AppStore|x86.Deploy.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|ARM.ActiveCfg = Debug|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|ARM.Build.0 = Debug|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|ARM.Deploy.0 = Debug|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|Mixed Platforms.Deploy.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|x86.ActiveCfg = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|x86.Build.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Debug|x86.Deploy.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|Any CPU.ActiveCfg = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|Any CPU.Build.0 = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|Any CPU.Deploy.0 = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|ARM.ActiveCfg = Debug|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|ARM.Build.0 = Debug|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|ARM.Deploy.0 = Debug|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|iPhone.ActiveCfg = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|Mixed Platforms.ActiveCfg = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|Mixed Platforms.Build.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|Mixed Platforms.Deploy.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|x86.ActiveCfg = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|x86.Build.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Default|x86.Deploy.0 = Debug|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|Any CPU.Build.0 = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|Any CPU.Deploy.0 = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|ARM.ActiveCfg = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|ARM.Build.0 = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|ARM.Deploy.0 = Release|ARM - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|iPhone.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|Mixed Platforms.Build.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|Mixed Platforms.Deploy.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|x86.ActiveCfg = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|x86.Build.0 = Release|x86 - {B5049529-ADAE-489C-8C78-C2D18B2C4E00}.Release|x86.Deploy.0 = Release|x86 {69DC2865-6BFF-4172-857F-64DA4787A033}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone {69DC2865-6BFF-4172-857F-64DA4787A033}.Ad-Hoc|Any CPU.Build.0 = Ad-Hoc|iPhone {69DC2865-6BFF-4172-857F-64DA4787A033}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone @@ -231,46 +159,6 @@ Global {992B695F-39B4-4D20-A4B4-DA619B9893C6}.Release|Mixed Platforms.Build.0 = Release|Any CPU {992B695F-39B4-4D20-A4B4-DA619B9893C6}.Release|x86.ActiveCfg = Release|Any CPU {992B695F-39B4-4D20-A4B4-DA619B9893C6}.Release|x86.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|Any CPU.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|ARM.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.AppStore|x86.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|ARM.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Debug|x86.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|Any CPU.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|Any CPU.Build.0 = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|ARM.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|iPhone.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|Mixed Platforms.Build.0 = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Default|x86.ActiveCfg = Debug|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|Any CPU.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|ARM.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|iPhone.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3A80358F-CDE0-41AB-BC10-D1BBAACCBF0D}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AnalogClock/Metadata.xml b/AnalogClock/Metadata.xml index b2fc20605..7fa3c070e 100644 --- a/AnalogClock/Metadata.xml +++ b/AnalogClock/Metadata.xml @@ -6,6 +6,6 @@ Graphics, Async Android, iOS, Windows Indie - AnalogClock is a cross platform example displaying a classic clock containing hour, minute, and second hands. + AnalogClock is a cross platform app displaying a classic clock. true diff --git a/AsyncAwait/Droid/Droid.csproj b/AsyncAwait/Droid/Droid.csproj index 587b76a78..5edc733dc 100644 --- a/AsyncAwait/Droid/Droid.csproj +++ b/AsyncAwait/Droid/Droid.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 10.0.0 + 8.0.30703 2.0 {9F8656FD-07A4-44F7-864E-A94E7C27F529} {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -16,6 +16,8 @@ Assets Droid Properties\AndroidManifest.xml + True + v6.0 true @@ -60,5 +62,5 @@ - + \ No newline at end of file diff --git a/AsyncAwait/Droid/MainActivity.cs b/AsyncAwait/Droid/MainActivity.cs index 29749188f..270f3354c 100644 --- a/AsyncAwait/Droid/MainActivity.cs +++ b/AsyncAwait/Droid/MainActivity.cs @@ -59,7 +59,7 @@ public async Task DownloadHomepageAsync() { var httpClient = new HttpClient(); // Xamarin supports HttpClient! - Task contentsTask = httpClient.GetStringAsync("http://xamarin.com/"); // async method! + Task contentsTask = httpClient.GetStringAsync("https://xamarin.com/"); // async method! // await! control returns to the caller and the task continues to run on another thread @@ -74,7 +74,7 @@ public async Task DownloadHomepageAsync() - byte[] imageBytes = await httpClient.GetByteArrayAsync("http://xamarin.com/images/about/team.jpg"); // async method! + byte[] imageBytes = await httpClient.GetByteArrayAsync("https://xamarin.com/content/images/pages/about/team-h.jpg"); // async method! string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string localFilename = "team.jpg"; diff --git a/AsyncAwait/Droid/Properties/AndroidManifest.xml b/AsyncAwait/Droid/Properties/AndroidManifest.xml index 480614548..3010405cf 100644 --- a/AsyncAwait/Droid/Properties/AndroidManifest.xml +++ b/AsyncAwait/Droid/Properties/AndroidManifest.xml @@ -1,7 +1,6 @@  - - - + + \ No newline at end of file diff --git a/AsyncAwait/Metadata.xml b/AsyncAwait/Metadata.xml index fd9631254..7738182d5 100644 --- a/AsyncAwait/Metadata.xml +++ b/AsyncAwait/Metadata.xml @@ -1,11 +1,11 @@ - + 6b59dff2-faca-4bbb-85a7-167e6eb27eb2 false Beginner - + Android, iOS Starter - Cross platform samples for iOS and Android showing image downloads using C# 5's async and await syntax + Cross platform sample for iOS and Android showing image downloads using C# 5's async and await syntax. true diff --git a/AsyncAwait/README.md b/AsyncAwait/README.md index 9399c25fd..7a4ec9d96 100644 --- a/AsyncAwait/README.md +++ b/AsyncAwait/README.md @@ -1,5 +1,14 @@ -AsyncAwait -========== +--- +name: Xamarin - async/await +description: "Using async/await with Xamarin" +page_type: sample +languages: +- csharp +products: +- xamarin +urlFragment: asyncawait +--- +# async/await This sample was first presented in the Xamarin Introduction to C# 5 Async webinar on August 15th, 2013. Re-live the excitement with these links to the video, slides and Xamarin docs. @@ -7,11 +16,11 @@ This sample was first presented in the Xamarin Introduction to C# 5 Async webina [Miguel's slides](http://www.slideshare.net/Xamarin/xamarin-asyncwebinar-2013) [Craig's slides](http://www.slideshare.net/Xamarin/c-async-on-ios-and-android-craig-dunn-developer-evangelist-at-xamarin) -[Xamarin's Introduction to Async article](http://docs.xamarin.com/guides/cross-platform/advanced/async_support_overview) +[Xamarin's Async support overview](https://docs.microsoft.com/xamarin/cross-platform/platform/async) The sample apps (for iOS and Android) has two examples: -* a simple text & image download using the new C# 5 `async` and `await` syntax. -* another example that shows how to download multiple files in the background and report download progress using `IProgress`/`Progress`. It also demonstrates how to cancel the background downloads using a `CancellationTokenSource`. +- a simple text & image download using the new C# 5 `async` and `await` syntax. +- another example that shows how to download multiple files in the background and report download progress using `IProgress`/`Progress`. It also demonstrates how to cancel the background downloads using a `CancellationTokenSource`. Also check out [Miguel's blog post on the subject](http://tirania.org/blog/archive/2013/Aug-15.html). diff --git a/AsyncAwait/Screenshots/01-iOS.png b/AsyncAwait/Screenshots/01-iOS.png index 96ceb4628..b1a885668 100644 Binary files a/AsyncAwait/Screenshots/01-iOS.png and b/AsyncAwait/Screenshots/01-iOS.png differ diff --git a/AsyncAwait/Screenshots/02-Android-html.png b/AsyncAwait/Screenshots/02-Android-html.png new file mode 100644 index 000000000..cee8e9979 Binary files /dev/null and b/AsyncAwait/Screenshots/02-Android-html.png differ diff --git a/AsyncAwait/Screenshots/02-Android.png b/AsyncAwait/Screenshots/02-Android.png index cee8e9979..0e65b1cb5 100644 Binary files a/AsyncAwait/Screenshots/02-Android.png and b/AsyncAwait/Screenshots/02-Android.png differ diff --git a/AsyncAwait/iOS/AsyncExtrasController.cs b/AsyncAwait/iOS/AsyncExtrasController.cs index 445d97431..59fb18e73 100644 --- a/AsyncAwait/iOS/AsyncExtrasController.cs +++ b/AsyncAwait/iOS/AsyncExtrasController.cs @@ -31,16 +31,10 @@ public partial class AsyncExtrasController : UIViewController { static readonly string[] ListOfImages = new string[] { - "http://xamarin.com/images/tour/amazing-ide.png", - "http://xamarin.com/images/how-it-works/chalkboard2.jpg", - "http://xamarin.com/images/about/team.jpg", - "http://xamarin.com/images/prebuilt/rich-feature-set.jpg", - "http://cdn1.xamarin.com/webimages/images/features/shared-code-2.pngXXX", - "http://xamarin.com/images/tour/4platforms12.jpg", - "http://xamarin.com/images/tour/amazing-ide.png", - "http://xamarin.com/images/enterprise/multiple_platforms.png", - "http://blog.xamarin.com/wp-content/uploads/2013/07/monkey_cowboy.jpg", - "http://docs.xamarin.com/guides/cross-platform/getting_started/introducing_xamarin_studio/Images/19.png" + "https://developer.xamarin.com/guides/cross-platform/advanced/async_support_overview/Images/AsyncAwait.png", + "https://xamarin.com/content/images/pages/about/team-h.jpg", + "https://blog.xamarin.com/wp-content/uploads/2013/07/monkey_cowboy.jpg", + "https://developer.xamarin.com/guides/cross-platform/getting_started/introducing_xamarin_studio/Images/19.png" }; diff --git a/AsyncAwait/iOS/Info.plist b/AsyncAwait/iOS/Info.plist index 6159dbf8f..e62293208 100644 --- a/AsyncAwait/iOS/Info.plist +++ b/AsyncAwait/iOS/Info.plist @@ -13,7 +13,9 @@ UIMainStoryboardFile MainStoryboard MinimumOSVersion - 6.0 + 8.0 + CFBundleIdentifier + com.xamarin.asyncawait CFBundleDisplayName AsyncAwait CFBundleVersion diff --git a/AsyncAwait/iOS/Resources/Default-568h@2x.png b/AsyncAwait/iOS/Resources/Default-568h@2x.png new file mode 100644 index 000000000..0891b7aab Binary files /dev/null and b/AsyncAwait/iOS/Resources/Default-568h@2x.png differ diff --git a/AsyncAwait/iOS/iOS.csproj b/AsyncAwait/iOS/iOS.csproj index d0b88e749..01ca5878f 100644 --- a/AsyncAwait/iOS/iOS.csproj +++ b/AsyncAwait/iOS/iOS.csproj @@ -3,7 +3,7 @@ Debug iPhoneSimulator - 10.0.0 + 8.0.30703 2.0 {2D418EAB-3808-448E-AEAB-E394507BA98C} {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -26,6 +26,7 @@ false true i386 + NSUrlSessionHandler full @@ -36,6 +37,7 @@ None false i386 + NSUrlSessionHandler true @@ -49,6 +51,7 @@ false iPhone Developer ARMv7 + NSUrlSessionHandler full @@ -59,6 +62,7 @@ iPhone Developer false ARMv7, ARM64 + NSUrlSessionHandler full @@ -71,6 +75,7 @@ false Automatic:AdHoc ARMv7, ARM64 + NSUrlSessionHandler full @@ -82,6 +87,7 @@ false Automatic:AppStore ARMv7, ARM64 + NSUrlSessionHandler @@ -116,4 +122,7 @@ + + + \ No newline at end of file diff --git a/AsyncAwait/iOS/iOSViewController.cs b/AsyncAwait/iOS/iOSViewController.cs index 629658483..ed3e0b229 100644 --- a/AsyncAwait/iOS/iOSViewController.cs +++ b/AsyncAwait/iOS/iOSViewController.cs @@ -76,7 +76,7 @@ public async Task DownloadHomepageAsync() // // download HTML string - Task contentsTask = httpClient.GetStringAsync("http://xamarin.com/"); // async method! + Task contentsTask = httpClient.GetStringAsync("https://xamarin.com/"); // async method! ResultTextView.Text += "DownloadHomepage method continues after Async() call, until await is used\n"; @@ -91,7 +91,7 @@ public async Task DownloadHomepageAsync() // download image bytes ResultTextView.Text += "Start downloading image.\n"; - byte[] imageBytes = await httpClient.GetByteArrayAsync("http://xamarin.com/images/about/team.jpg"); // async method! + byte[] imageBytes = await httpClient.GetByteArrayAsync("https://xamarin.com/content/images/pages/about/team-h.jpg"); // async method! ResultTextView.Text += "Downloaded the image.\n"; await SaveBytesToFileAsync(imageBytes, "team.jpg"); ResultTextView.Text += "Save the image to a file." + Environment.NewLine; @@ -107,10 +107,11 @@ public async Task DownloadHomepageAsync() // // download multiple images // http://blogs.msdn.com/b/pfxteam/archive/2012/08/02/processing-tasks-as-they-complete.aspx - Task task1 = httpClient.GetByteArrayAsync("http://xamarin.com/images/tour/amazing-ide.png"); // async method! - Task task2 = httpClient.GetByteArrayAsync("http://xamarin.com/images/how-it-works/chalkboard2.jpg"); // async method! - Task task3 = httpClient.GetByteArrayAsync("http://cdn1.xamarin.com/webimages/images/features/shared-code-2.pngXXX"); // ERROR async method! + Task task1 = httpClient.GetByteArrayAsync("https://developer.xamarin.com/guides/cross-platform/advanced/async_support_overview/Images/AsyncAwait.png"); // async method! + Task task2 = httpClient.GetByteArrayAsync("https://blog.xamarin.com/wp-content/uploads/2013/07/monkey_cowboy.jpg"); // async method! + Task task3 = httpClient.GetByteArrayAsync("https://developer.xamarin.com/image-doesn't-exist.pngXXX"); // ERROR async method! + List> tasks = new List>(); tasks.Add(task1); tasks.Add(task2); diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart.Android.sln b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart.Android.sln new file mode 100644 index 000000000..207f1fe34 --- /dev/null +++ b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart.Android.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamarinTodoQuickStart.Android", "XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj", "{8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Build.0 = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Camera/Camera.Droid/Assets/AboutAssets.txt b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt similarity index 100% rename from Camera/Camera.Droid/Assets/AboutAssets.txt rename to Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Constants.cs b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Constants.cs new file mode 100644 index 000000000..69e63762a --- /dev/null +++ b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Constants.cs @@ -0,0 +1,16 @@ +using System; + +namespace XamarinTodoQuickStart +{ + public static class Constants + { + // TODO: Configure the MobileServiceClient to communicate with your mobile service by + // uncommenting the following code and replacing AppUrl with values from + // your mobile service, which are obtained from the Windows Azure Management Portal. + // Do this after you add a reference to the Mobile Services client to your project. + + // Azure app specific URL and key + public const string ApplicationURL = @"https://your_app_name.azurewebsites.net/"; + } +} + diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml new file mode 100644 index 000000000..3d22b16f0 --- /dev/null +++ b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..2bc8c83f4 --- /dev/null +++ b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XamarinTodoQuickStart")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/Camera/Camera.Droid/Resources/AboutResources.txt b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/AboutResources.txt similarity index 100% rename from Camera/Camera.Droid/Resources/AboutResources.txt rename to Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/AboutResources.txt diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs new file mode 100644 index 000000000..3ad7a6304 --- /dev/null +++ b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs @@ -0,0 +1,230 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("XamarinTodoQuickStart.Resource", IsApplication=true)] + +namespace XamarinTodoQuickStart +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_in_right = global::XamarinTodoQuickStart.Resource.Animation.slide_in_right; + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_out_left = global::XamarinTodoQuickStart.Resource.Animation.slide_out_left; + global::Xamarin.Auth._MobileServices.Resource.Drawable.ic_arrow_back = global::XamarinTodoQuickStart.Resource.Drawable.ic_arrow_back; + global::Xamarin.Auth._MobileServices.Resource.Id.webview = global::XamarinTodoQuickStart.Resource.Id.webview; + global::Xamarin.Auth._MobileServices.Resource.Layout.activity_webview = global::XamarinTodoQuickStart.Resource.Layout.activity_webview; + global::Xamarin.Auth._MobileServices.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::Xamarin.Auth._MobileServices.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + global::Xamarin.Auth._MobileServices.Resource.String.title_activity_webview = global::XamarinTodoQuickStart.Resource.String.title_activity_webview; + global::PCLCrypto.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::PCLCrypto.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + } + + public partial class Animation + { + + // aapt resource value: 0x7f040000 + public const int slide_in_right = 2130968576; + + // aapt resource value: 0x7f040001 + public const int slide_out_left = 2130968577; + + static Animation() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Animation() + { + } + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int ic_arrow_back = 2130837504; + + // aapt resource value: 0x7f020001 + public const int ic_launcher = 2130837505; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + // aapt resource value: 0x7f080000 + public const int LinearLayout1 = 2131230720; + + // aapt resource value: 0x7f080004 + public const int buttonAddTodo = 2131230724; + + // aapt resource value: 0x7f080007 + public const int checkTodoItem = 2131230727; + + // aapt resource value: 0x7f080005 + public const int listViewTodo = 2131230725; + + // aapt resource value: 0x7f080002 + public const int loadingProgressBar = 2131230722; + + // aapt resource value: 0x7f080008 + public const int menu_refresh = 2131230728; + + // aapt resource value: 0x7f080003 + public const int textNewTodo = 2131230723; + + // aapt resource value: 0x7f080001 + public const int textViewTitle = 2131230721; + + // aapt resource value: 0x7f080006 + public const int webview = 2131230726; + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + // aapt resource value: 0x7f030000 + public const int Activity_To_Do = 2130903040; + + // aapt resource value: 0x7f030001 + public const int activity_webview = 2130903041; + + // aapt resource value: 0x7f030002 + public const int Row_List_To_Do = 2130903042; + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class Menu + { + + // aapt resource value: 0x7f070000 + public const int activity_main = 2131165184; + + static Menu() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Menu() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f050001 + public const int ApplicationName = 2131034113; + + // aapt resource value: 0x7f050000 + public const int Hello = 2131034112; + + // aapt resource value: 0x7f050005 + public const int add_button_text = 2131034117; + + // aapt resource value: 0x7f050004 + public const int add_textbox_hint = 2131034116; + + // aapt resource value: 0x7f050003 + public const int app_name = 2131034115; + + // aapt resource value: 0x7f050008 + public const int checkbox_text = 2131034120; + + // aapt resource value: 0x7f050007 + public const int menu_refresh = 2131034119; + + // aapt resource value: 0x7f050006 + public const int mobile_services = 2131034118; + + // aapt resource value: 0x7f050002 + public const int title_activity_webview = 2131034114; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + + public partial class Style + { + + // aapt resource value: 0x7f060000 + public const int AppBaseTheme = 2131099648; + + // aapt resource value: 0x7f060001 + public const int AppTheme = 2131099649; + + static Style() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Style() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..b2f7c2b5f Binary files /dev/null and b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..c2219b558 Binary files /dev/null and b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..b2c79b7ed Binary files /dev/null and b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..fc4b43087 Binary files /dev/null and b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml new file mode 100644 index 000000000..2e8775ee8 --- /dev/null +++ b/Azure/GetStartedWithData/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard new file mode 100755 index 000000000..401fbec66 --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/Default.png b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/Default.png new file mode 100755 index 000000000..4c8ca6f69 Binary files /dev/null and b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/Default.png differ diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/Default@2x.png b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/Default@2x.png new file mode 100755 index 000000000..35b84cffe Binary files /dev/null and b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/Default@2x.png differ diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib new file mode 100644 index 000000000..9ca3deadd --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoItem.cs b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoItem.cs new file mode 100644 index 000000000..ab294b6f5 --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoItem.cs @@ -0,0 +1,18 @@ +using System; +using Newtonsoft.Json; + +namespace XamarinTodoQuickStart +{ + public class TodoItem + { + // Tables created prior to November 2013 should use 'int' type. Check your configuration. + public string Id { get; set; } + + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + [JsonProperty(PropertyName = "complete")] + public bool Complete { get; set; } + } +} + diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoListViewController.cs b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoListViewController.cs new file mode 100644 index 000000000..970c7a9bf --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoListViewController.cs @@ -0,0 +1,171 @@ +// This file has been autogenerated from parsing an Objective-C header file added in Xcode. +using System; +using Foundation; +using UIKit; +using System.Threading.Tasks; + +namespace XamarinTodoQuickStart +{ + public partial class TodoListViewController : UITableViewController + { + // Private Variables + private TodoService todoService; + private bool useRefreshControl = false; + + // Constructor + public TodoListViewController(IntPtr handle) : base(handle) + { + } + + public override async void ViewDidLoad() + { + base.ViewDidLoad(); + + todoService = TodoService.DefaultService; + + todoService.BusyUpdate += (bool busy) => { + if (busy) + activityIndicator.StartAnimating(); + else + activityIndicator.StopAnimating(); + }; + + AddRefreshControl(); + + await RefreshAsync(); + } + + async Task RefreshAsync() + { + // only activate the refresh control if the feature is available + if (useRefreshControl) + RefreshControl.BeginRefreshing(); + + await todoService.RefreshDataAsync(); + + if (useRefreshControl) + RefreshControl.EndRefreshing(); + + TableView.ReloadData(); + } + + #region UITableView methods + public override nint RowsInSection(UITableView tableview, nint section) + { + if (todoService == null || todoService.Items == null) + return 0; + + return todoService.Items.Count; + } + + public override nint NumberOfSections(UITableView tableView) + { + return 1; + } + + public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) + { + const string CellIdentifier = @"Cell"; + var cell = tableView.DequeueReusableCell(CellIdentifier); + if (cell == null) { + cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); + } + + // Set the label on the cell and make sure the label color is black (in case this cell + // has been reused and was previously greyed out + var label = (UILabel)cell.ViewWithTag(1); + label.TextColor = UIColor.Black; + label.Text = todoService.Items [indexPath.Row].Text; + + return cell; + } + + public override string TitleForDeleteConfirmation(UITableView tableView, NSIndexPath indexPath) + { + // Customize the Delete button to say "complete" + return @"complete"; + } + + public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath) + { + // Find the item that is about to be edited + var item = todoService.Items[indexPath.Row]; + + // If the item is complete, then this is just pending upload. Editing is not allowed + if (item.Complete) + return UITableViewCellEditingStyle.None; + + // Otherwise, allow the delete button to appear + return UITableViewCellEditingStyle.Delete; + } + + public async override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) + { + // Find item that was commited for editing (completed) + var item = todoService.Items[indexPath.Row]; + + // Change the appearance to look greyed out until we remove the item + var label = (UILabel)TableView.CellAt(indexPath).ViewWithTag(1); + label.TextColor = UIColor.Gray; + + // Ask the todoService to set the item's complete value to YES, and remove the row if successful + await todoService.CompleteItemAsync(item); + + // Remove the row from the UITableView + tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Top); + } + + #endregion + + #region UI Actions + + async partial void OnAdd(NSObject sender) + { + if (string.IsNullOrWhiteSpace(itemText.Text)) + return; + + var newItem = new TodoItem() { + Text = itemText.Text, + Complete = false + }; + + int index = await todoService.InsertTodoItemAsync(newItem); + + TableView.InsertRows(new [] { NSIndexPath.FromItemSection(index, 0) }, + UITableViewRowAnimation.Top); + + itemText.Text = ""; + } + + #endregion + + #region UITextFieldDelegate methods + + [Export ("textFieldShouldReturn:")] + public virtual bool ShouldReturn(UITextField textField) + { + textField.ResignFirstResponder(); + return true; + } + + #endregion + + #region * iOS Specific Code + + // This method will add the UIRefreshControl to the table view if + // it is available, ie, we are running on iOS 6+ + private void AddRefreshControl() + { + if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { + // the refresh control is available, let's add it + RefreshControl = new UIRefreshControl(); + RefreshControl.ValueChanged += async (sender, e) => { + await RefreshAsync(); + }; + useRefreshControl = true; + } + } + + #endregion + } +} diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs new file mode 100644 index 000000000..8c7c47d97 --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs @@ -0,0 +1,36 @@ +// WARNING +// +// This file has been generated automatically by Xamarin Studio to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace XamarinTodoQuickStart +{ + [Register ("TodoListViewController")] + partial class TodoListViewController + { + [Outlet] + UIKit.UIActivityIndicatorView activityIndicator { get; set; } + + [Outlet] + UIKit.UITextField itemText { get; set; } + + [Action ("OnAdd:")] + partial void OnAdd (Foundation.NSObject sender); + + void ReleaseDesignerOutlets () + { + if (itemText != null) { + itemText.Dispose (); + itemText = null; + } + + if (activityIndicator != null) { + activityIndicator.Dispose (); + activityIndicator = null; + } + } + } +} diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoService.cs b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoService.cs new file mode 100644 index 000000000..e9f525599 --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/TodoService.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using Foundation; +using System.Threading.Tasks; +using UIKit; +using System.Net.Http; + +// TODO:: Add the following using statement + using Microsoft.WindowsAzure.MobileServices; + +namespace XamarinTodoQuickStart +{ + // TODO:: inherit from DelegatingHandler + public class TodoService : DelegatingHandler + { + private static TodoService todoServiceInstance = new TodoService(); + public static TodoService DefaultService { get { return todoServiceInstance; } } + + // TODO:: Uncomment these lines to use Mobile Services + private MobileServiceClient client; + private IMobileServiceTable todoTable; + + public List Items { get; private set;} + private int busyCount = 0; + + // Public events + public event Action BusyUpdate; + + // Constructor + protected TodoService() + { + CurrentPlatform.Init (); + + Items = new List(); + + // TODO:: Uncomment these lines to use Mobile Services + client = new MobileServiceClient(Constants.ApplicationURL); + todoTable = client.GetTable(); // Create an MSTable instance to allow us to work with the TodoItem table + } + + async public Task> RefreshDataAsync() + { + // TODO:: Uncomment these lines to use Mobile Services + + try + { + // This code refreshes the entries in the list view by querying the TodoItems table. + // The query excludes completed TodoItems + Items = await todoTable + .Where (todoItem => todoItem.Complete == false).ToListAsync(); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + return null; + } + + + return Items; + } + + public async Task InsertTodoItemAsync(TodoItem todoItem) + { + try + { + // TODO:: Uncomment this line out to use Mobile Services + await todoTable.InsertAsync(todoItem); + + Items.Add(todoItem); + + return Items.IndexOf(todoItem); + } + catch (Exception e) // TODO:: Optional - catch MobileServiceInvalidOperationException instead of generic Exception + { + Console.Error.WriteLine(@"ERROR {0}", e.Message); + return 0; + } + } + + public async Task CompleteItemAsync(TodoItem item) + { + try + { + item.Complete = true; + + // This code takes a freshly completed TodoItem and updates the database. When the MobileService + // responds, the item is removed from the list + // TODO:: Uncomment this line to use Mobile Services + await todoTable.UpdateAsync(item); + + Items.Remove(item); + + } + catch (Exception e) // TODO:: Optional - catch MobileServiceInvalidOperationException instead of generic Exception + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + } + } + + void Busy(bool busy) + { + // assumes always executes on UI thread + if (busy) + { + if (busyCount++ == 0 && BusyUpdate != null) + BusyUpdate(true); + } + else + { + if (--busyCount == 0 && BusyUpdate != null) + BusyUpdate(false); + } + } + + // TODO:: Uncomment this code when using Mobile Services and inheriting from IServiceFilter + #region implemented abstract members of HttpMessageHandler + + protected override async Task SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + Busy (true); + var response = await base.SendAsync (request, cancellationToken); + + Busy (false); + return response; + } + + #endregion + } +} \ No newline at end of file diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj new file mode 100644 index 000000000..4c815a888 --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj @@ -0,0 +1,170 @@ + + + + Debug + iPhoneSimulator + {07F1CD1B-626F-4BE5-9840-97B44CBB94C9} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + XamarinTodoQuickStart + Resources + XamarinTodoQuickStart + Xamarin.iOS + v1.0 + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + SdkOnly + false + true + + x86_64 + NSUrlSessionHandler + iPhone Developer + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + false + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + true + false + iPhone Developer + + None + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + iPhone Developer + false + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Ad-Hoc + prompt + 4 + iPhone Distribution + true + false + Automatic:AdHoc + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\AppStore + prompt + 4 + iPhone Distribution + false + Automatic:AppStore + ARM64 + NSUrlSessionHandler + + + + + + + + + + ..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll + + + ..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll + + + ..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll + + + ..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll + + + ..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll + + + ..\packages\Validation.2.2.8\lib\dotnet\Validation.dll + + + ..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll + + + ..\packages\Microsoft.Azure.Mobile.Client.4.0.2\lib\xamarinios10\Microsoft.Azure.Mobile.Client.dll + + + + + + + + + + + + + + + + + TodoListViewController.cs + + + + + + + + + + + + + + + + 1.3.1 + False + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/packages.config b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/packages.config new file mode 100644 index 000000000..06847c21c --- /dev/null +++ b/Azure/GetStartedWithData/iOS/XamarinTodoQuickStart/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithData/readme.md b/Azure/GetStartedWithData/readme.md new file mode 100644 index 000000000..42bf1ff1c --- /dev/null +++ b/Azure/GetStartedWithData/readme.md @@ -0,0 +1,4 @@ +Get Started with Data +===================== + +Using Windows Azure and Xamarin diff --git a/Azure/GetStartedWithPush/Android/AzureCloudCode/insert.js b/Azure/GetStartedWithPush/Android/AzureCloudCode/insert.js new file mode 100644 index 000000000..e71bfbdd3 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/AzureCloudCode/insert.js @@ -0,0 +1,54 @@ +function insert(item, user, request) +{ + console.log('todoitem.Insert() fired'); + + if (item.text.length > 10) { + request.respond(statusCodes.BAD_REQUEST, 'Text length must be 10 characters or less.'); + } + else { + // item.createdAt = new Date(); + // item.userId = user.userId; + // request.execute(); + + // ANDROID - + if (item.channel) { + console.log('todoitem.Insert() - channel found on item'); + request.execute({ + success: function() { + console.log('todoitem.Insert() - request returned success'); + // Write to the response and then send the notification in the background + request.respond(); + push.gcm.send(item.channel, item.text, { + success: function(response) { + console.log('Push notification sent: ', response); + }, error: function(error) { + console.log('Error sending push notification: ', error); + } + }); + }, + error: function(response) { + console.log('todoitem.Insert() - error response'); + console.log('Request failed with response code ' + response.status + '.' + + 'Raw response: ' + response.text); + request.respond(); + } + }); + } + + // iOS - + if (item.deviceToken) { + request.execute(); + // Set timeout to delay the notification, to provide time for the + // app to be closed on the device to demonstrate toast notifications + setTimeout(function() { + push.apns.send(item.deviceToken, { + alert: "Toast: " + item.text, + payload: { + inAppMessage: "Hey, a new item arrived: '" + item.text + "'" + } + }); + }, 2500); + } + + } +} \ No newline at end of file diff --git a/Azure/GetStartedWithPush/Android/AzureCloudCode/read.js b/Azure/GetStartedWithPush/Android/AzureCloudCode/read.js new file mode 100644 index 000000000..b7ff50ce6 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/AzureCloudCode/read.js @@ -0,0 +1,4 @@ +function read(query, user, request) { + // query.where({ userId: user.userId }); + request.execute(); +} \ No newline at end of file diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart.Android.sln b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart.Android.sln new file mode 100644 index 000000000..207f1fe34 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart.Android.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamarinTodoQuickStart.Android", "XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj", "{8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Build.0 = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/SoMA/Android/Assets/AboutAssets.txt b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt similarity index 100% rename from SoMA/Android/Assets/AboutAssets.txt rename to Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Constants.cs b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Constants.cs new file mode 100644 index 000000000..7eb210c21 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Constants.cs @@ -0,0 +1,13 @@ +using System; + +namespace XamarinTodoQuickStart +{ + public static class Constants + { + // Azure app specific URL and key + public const string ApplicationURL = @"https://your_app_name.azurewebsites.net/"; + + public const string SenderID = "YOUR_API_PROJ_NUMBER"; // Google API Project Number + } +} + diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml new file mode 100644 index 000000000..9a7d53ce4 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..2bc8c83f4 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XamarinTodoQuickStart")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/PushService.cs b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/PushService.cs new file mode 100644 index 000000000..ae2f0ff48 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/PushService.cs @@ -0,0 +1,129 @@ +using System.Text; +using Android.App; +using Android.Content; +using Android.Util; +using PushSharp.Client; + +//VERY VERY VERY IMPORTANT NOTE!!!! +// Your package name MUST NOT start with an uppercase letter. +// Android does not allow permissions to start with an upper case letter +// If it does you will get a very cryptic error in logcat and it will not be obvious why you are crying! +// So please, for the love of all that is kind on this earth, use a LOWERCASE first letter in your Package Name!!!! +[assembly: Permission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")] //, ProtectionLevel = Android.Content.PM.Protection.Signature)] +[assembly: UsesPermission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")] +[assembly: UsesPermission(Name = "com.google.android.c2dm.permission.RECEIVE")] + +//GET_ACCOUNTS is only needed for android versions 4.0.3 and below +[assembly: UsesPermission(Name = "android.permission.GET_ACCOUNTS")] +[assembly: UsesPermission(Name = "android.permission.INTERNET")] +[assembly: UsesPermission(Name = "android.permission.WAKE_LOCK")] + +namespace XamarinTodoQuickStart +{ + //You must subclass this! + [BroadcastReceiver(Permission=GCMConstants.PERMISSION_GCM_INTENTS)] + [IntentFilter(new string[] { GCMConstants.INTENT_FROM_GCM_MESSAGE }, Categories = new string[] { "@PACKAGE_NAME@" })] + [IntentFilter(new string[] { GCMConstants.INTENT_FROM_GCM_REGISTRATION_CALLBACK }, Categories = new string[] { "@PACKAGE_NAME@" })] + [IntentFilter(new string[] { GCMConstants.INTENT_FROM_GCM_LIBRARY_RETRY }, Categories = new string[] { "@PACKAGE_NAME@" })] + public class PushHandlerBroadcastReceiver : PushHandlerBroadcastReceiverBase + { + //IMPORTANT: Change this to your own Sender ID! + //The SENDER_ID is your Google API Console App Project ID. + // Be sure to get the right Project ID from your Google APIs Console. It's not the named project ID that appears in the Overview, + // but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview + // where 785671162406 is the project id, which is the SENDER_ID to use! + public static string[] SENDER_IDS = new string[] { Constants.SenderID }; + + public const string TAG = "PushSharp-GCM"; + } + + [Service] //Must use the service tag + public class PushHandlerService : PushHandlerServiceBase + { + public static string RegistrationID { get; private set; } + + public PushHandlerService() : base(PushHandlerBroadcastReceiver.SENDER_IDS) + { + Log.Info(PushHandlerBroadcastReceiver.TAG, "PushHandlerService() constructor"); + } + + protected override void OnRegistered (Context context, string registrationId) + { + Log.Verbose(PushHandlerBroadcastReceiver.TAG, "GCM Registered: " + registrationId); + RegistrationID = registrationId; + + createNotification("PushSharp-GCM Registered...", "The device has been Registered, Tap to View!"); + } + + protected override void OnUnRegistered (Context context, string registrationId) + { + Log.Verbose(PushHandlerBroadcastReceiver.TAG, "GCM Unregistered: " + registrationId); + //Remove from the web service + // var wc = new WebClient(); + // var result = wc.UploadString("http://your.server.com/api/unregister/", "POST", + // "{ 'registrationId' : '" + lastRegistrationId + "' }"); + + createNotification("PushSharp-GCM Unregistered...", "The device has been unregistered, Tap to View!"); + } + + protected override void OnMessage (Context context, Intent intent) + { + Log.Info(PushHandlerBroadcastReceiver.TAG, "GCM Message Received!"); + + var msg = new StringBuilder(); + + if (intent != null && intent.Extras != null) + { + foreach (var key in intent.Extras.KeySet()) + msg.AppendLine(key + "=" + intent.Extras.Get(key).ToString()); + } + + //Store the message + var prefs = GetSharedPreferences(context.PackageName, FileCreationMode.Private); + var edit = prefs.Edit(); + edit.PutString("last_msg", msg.ToString()); + edit.Commit(); + + string message = intent.Extras.GetString("message"); + + // createNotification("PushSharp-GCM Msg Rec'd", "Message Received for C2DM-Sharp... Tap to View!"); + createNotification("New todo item!", "Todo item: " + message); + } + + protected override bool OnRecoverableError (Context context, string errorId) + { + Log.Warn(PushHandlerBroadcastReceiver.TAG, "Recoverable Error: " + errorId); + + return base.OnRecoverableError (context, errorId); + } + + protected override void OnError (Context context, string errorId) + { + Log.Error(PushHandlerBroadcastReceiver.TAG, "GCM Error: " + errorId); + } + + void createNotification(string title, string desc) + { + //Create notification + var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager; + + //Create an intent to show ui + var uiIntent = new Intent(this, typeof(TodoActivity)); + + //Create the notification + var notification = new Notification(Android.Resource.Drawable.SymActionEmail, title); + + //Auto cancel will remove the notification once the user touches it + notification.Flags = NotificationFlags.AutoCancel; + + //Set the notification info + //we use the pending intent, passing our ui intent over which will get called + //when the notification is tapped. + notification.SetLatestEventInfo(this, title, desc, PendingIntent.GetActivity(this, 0, uiIntent, 0)); + + //Show the notification + notificationManager.Notify(1, notification); + } + } +} + diff --git a/Camera/Components/xamarin.mobile-0.6.3/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/AboutResources.txt similarity index 100% rename from Camera/Components/xamarin.mobile-0.6.3/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/AboutResources.txt diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs new file mode 100644 index 000000000..3ad7a6304 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs @@ -0,0 +1,230 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("XamarinTodoQuickStart.Resource", IsApplication=true)] + +namespace XamarinTodoQuickStart +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_in_right = global::XamarinTodoQuickStart.Resource.Animation.slide_in_right; + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_out_left = global::XamarinTodoQuickStart.Resource.Animation.slide_out_left; + global::Xamarin.Auth._MobileServices.Resource.Drawable.ic_arrow_back = global::XamarinTodoQuickStart.Resource.Drawable.ic_arrow_back; + global::Xamarin.Auth._MobileServices.Resource.Id.webview = global::XamarinTodoQuickStart.Resource.Id.webview; + global::Xamarin.Auth._MobileServices.Resource.Layout.activity_webview = global::XamarinTodoQuickStart.Resource.Layout.activity_webview; + global::Xamarin.Auth._MobileServices.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::Xamarin.Auth._MobileServices.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + global::Xamarin.Auth._MobileServices.Resource.String.title_activity_webview = global::XamarinTodoQuickStart.Resource.String.title_activity_webview; + global::PCLCrypto.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::PCLCrypto.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + } + + public partial class Animation + { + + // aapt resource value: 0x7f040000 + public const int slide_in_right = 2130968576; + + // aapt resource value: 0x7f040001 + public const int slide_out_left = 2130968577; + + static Animation() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Animation() + { + } + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int ic_arrow_back = 2130837504; + + // aapt resource value: 0x7f020001 + public const int ic_launcher = 2130837505; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + // aapt resource value: 0x7f080000 + public const int LinearLayout1 = 2131230720; + + // aapt resource value: 0x7f080004 + public const int buttonAddTodo = 2131230724; + + // aapt resource value: 0x7f080007 + public const int checkTodoItem = 2131230727; + + // aapt resource value: 0x7f080005 + public const int listViewTodo = 2131230725; + + // aapt resource value: 0x7f080002 + public const int loadingProgressBar = 2131230722; + + // aapt resource value: 0x7f080008 + public const int menu_refresh = 2131230728; + + // aapt resource value: 0x7f080003 + public const int textNewTodo = 2131230723; + + // aapt resource value: 0x7f080001 + public const int textViewTitle = 2131230721; + + // aapt resource value: 0x7f080006 + public const int webview = 2131230726; + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + // aapt resource value: 0x7f030000 + public const int Activity_To_Do = 2130903040; + + // aapt resource value: 0x7f030001 + public const int activity_webview = 2130903041; + + // aapt resource value: 0x7f030002 + public const int Row_List_To_Do = 2130903042; + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class Menu + { + + // aapt resource value: 0x7f070000 + public const int activity_main = 2131165184; + + static Menu() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Menu() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f050001 + public const int ApplicationName = 2131034113; + + // aapt resource value: 0x7f050000 + public const int Hello = 2131034112; + + // aapt resource value: 0x7f050005 + public const int add_button_text = 2131034117; + + // aapt resource value: 0x7f050004 + public const int add_textbox_hint = 2131034116; + + // aapt resource value: 0x7f050003 + public const int app_name = 2131034115; + + // aapt resource value: 0x7f050008 + public const int checkbox_text = 2131034120; + + // aapt resource value: 0x7f050007 + public const int menu_refresh = 2131034119; + + // aapt resource value: 0x7f050006 + public const int mobile_services = 2131034118; + + // aapt resource value: 0x7f050002 + public const int title_activity_webview = 2131034114; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + + public partial class Style + { + + // aapt resource value: 0x7f060000 + public const int AppBaseTheme = 2131099648; + + // aapt resource value: 0x7f060001 + public const int AppTheme = 2131099649; + + static Style() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Style() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..b2f7c2b5f Binary files /dev/null and b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..c2219b558 Binary files /dev/null and b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..b2c79b7ed Binary files /dev/null and b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..fc4b43087 Binary files /dev/null and b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml new file mode 100644 index 000000000..2e8775ee8 --- /dev/null +++ b/Azure/GetStartedWithPush/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard new file mode 100755 index 000000000..5894b2a4e --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/Default.png b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/Default.png new file mode 100755 index 000000000..4c8ca6f69 Binary files /dev/null and b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/Default.png differ diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/Default@2x.png b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/Default@2x.png new file mode 100755 index 000000000..35b84cffe Binary files /dev/null and b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/Default@2x.png differ diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib new file mode 100644 index 000000000..9ca3deadd --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoItem.cs b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoItem.cs new file mode 100644 index 000000000..50d8678fa --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoItem.cs @@ -0,0 +1,21 @@ +using System; +using Newtonsoft.Json; + +namespace XamarinTodoQuickStart +{ + public class TodoItem + { + // Tables created prior to November 2013 should use 'int' type. Check your configuration. + public string Id { get; set; } + + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + [JsonProperty(PropertyName = "complete")] + public bool Complete { get; set; } + + [JsonProperty(PropertyName = "deviceToken")] + public string DeviceToken { get; set; } + } +} + diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoListViewController.cs b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoListViewController.cs new file mode 100644 index 000000000..5e9d4305a --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoListViewController.cs @@ -0,0 +1,175 @@ +// This file has been autogenerated from parsing an Objective-C header file added in Xcode. +using System; +using Foundation; +using UIKit; +using System.Threading.Tasks; + +namespace XamarinTodoQuickStart +{ + public partial class TodoListViewController : UITableViewController + { + // Private Variables + private TodoService todoService; + private bool useRefreshControl = false; + + // Constructor + public TodoListViewController(IntPtr handle) : base(handle) + { + } + + public override async void ViewDidLoad() + { + base.ViewDidLoad(); + + todoService = TodoService.DefaultService; + + todoService.BusyUpdate += (bool busy) => { + if (busy) + activityIndicator.StartAnimating(); + else + activityIndicator.StopAnimating(); + }; + + AddRefreshControl(); + + await RefreshAsync(); + } + + async Task RefreshAsync() + { + // only activate the refresh control if the feature is available + if (useRefreshControl) + RefreshControl.BeginRefreshing(); + + await todoService.RefreshDataAsync(); + + if (useRefreshControl) + RefreshControl.EndRefreshing(); + + TableView.ReloadData(); + } + + #region UITableView methods + public override nint RowsInSection(UITableView tableview, nint section) + { + if (todoService == null || todoService.Items == null) + return 0; + + return todoService.Items.Count; + } + + public override nint NumberOfSections(UITableView tableView) + { + return 1; + } + + public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) + { + const string CellIdentifier = @"Cell"; + var cell = tableView.DequeueReusableCell(CellIdentifier); + if (cell == null) { + cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); + } + + // Set the label on the cell and make sure the label color is black (in case this cell + // has been reused and was previously greyed out + var label = (UILabel)cell.ViewWithTag(1); + label.TextColor = UIColor.Black; + label.Text = todoService.Items [indexPath.Row].Text; + + return cell; + } + + public override string TitleForDeleteConfirmation(UITableView tableView, NSIndexPath indexPath) + { + // Customize the Delete button to say "complete" + return @"complete"; + } + + public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath) + { + // Find the item that is about to be edited + var item = todoService.Items[indexPath.Row]; + + // If the item is complete, then this is just pending upload. Editing is not allowed + if (item.Complete) + return UITableViewCellEditingStyle.None; + + // Otherwise, allow the delete button to appear + return UITableViewCellEditingStyle.Delete; + } + + public async override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) + { + // Find item that was commited for editing (completed) + var item = todoService.Items[indexPath.Row]; + + // Change the appearance to look greyed out until we remove the item + var label = (UILabel)TableView.CellAt(indexPath).ViewWithTag(1); + label.TextColor = UIColor.Gray; + + // Ask the todoService to set the item's complete value to YES, and remove the row if successful + await todoService.CompleteItemAsync(item); + + // Remove the row from the UITableView + tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Top); + } + + #endregion + + #region UI Actions + + async partial void OnAdd(NSObject sender) + { + if (string.IsNullOrWhiteSpace(itemText.Text)) + return; + + string deviceToken = ((AppDelegate)UIApplication.SharedApplication.Delegate).DeviceToken; + + var newItem = new TodoItem() + { + Text = itemText.Text, + Complete = false, + DeviceToken = deviceToken + }; + + int index = await todoService.InsertTodoItemAsync(newItem); + + TableView.InsertRows(new [] { NSIndexPath.FromRowSection(index, 0) }, + UITableViewRowAnimation.Top); + + itemText.Text = ""; + } + + #endregion + + #region UITextFieldDelegate methods + + [Export ("textFieldShouldReturn:")] + public virtual bool ShouldReturn(UITextField textField) + { + textField.ResignFirstResponder(); + return true; + } + + #endregion + + #region * iOS Specific Code + + // This method will add the UIRefreshControl to the table view if + // it is available, ie, we are running on iOS 6+ + private void AddRefreshControl() + { + if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { + // the refresh control is available, let's add it + RefreshControl = new UIRefreshControl(); + RefreshControl.ValueChanged += async (sender, e) => { + await RefreshAsync(); + }; + useRefreshControl = true; + } + } + + #endregion + } +} diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs new file mode 100644 index 000000000..8c7c47d97 --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs @@ -0,0 +1,36 @@ +// WARNING +// +// This file has been generated automatically by Xamarin Studio to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace XamarinTodoQuickStart +{ + [Register ("TodoListViewController")] + partial class TodoListViewController + { + [Outlet] + UIKit.UIActivityIndicatorView activityIndicator { get; set; } + + [Outlet] + UIKit.UITextField itemText { get; set; } + + [Action ("OnAdd:")] + partial void OnAdd (Foundation.NSObject sender); + + void ReleaseDesignerOutlets () + { + if (itemText != null) { + itemText.Dispose (); + itemText = null; + } + + if (activityIndicator != null) { + activityIndicator.Dispose (); + activityIndicator = null; + } + } + } +} diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoService.cs b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoService.cs new file mode 100644 index 000000000..9321ccbc7 --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/TodoService.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using Foundation; +using System.Threading.Tasks; +using Microsoft.WindowsAzure.MobileServices; +using System.Net.Http; + +namespace XamarinTodoQuickStart +{ + public class TodoService : DelegatingHandler + { + private static TodoService todoServiceInstance = new TodoService(); + public static TodoService DefaultService { get { return todoServiceInstance; } } + + private MobileServiceClient client; + private IMobileServiceTable todoTable; + + public List Items { get; private set;} + private int busyCount = 0; + + // Public events + public event Action BusyUpdate; + + // Constructor + protected TodoService() + { + Items = new List(); + + CurrentPlatform.Init (); + // Initialize the Mobile Service client with your URL and key + client = new MobileServiceClient(Constants.ApplicationURL, this); + + // Create an MSTable instance to allow us to work with the TodoItem table + todoTable = client.GetTable (); + } + + async public Task> RefreshDataAsync() + { + try + { + // This code refreshes the entries in the list view by querying the TodoItems table. + // The query excludes completed TodoItems + Items = await todoTable + .Where (todoItem => todoItem.Complete == false).ToListAsync(); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + return null; + } + + return Items; + } + + public async Task InsertTodoItemAsync(TodoItem todoItem) + { + try + { + // This code inserts a new TodoItem into the database. When the operation completes + // and Mobile Services has assigned an Id, the item is added to the CollectionView + await todoTable.InsertAsync(todoItem); + + Items.Add(todoItem); + + return Items.IndexOf(todoItem); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine(@"ERROR {0}", e.Message); + return 0; + } + } + + public async Task CompleteItemAsync(TodoItem item) + { + try + { + // This code takes a freshly completed TodoItem and updates the database. When the MobileService + // responds, the item is removed from the list + item.Complete = true; + await todoTable.UpdateAsync(item); + Items.Remove(item); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + } + } + + void Busy(bool busy) + { + // assumes always executes on UI thread + if (busy) + { + if (busyCount++ == 0 && BusyUpdate != null) + BusyUpdate(true); + } + else + { + if (--busyCount == 0 && BusyUpdate != null) + BusyUpdate(false); + } + } + + #region implemented abstract members of HttpMessageHandler + + protected override async Task SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + Busy (true); + var response = await base.SendAsync (request, cancellationToken); + + Busy (false); + return response; + } + + #endregion + } +} \ No newline at end of file diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj new file mode 100644 index 000000000..8cc16b346 --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj @@ -0,0 +1,167 @@ + + + + Debug + iPhoneSimulator + {07F1CD1B-626F-4BE5-9840-97B44CBB94C9} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + XamarinTodoQuickStart + Resources + XamarinTodoQuickStart + Xamarin.iOS + v1.0 + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + SdkOnly + false + true + + x86_64 + NSUrlSessionHandler + iPhone Developer + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + SdkOnly + false + NSUrlSessionHandler + x86_64 + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + true + false + iPhone Developer + + + ARM64 + Entitlements.plist + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + iPhone Developer + false + Entitlements.plist + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Ad-Hoc + prompt + 4 + iPhone Distribution + true + false + Automatic:AdHoc + Entitlements.plist + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\AppStore + prompt + 4 + iPhone Distribution + false + Automatic:AppStore + Entitlements.plist + ARMv7, ARM64 + NSUrlSessionHandler + + + + + + + + + + ..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll + + + ..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll + + + ..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll + + + ..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll + + + ..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll + + + ..\packages\Validation.2.2.8\lib\dotnet\Validation.dll + + + ..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll + + + ..\packages\Microsoft.Azure.Mobile.Client.4.0.2\lib\xamarinios10\Microsoft.Azure.Mobile.Client.dll + + + + + + + + + + + + + + + + + + TodoListViewController.cs + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/packages.config b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/packages.config new file mode 100644 index 000000000..06847c21c --- /dev/null +++ b/Azure/GetStartedWithPush/iOS/XamarinTodoQuickStart/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithPush/readme.md b/Azure/GetStartedWithPush/readme.md new file mode 100644 index 000000000..4d2e131c6 --- /dev/null +++ b/Azure/GetStartedWithPush/readme.md @@ -0,0 +1,14 @@ +Get Started with Push Notifications +===================== + +using Microsoft Azure and Xamarin +------------------------------- + +### Android + +**NOTE:** Google Cloud Messaging is now deprecated and replaced by Firebase. + +- NuGet: https://www.nuget.org/packages/Xamarin.Firebase.Messaging/ +- Sample: https://github.com/xamarin/GooglePlayServicesComponents/tree/master/firebase-messaging/samples + +This sample is no longer the current way to do notifications with Android. \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart.Android.sln b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart.Android.sln new file mode 100644 index 000000000..207f1fe34 --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart.Android.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamarinTodoQuickStart.Android", "XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj", "{8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Build.0 = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Constants.cs b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Constants.cs new file mode 100644 index 000000000..bb32e1eed --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Constants.cs @@ -0,0 +1,28 @@ +using System; + +namespace XamarinTodoQuickStart +{ + public static class Constants + { + // Azure app specific URL and key + public const string ApplicationURL = @"https://your_app_id.azurewebsites.net/"; + + // Scheme used to send web response to this app + public const string AuthScheme = @"SCHEME_FROM_AUTH_PROVIDER"; // ALSO ENTER IN AndroidManifest.xml + } +} + +/* +EXAMPLE OF ANDROIDMANIFEST.XML ENTRY (for Microsoft authentication) + + + + + + + + + + +*/ \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml new file mode 100644 index 000000000..1f019f998 --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..2bc8c83f4 --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XamarinTodoQuickStart")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/Camera/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/AboutResources.txt similarity index 100% rename from Camera/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/AboutResources.txt diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs new file mode 100644 index 000000000..a20a67e67 --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs @@ -0,0 +1,193 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("XamarinTodoQuickStart.Resource", IsApplication=true)] + +namespace XamarinTodoQuickStart +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + global::Xamarin.Auth._MobileServices.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::Xamarin.Auth._MobileServices.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + global::PCLCrypto.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::PCLCrypto.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int ic_launcher = 2130837504; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + // aapt resource value: 0x7f070000 + public const int LinearLayout1 = 2131165184; + + // aapt resource value: 0x7f070004 + public const int buttonAddTodo = 2131165188; + + // aapt resource value: 0x7f070006 + public const int checkTodoItem = 2131165190; + + // aapt resource value: 0x7f070005 + public const int listViewTodo = 2131165189; + + // aapt resource value: 0x7f070002 + public const int loadingProgressBar = 2131165186; + + // aapt resource value: 0x7f070007 + public const int menu_refresh = 2131165191; + + // aapt resource value: 0x7f070003 + public const int textNewTodo = 2131165187; + + // aapt resource value: 0x7f070001 + public const int textViewTitle = 2131165185; + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + // aapt resource value: 0x7f030000 + public const int Activity_To_Do = 2130903040; + + // aapt resource value: 0x7f030001 + public const int Row_List_To_Do = 2130903041; + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class Menu + { + + // aapt resource value: 0x7f060000 + public const int activity_main = 2131099648; + + static Menu() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Menu() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f040001 + public const int ApplicationName = 2130968577; + + // aapt resource value: 0x7f040000 + public const int Hello = 2130968576; + + // aapt resource value: 0x7f040004 + public const int add_button_text = 2130968580; + + // aapt resource value: 0x7f040003 + public const int add_textbox_hint = 2130968579; + + // aapt resource value: 0x7f040002 + public const int app_name = 2130968578; + + // aapt resource value: 0x7f040007 + public const int checkbox_text = 2130968583; + + // aapt resource value: 0x7f040006 + public const int menu_refresh = 2130968582; + + // aapt resource value: 0x7f040005 + public const int mobile_services = 2130968581; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + + public partial class Style + { + + // aapt resource value: 0x7f050000 + public const int AppBaseTheme = 2131034112; + + // aapt resource value: 0x7f050001 + public const int AppTheme = 2131034113; + + static Style() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Style() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..b2f7c2b5f Binary files /dev/null and b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..c2219b558 Binary files /dev/null and b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..b2c79b7ed Binary files /dev/null and b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..fc4b43087 Binary files /dev/null and b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png differ diff --git a/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml new file mode 100644 index 000000000..2e8775ee8 --- /dev/null +++ b/Azure/GetStartedWithUsers/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard new file mode 100755 index 000000000..5894b2a4e --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/Default.png b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/Default.png new file mode 100755 index 000000000..4c8ca6f69 Binary files /dev/null and b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/Default.png differ diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/Default@2x.png b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/Default@2x.png new file mode 100755 index 000000000..35b84cffe Binary files /dev/null and b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/Default@2x.png differ diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib new file mode 100644 index 000000000..9ca3deadd --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoItem.cs b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoItem.cs new file mode 100644 index 000000000..ab294b6f5 --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoItem.cs @@ -0,0 +1,18 @@ +using System; +using Newtonsoft.Json; + +namespace XamarinTodoQuickStart +{ + public class TodoItem + { + // Tables created prior to November 2013 should use 'int' type. Check your configuration. + public string Id { get; set; } + + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + [JsonProperty(PropertyName = "complete")] + public bool Complete { get; set; } + } +} + diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoListViewController.cs b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoListViewController.cs new file mode 100644 index 000000000..116b462dd --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoListViewController.cs @@ -0,0 +1,187 @@ +// This file has been autogenerated from parsing an Objective-C header file added in Xcode. +using System; +using Foundation; +using UIKit; +using System.Threading.Tasks; + +namespace XamarinTodoQuickStart +{ + public partial class TodoListViewController : UITableViewController + { + // Private Variables + private TodoService todoService; + private bool useRefreshControl = false; + + // Constructor + public TodoListViewController(IntPtr handle) : base(handle) + { + } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + todoService = TodoService.DefaultService; + + todoService.BusyUpdate += (bool busy) => { + if (busy) + activityIndicator.StartAnimating(); + else + activityIndicator.StopAnimating(); + }; + + AddRefreshControl(); + } + + public override async void ViewDidAppear(bool animated) + { + base.ViewDidAppear(animated); + + if (TodoService.DefaultService.User == null) + { + await TodoService.DefaultService.LoginAndGetData(this); + } + + if (TodoService.DefaultService.User == null) + { + // TODO:: show error + return; + } + + await RefreshAsync(); + } + + async Task RefreshAsync() + { + // only activate the refresh control if the feature is available + if (useRefreshControl) + RefreshControl.BeginRefreshing(); + + await todoService.RefreshDataAsync(); + + if (useRefreshControl) + RefreshControl.EndRefreshing(); + + TableView.ReloadData(); + } + + #region UITableView methods + public override nint RowsInSection(UITableView tableview, nint section) + { + if (todoService == null || todoService.Items == null) + return 0; + + return todoService.Items.Count; + } + + public override nint NumberOfSections(UITableView tableView) + { + return 1; + } + + public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) + { + const string CellIdentifier = @"Cell"; + var cell = tableView.DequeueReusableCell(CellIdentifier); + if (cell == null) { + cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); + } + + // Set the label on the cell and make sure the label color is black (in case this cell + // has been reused and was previously greyed out + var label = (UILabel)cell.ViewWithTag(1); + label.TextColor = UIColor.Black; + label.Text = todoService.Items [indexPath.Row].Text; + + return cell; + } + + public override string TitleForDeleteConfirmation(UITableView tableView, NSIndexPath indexPath) + { + // Customize the Delete button to say "complete" + return @"complete"; + } + + public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath) + { + // Find the item that is about to be edited + var item = todoService.Items[indexPath.Row]; + + // If the item is complete, then this is just pending upload. Editing is not allowed + if (item.Complete) + return UITableViewCellEditingStyle.None; + + // Otherwise, allow the delete button to appear + return UITableViewCellEditingStyle.Delete; + } + + public async override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) + { + // Find item that was commited for editing (completed) + var item = todoService.Items[indexPath.Row]; + + // Change the appearance to look greyed out until we remove the item + var label = (UILabel)TableView.CellAt(indexPath).ViewWithTag(1); + label.TextColor = UIColor.Gray; + + // Ask the todoService to set the item's complete value to YES, and remove the row if successful + await todoService.CompleteItemAsync(item); + + // Remove the row from the UITableView + tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Top); + } + + #endregion + + #region UI Actions + + async partial void OnAdd(NSObject sender) + { + if (string.IsNullOrWhiteSpace(itemText.Text)) + return; + + var newItem = new TodoItem() { + Text = itemText.Text, + Complete = false + }; + + int index = await todoService.InsertTodoItemAsync(newItem); + + TableView.InsertRows(new [] { NSIndexPath.FromItemSection(index, 0) }, + UITableViewRowAnimation.Top); + + itemText.Text = ""; + } + + #endregion + + #region UITextFieldDelegate methods + + [Export ("textFieldShouldReturn:")] + public virtual bool ShouldReturn(UITextField textField) + { + textField.ResignFirstResponder(); + return true; + } + + #endregion + + #region * iOS Specific Code + + // This method will add the UIRefreshControl to the table view if + // it is available, ie, we are running on iOS 6+ + private void AddRefreshControl() + { + if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { + // the refresh control is available, let's add it + RefreshControl = new UIRefreshControl(); + RefreshControl.ValueChanged += async (sender, e) => { + await RefreshAsync(); + }; + useRefreshControl = true; + } + } + + #endregion + } +} diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs new file mode 100644 index 000000000..8c7c47d97 --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs @@ -0,0 +1,36 @@ +// WARNING +// +// This file has been generated automatically by Xamarin Studio to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace XamarinTodoQuickStart +{ + [Register ("TodoListViewController")] + partial class TodoListViewController + { + [Outlet] + UIKit.UIActivityIndicatorView activityIndicator { get; set; } + + [Outlet] + UIKit.UITextField itemText { get; set; } + + [Action ("OnAdd:")] + partial void OnAdd (Foundation.NSObject sender); + + void ReleaseDesignerOutlets () + { + if (itemText != null) { + itemText.Dispose (); + itemText = null; + } + + if (activityIndicator != null) { + activityIndicator.Dispose (); + activityIndicator = null; + } + } + } +} diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoService.cs b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoService.cs new file mode 100644 index 000000000..a0f416c84 --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/TodoService.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using Foundation; +using System.Threading.Tasks; +using Microsoft.WindowsAzure.MobileServices; +using UIKit; +using System.Net.Http; +/* + +https://docs.microsoft.com/en-us/azure/app-service/app-service-mobile-how-to-configure-microsoft-authentication + +http://go.microsoft.com/fwlink/p/?LinkId=262039 +*/ +namespace XamarinTodoQuickStart +{ + public class TodoService : DelegatingHandler + { + private static TodoService todoServiceInstance = new TodoService(); + public static TodoService DefaultService { get { return todoServiceInstance; } } + + private MobileServiceClient client; // Mobile Service Client reference + private MobileServiceUser user; // Mobile Service logged in user + private IMobileServiceTable todoTable; + + public MobileServiceUser User { get { return user; } } + public List Items { get; private set;} + private int busyCount = 0; + + // Public events + public event Action BusyUpdate; + + // Constructor + protected TodoService() + { + Items = new List(); + + CurrentPlatform.Init (); + // Initialize the Mobile Service client with your URL and key + client = new MobileServiceClient(Constants.ApplicationURL, this); + } + + public async Task LoginAndGetData(UIViewController view) + { + await Authenticate(view); + await CreateTable(); + } + + public async Task Authenticate(UIViewController view) + { + try + { + AppDelegate.ResumeWithURL = url => url.Scheme == Constants.AuthScheme && client.ResumeWithURL(url); + user = await client.LoginAsync(view, MobileServiceAuthenticationProvider.MicrosoftAccount, Constants.AuthScheme); + } + catch (Exception ex) + { + Console.Error.WriteLine(@"ERROR - AUTHENTICATION FAILED {0}", ex.Message); + } + } + + private async Task CreateTable() + { + // Create an MSTable instance to allow us to work with the TodoItem table + todoTable = client.GetTable(); + } + + async public Task> RefreshDataAsync() + { + try + { + // This code refreshes the entries in the list view by querying the TodoItems table. + // The query excludes completed TodoItems + Items = await todoTable + .Where (todoItem => todoItem.Complete == false).ToListAsync(); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + return null; + } + + return Items; + } + + public async Task InsertTodoItemAsync(TodoItem todoItem) + { + try + { + // This code inserts a new TodoItem into the database. When the operation completes + // and Mobile Services has assigned an Id, the item is added to the CollectionView + await todoTable.InsertAsync(todoItem); + + Items.Add(todoItem); + + return Items.IndexOf(todoItem); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine(@"ERROR {0}", e.Message); + return 0; + } + } + + public async Task CompleteItemAsync(TodoItem item) + { + try + { + // This code takes a freshly completed TodoItem and updates the database. When the MobileService + // responds, the item is removed from the list + item.Complete = true; + await todoTable.UpdateAsync(item); + Items.Remove(item); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + } + } + + void Busy(bool busy) + { + // assumes always executes on UI thread + if (busy) + { + if (busyCount++ == 0 && BusyUpdate != null) + BusyUpdate(true); + } + else + { + if (--busyCount == 0 && BusyUpdate != null) + BusyUpdate(false); + } + } + + #region implemented abstract members of HttpMessageHandler + + protected override async Task SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + Busy (true); + var response = await base.SendAsync (request, cancellationToken); + + Busy (false); + return response; + } + + #endregion + } +} \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj new file mode 100644 index 000000000..4d0b3aed1 --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj @@ -0,0 +1,166 @@ + + + + Debug + iPhoneSimulator + {07F1CD1B-626F-4BE5-9840-97B44CBB94C9} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + XamarinTodoQuickStart + Resources + XamarinTodoQuickStart + Xamarin.iOS + v1.0 + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + SdkOnly + false + true + x86_64 + NSUrlSessionHandler + iPhone Developer + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + false + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + true + false + iPhone Developer + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + iPhone Developer + false + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Ad-Hoc + prompt + 4 + iPhone Distribution + true + false + Automatic:AdHoc + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\AppStore + prompt + 4 + iPhone Distribution + false + Automatic:AppStore + ARM64 + NSUrlSessionHandler + + + + + + + + + + ..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll + + + ..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll + + + ..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll + + + ..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll + + + ..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll + + + ..\packages\Validation.2.2.8\lib\dotnet\Validation.dll + + + ..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll + + + ..\packages\Microsoft.Azure.Mobile.Client.4.0.2\lib\xamarinios10\Microsoft.Azure.Mobile.Client.dll + + + + + + + + + + + + + + + + + TodoListViewController.cs + + + + + + + + + + + + + + + + 1.3.1 + False + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/packages.config b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/packages.config new file mode 100644 index 000000000..06847c21c --- /dev/null +++ b/Azure/GetStartedWithUsers/iOS/XamarinTodoQuickStart/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GetStartedWithUsers/readme.md b/Azure/GetStartedWithUsers/readme.md new file mode 100644 index 000000000..fbac11140 --- /dev/null +++ b/Azure/GetStartedWithUsers/readme.md @@ -0,0 +1,5 @@ +Get Started with User Authentication +===================== + +using Windows Azure and Xamarin +------------------------------- diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart.Android.sln b/Azure/GettingStarted/Android/XamarinTodoQuickStart.Android.sln new file mode 100644 index 000000000..207f1fe34 --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart.Android.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamarinTodoQuickStart.Android", "XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj", "{8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Build.0 = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Constants.cs b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Constants.cs new file mode 100644 index 000000000..121ab922e --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Constants.cs @@ -0,0 +1,11 @@ +using System; + +namespace XamarinTodoQuickStart +{ + public static class Constants + { + // Azure app specific URL and key + public const string ApplicationURL = @"https://your_app_name.azurewebsites.net/"; + } +} + diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml new file mode 100644 index 000000000..3d22b16f0 --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..2bc8c83f4 --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XamarinTodoQuickStart")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/SoMA/Android/Resources/AboutResources.txt b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/AboutResources.txt similarity index 100% rename from SoMA/Android/Resources/AboutResources.txt rename to Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/AboutResources.txt diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs new file mode 100644 index 000000000..3ad7a6304 --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs @@ -0,0 +1,230 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("XamarinTodoQuickStart.Resource", IsApplication=true)] + +namespace XamarinTodoQuickStart +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_in_right = global::XamarinTodoQuickStart.Resource.Animation.slide_in_right; + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_out_left = global::XamarinTodoQuickStart.Resource.Animation.slide_out_left; + global::Xamarin.Auth._MobileServices.Resource.Drawable.ic_arrow_back = global::XamarinTodoQuickStart.Resource.Drawable.ic_arrow_back; + global::Xamarin.Auth._MobileServices.Resource.Id.webview = global::XamarinTodoQuickStart.Resource.Id.webview; + global::Xamarin.Auth._MobileServices.Resource.Layout.activity_webview = global::XamarinTodoQuickStart.Resource.Layout.activity_webview; + global::Xamarin.Auth._MobileServices.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::Xamarin.Auth._MobileServices.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + global::Xamarin.Auth._MobileServices.Resource.String.title_activity_webview = global::XamarinTodoQuickStart.Resource.String.title_activity_webview; + global::PCLCrypto.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::PCLCrypto.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + } + + public partial class Animation + { + + // aapt resource value: 0x7f040000 + public const int slide_in_right = 2130968576; + + // aapt resource value: 0x7f040001 + public const int slide_out_left = 2130968577; + + static Animation() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Animation() + { + } + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int ic_arrow_back = 2130837504; + + // aapt resource value: 0x7f020001 + public const int ic_launcher = 2130837505; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + // aapt resource value: 0x7f080000 + public const int LinearLayout1 = 2131230720; + + // aapt resource value: 0x7f080004 + public const int buttonAddTodo = 2131230724; + + // aapt resource value: 0x7f080007 + public const int checkTodoItem = 2131230727; + + // aapt resource value: 0x7f080005 + public const int listViewTodo = 2131230725; + + // aapt resource value: 0x7f080002 + public const int loadingProgressBar = 2131230722; + + // aapt resource value: 0x7f080008 + public const int menu_refresh = 2131230728; + + // aapt resource value: 0x7f080003 + public const int textNewTodo = 2131230723; + + // aapt resource value: 0x7f080001 + public const int textViewTitle = 2131230721; + + // aapt resource value: 0x7f080006 + public const int webview = 2131230726; + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + // aapt resource value: 0x7f030000 + public const int Activity_To_Do = 2130903040; + + // aapt resource value: 0x7f030001 + public const int activity_webview = 2130903041; + + // aapt resource value: 0x7f030002 + public const int Row_List_To_Do = 2130903042; + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class Menu + { + + // aapt resource value: 0x7f070000 + public const int activity_main = 2131165184; + + static Menu() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Menu() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f050001 + public const int ApplicationName = 2131034113; + + // aapt resource value: 0x7f050000 + public const int Hello = 2131034112; + + // aapt resource value: 0x7f050005 + public const int add_button_text = 2131034117; + + // aapt resource value: 0x7f050004 + public const int add_textbox_hint = 2131034116; + + // aapt resource value: 0x7f050003 + public const int app_name = 2131034115; + + // aapt resource value: 0x7f050008 + public const int checkbox_text = 2131034120; + + // aapt resource value: 0x7f050007 + public const int menu_refresh = 2131034119; + + // aapt resource value: 0x7f050006 + public const int mobile_services = 2131034118; + + // aapt resource value: 0x7f050002 + public const int title_activity_webview = 2131034114; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + + public partial class Style + { + + // aapt resource value: 0x7f060000 + public const int AppBaseTheme = 2131099648; + + // aapt resource value: 0x7f060001 + public const int AppTheme = 2131099649; + + static Style() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Style() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..b2f7c2b5f Binary files /dev/null and b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png differ diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..c2219b558 Binary files /dev/null and b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png differ diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..b2c79b7ed Binary files /dev/null and b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png differ diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..fc4b43087 Binary files /dev/null and b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png differ diff --git a/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml new file mode 100644 index 000000000..2e8775ee8 --- /dev/null +++ b/Azure/GettingStarted/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard new file mode 100755 index 000000000..87a5f0ec5 --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/Default.png b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/Default.png new file mode 100755 index 000000000..4c8ca6f69 Binary files /dev/null and b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/Default.png differ diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/Default@2x.png b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/Default@2x.png new file mode 100755 index 000000000..35b84cffe Binary files /dev/null and b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/Default@2x.png differ diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib new file mode 100644 index 000000000..9ca3deadd --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoItem.cs b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoItem.cs new file mode 100644 index 000000000..ab294b6f5 --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoItem.cs @@ -0,0 +1,18 @@ +using System; +using Newtonsoft.Json; + +namespace XamarinTodoQuickStart +{ + public class TodoItem + { + // Tables created prior to November 2013 should use 'int' type. Check your configuration. + public string Id { get; set; } + + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + [JsonProperty(PropertyName = "complete")] + public bool Complete { get; set; } + } +} + diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoListViewController.cs b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoListViewController.cs new file mode 100644 index 000000000..970c7a9bf --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoListViewController.cs @@ -0,0 +1,171 @@ +// This file has been autogenerated from parsing an Objective-C header file added in Xcode. +using System; +using Foundation; +using UIKit; +using System.Threading.Tasks; + +namespace XamarinTodoQuickStart +{ + public partial class TodoListViewController : UITableViewController + { + // Private Variables + private TodoService todoService; + private bool useRefreshControl = false; + + // Constructor + public TodoListViewController(IntPtr handle) : base(handle) + { + } + + public override async void ViewDidLoad() + { + base.ViewDidLoad(); + + todoService = TodoService.DefaultService; + + todoService.BusyUpdate += (bool busy) => { + if (busy) + activityIndicator.StartAnimating(); + else + activityIndicator.StopAnimating(); + }; + + AddRefreshControl(); + + await RefreshAsync(); + } + + async Task RefreshAsync() + { + // only activate the refresh control if the feature is available + if (useRefreshControl) + RefreshControl.BeginRefreshing(); + + await todoService.RefreshDataAsync(); + + if (useRefreshControl) + RefreshControl.EndRefreshing(); + + TableView.ReloadData(); + } + + #region UITableView methods + public override nint RowsInSection(UITableView tableview, nint section) + { + if (todoService == null || todoService.Items == null) + return 0; + + return todoService.Items.Count; + } + + public override nint NumberOfSections(UITableView tableView) + { + return 1; + } + + public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) + { + const string CellIdentifier = @"Cell"; + var cell = tableView.DequeueReusableCell(CellIdentifier); + if (cell == null) { + cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); + } + + // Set the label on the cell and make sure the label color is black (in case this cell + // has been reused and was previously greyed out + var label = (UILabel)cell.ViewWithTag(1); + label.TextColor = UIColor.Black; + label.Text = todoService.Items [indexPath.Row].Text; + + return cell; + } + + public override string TitleForDeleteConfirmation(UITableView tableView, NSIndexPath indexPath) + { + // Customize the Delete button to say "complete" + return @"complete"; + } + + public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath) + { + // Find the item that is about to be edited + var item = todoService.Items[indexPath.Row]; + + // If the item is complete, then this is just pending upload. Editing is not allowed + if (item.Complete) + return UITableViewCellEditingStyle.None; + + // Otherwise, allow the delete button to appear + return UITableViewCellEditingStyle.Delete; + } + + public async override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) + { + // Find item that was commited for editing (completed) + var item = todoService.Items[indexPath.Row]; + + // Change the appearance to look greyed out until we remove the item + var label = (UILabel)TableView.CellAt(indexPath).ViewWithTag(1); + label.TextColor = UIColor.Gray; + + // Ask the todoService to set the item's complete value to YES, and remove the row if successful + await todoService.CompleteItemAsync(item); + + // Remove the row from the UITableView + tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Top); + } + + #endregion + + #region UI Actions + + async partial void OnAdd(NSObject sender) + { + if (string.IsNullOrWhiteSpace(itemText.Text)) + return; + + var newItem = new TodoItem() { + Text = itemText.Text, + Complete = false + }; + + int index = await todoService.InsertTodoItemAsync(newItem); + + TableView.InsertRows(new [] { NSIndexPath.FromItemSection(index, 0) }, + UITableViewRowAnimation.Top); + + itemText.Text = ""; + } + + #endregion + + #region UITextFieldDelegate methods + + [Export ("textFieldShouldReturn:")] + public virtual bool ShouldReturn(UITextField textField) + { + textField.ResignFirstResponder(); + return true; + } + + #endregion + + #region * iOS Specific Code + + // This method will add the UIRefreshControl to the table view if + // it is available, ie, we are running on iOS 6+ + private void AddRefreshControl() + { + if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { + // the refresh control is available, let's add it + RefreshControl = new UIRefreshControl(); + RefreshControl.ValueChanged += async (sender, e) => { + await RefreshAsync(); + }; + useRefreshControl = true; + } + } + + #endregion + } +} diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs new file mode 100644 index 000000000..12f0e5151 --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs @@ -0,0 +1,40 @@ +// WARNING +// +// This file has been generated automatically by Visual Studio from the outlets and +// actions declared in your storyboard file. +// Manual changes to this file will not be maintained. +// +using Foundation; +using System; +using System.CodeDom.Compiler; + +namespace XamarinTodoQuickStart +{ + [Register ("TodoListViewController")] + partial class TodoListViewController + { + [Outlet] + UIKit.UIActivityIndicatorView activityIndicator { get; set; } + + + [Outlet] + UIKit.UITextField itemText { get; set; } + + + [Action ("OnAdd:")] + partial void OnAdd (Foundation.NSObject sender); + + void ReleaseDesignerOutlets () + { + if (activityIndicator != null) { + activityIndicator.Dispose (); + activityIndicator = null; + } + + if (itemText != null) { + itemText.Dispose (); + itemText = null; + } + } + } +} \ No newline at end of file diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoService.cs b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoService.cs new file mode 100644 index 000000000..d0109364e --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/TodoService.cs @@ -0,0 +1,121 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using System.Collections.Generic; +using Microsoft.WindowsAzure.MobileServices; + +namespace XamarinTodoQuickStart +{ + public class TodoService : DelegatingHandler + { + private static TodoService todoServiceInstance = new TodoService(); + public static TodoService DefaultService { get { return todoServiceInstance; } } + + private MobileServiceClient client; + private IMobileServiceTable todoTable; + + public List Items { get; private set;} + private int busyCount = 0; + + // Public events + public event Action BusyUpdate; + + // Constructor + protected TodoService() + { + + Items = new List(); + + CurrentPlatform.Init (); + // Initialize the Mobile Service client with your URL and key + client = new MobileServiceClient (Constants.ApplicationURL); + + // Create an MSTable instance to allow us to work with the TodoItem table + todoTable = client.GetTable (); + } + + async public Task> RefreshDataAsync() + { + try + { + // This code refreshes the entries in the list view by querying the TodoItems table. + // The query excludes completed TodoItems + Items = await todoTable + .Where (todoItem => todoItem.Complete == false).ToListAsync(); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + return null; + } + + return Items; + } + + public async Task InsertTodoItemAsync(TodoItem todoItem) + { + try + { + // This code inserts a new TodoItem into the database. When the operation completes + // and Mobile Services has assigned an Id, the item is added to the CollectionView + await todoTable.InsertAsync(todoItem); + + Items.Add(todoItem); + + return Items.IndexOf(todoItem); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine(@"ERROR {0}", e.Message); + return 0; + } + } + + public async Task CompleteItemAsync(TodoItem item) + { + try + { + // This code takes a freshly completed TodoItem and updates the database. When the MobileService + // responds, the item is removed from the list + item.Complete = true; + await todoTable.UpdateAsync(item); + Items.Remove(item); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + } + } + + void Busy(bool busy) + { + // assumes always executes on UI thread + if (busy) + { + if (busyCount++ == 0 && BusyUpdate != null) + BusyUpdate(true); + } + else + { + if (--busyCount == 0 && BusyUpdate != null) + BusyUpdate(false); + } + } + + #region implemented abstract members of HttpMessageHandler + + protected override async Task SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + Busy (true); + var response = await base.SendAsync (request, cancellationToken); + + Busy (false); + return response; + } + + #endregion + } +} \ No newline at end of file diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj new file mode 100644 index 000000000..cbce0c1ca --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj @@ -0,0 +1,168 @@ + + + + Debug + iPhoneSimulator + {07F1CD1B-626F-4BE5-9840-97B44CBB94C9} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + XamarinTodoQuickStart + Resources + XamarinTodoQuickStart + Xamarin.iOS + v1.0 + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + SdkOnly + false + true + + x86_64 + NSUrlSessionHandler + iPhone Developer + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + false + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + true + false + iPhone Developer + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + iPhone Developer + false + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Ad-Hoc + prompt + 4 + iPhone Distribution + true + false + Automatic:AdHoc + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\AppStore + prompt + 4 + iPhone Distribution + false + Automatic:AppStore + ARM64 + NSUrlSessionHandler + + + + + + + + + + ..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll + + + ..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll + + + ..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll + + + ..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll + + + ..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll + + + ..\packages\Validation.2.2.8\lib\dotnet\Validation.dll + + + ..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll + + + ..\packages\Microsoft.Azure.Mobile.Client.4.0.2\lib\xamarinios10\Microsoft.Azure.Mobile.Client.dll + + + + + + + + + + + + + + + + + TodoListViewController.cs + + + + + + + + + + + + + + + + 1.3.1 + False + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GettingStarted/iOS/XamarinTodoQuickStart/packages.config b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/packages.config new file mode 100644 index 000000000..06847c21c --- /dev/null +++ b/Azure/GettingStarted/iOS/XamarinTodoQuickStart/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/GettingStarted/readme.md b/Azure/GettingStarted/readme.md new file mode 100644 index 000000000..42df182ca --- /dev/null +++ b/Azure/GettingStarted/readme.md @@ -0,0 +1,8 @@ +Getting Started +===================== + +In order to successfully run this application, you'll need to update the fields in +`Constants.cs` with your own generated credentials. + +Additional information for using Windows Azure and Xamarin can be found here: +https://azure.microsoft.com/en-us/develop/mobile/xamarin/ \ No newline at end of file diff --git a/Azure/NotificationHubs/Android/AzureCloudCode/insert.js b/Azure/NotificationHubs/Android/AzureCloudCode/insert.js new file mode 100644 index 000000000..e71bfbdd3 --- /dev/null +++ b/Azure/NotificationHubs/Android/AzureCloudCode/insert.js @@ -0,0 +1,54 @@ +function insert(item, user, request) +{ + console.log('todoitem.Insert() fired'); + + if (item.text.length > 10) { + request.respond(statusCodes.BAD_REQUEST, 'Text length must be 10 characters or less.'); + } + else { + // item.createdAt = new Date(); + // item.userId = user.userId; + // request.execute(); + + // ANDROID - + if (item.channel) { + console.log('todoitem.Insert() - channel found on item'); + request.execute({ + success: function() { + console.log('todoitem.Insert() - request returned success'); + // Write to the response and then send the notification in the background + request.respond(); + push.gcm.send(item.channel, item.text, { + success: function(response) { + console.log('Push notification sent: ', response); + }, error: function(error) { + console.log('Error sending push notification: ', error); + } + }); + }, + error: function(response) { + console.log('todoitem.Insert() - error response'); + console.log('Request failed with response code ' + response.status + '.' + + 'Raw response: ' + response.text); + request.respond(); + } + }); + } + + // iOS - + if (item.deviceToken) { + request.execute(); + // Set timeout to delay the notification, to provide time for the + // app to be closed on the device to demonstrate toast notifications + setTimeout(function() { + push.apns.send(item.deviceToken, { + alert: "Toast: " + item.text, + payload: { + inAppMessage: "Hey, a new item arrived: '" + item.text + "'" + } + }); + }, 2500); + } + + } +} \ No newline at end of file diff --git a/Azure/NotificationHubs/Android/AzureCloudCode/read.js b/Azure/NotificationHubs/Android/AzureCloudCode/read.js new file mode 100644 index 000000000..b7ff50ce6 --- /dev/null +++ b/Azure/NotificationHubs/Android/AzureCloudCode/read.js @@ -0,0 +1,4 @@ +function read(query, user, request) { + // query.where({ userId: user.userId }); + request.execute(); +} \ No newline at end of file diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart.Android.sln b/Azure/NotificationHubs/Android/XamarinTodoQuickStart.Android.sln new file mode 100644 index 000000000..207f1fe34 --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart.Android.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamarinTodoQuickStart.Android", "XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj", "{8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Build.0 = Release|Any CPU + {8E1FCCF4-1FA7-4C23-86B0-19C78B155AA3}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = XamarinTodoQuickStart\XamarinTodoQuickStart.Android.csproj + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Constants.cs b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Constants.cs new file mode 100644 index 000000000..0db187ebb --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Constants.cs @@ -0,0 +1,17 @@ +using System; + +namespace XamarinTodoQuickStart +{ + public static class Constants + { + // Azure app specific URL and key + public const string ApplicationURL = @"https://your_app_name.azure-mobile.net/"; + public const string ApplicationKey = @"YOUR_APP_KEY"; + public const string SenderID = "YOUR_API_PROJ_NUMBER"; // Google API Project Number + + // Azure app specific connection string and hub path + public const string ConnectionString = "Endpoint=sb://quickstarthub-ns.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=YOUR_ACCESS_KEY"; + public const string NotificationHubPath = "QUICKSTARTHUB"; + } +} + diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/GcmService.cs b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/GcmService.cs new file mode 100644 index 000000000..362bac8df --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/GcmService.cs @@ -0,0 +1,161 @@ +using System.Text; +using Android.App; +using Android.Content; +using Android.Util; +using Gcm.Client; +using WindowsAzure.Messaging; +using System.Diagnostics; +using System.Collections.Generic; +using System; + + +//VERY VERY VERY IMPORTANT NOTE!!!! +// Your package name MUST NOT start with an uppercase letter. +// Android does not allow permissions to start with an upper case letter +// If it does you will get a very cryptic error in logcat and it will not be obvious why you are crying! +// So please, for the love of all that is kind on this earth, use a LOWERCASE first letter in your Package Name!!!! + + + +[assembly: Permission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")] +[assembly: UsesPermission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")] +[assembly: UsesPermission(Name = "com.google.android.c2dm.permission.RECEIVE")] + +//GET_ACCOUNTS is only needed for android versions 4.0.3 and below +[assembly: UsesPermission(Name = "android.permission.GET_ACCOUNTS")] +[assembly: UsesPermission(Name = "android.permission.INTERNET")] +[assembly: UsesPermission(Name = "android.permission.WAKE_LOCK")] + +namespace XamarinTodoQuickStart +{ + //You must subclass this! + [BroadcastReceiver(Permission= Gcm.Client.Constants.PERMISSION_GCM_INTENTS)] + [IntentFilter(new string[] { Gcm.Client.Constants.INTENT_FROM_GCM_MESSAGE }, Categories = new string[] { "@PACKAGE_NAME@" })] + [IntentFilter(new string[] { Gcm.Client.Constants.INTENT_FROM_GCM_REGISTRATION_CALLBACK }, Categories = new string[] { "@PACKAGE_NAME@" })] + [IntentFilter(new string[] { Gcm.Client.Constants.INTENT_FROM_GCM_LIBRARY_RETRY }, Categories = new string[] { "@PACKAGE_NAME@" })] + public class PushHandlerBroadcastReceiver : GcmBroadcastReceiverBase + { + //IMPORTANT: Change this to your own Sender ID! + //The SENDER_ID is your Google API Console App Project ID. + // Be sure to get the right Project ID from your Google APIs Console. It's not the named project ID that appears in the Overview, + // but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview + // where 785671162406 is the project id, which is the SENDER_ID to use! + public static string[] SENDER_IDS = new string[] { Constants.SenderID }; + + public const string TAG = "GoogleCloudMessaging"; + } + + [Service] //Must use the service tag + public class GcmService : GcmServiceBase + { + public static string RegistrationID { get; private set; } + static NotificationHub Hub { get; set; } + + public GcmService() : base(PushHandlerBroadcastReceiver.SENDER_IDS) + { + Log.Info(PushHandlerBroadcastReceiver.TAG, "GcmService() constructor"); + } + + // called from + public static void Initialize(Context context) + { + Hub = new NotificationHub (Constants.NotificationHubPath, Constants.ConnectionString, context); + } + public static void Register(Context Context) + { + // Makes this easier to call from our Activity + GcmClient.Register (Context, PushHandlerBroadcastReceiver.SENDER_IDS); + } + + protected override void OnRegistered (Context context, string registrationId) + { + Log.Verbose(PushHandlerBroadcastReceiver.TAG, "GCM Registered: " + registrationId); + RegistrationID = registrationId; + + if (Hub != null) + Hub.Register (registrationId, "TEST"); + } + + protected override void OnUnRegistered (Context context, string registrationId) + { + if (Hub != null) + Hub.Unregister (); + + Log.Verbose(PushHandlerBroadcastReceiver.TAG, "GCM Unregistered: " + registrationId); + + createNotification("GcmService Unregistered...", "The device has been unregistered, Tap to View!"); + } + + protected override void OnMessage (Context context, Intent intent) + { + Log.Info(PushHandlerBroadcastReceiver.TAG, "GCM Message Received!"); + + var msg = new StringBuilder(); + + if (intent != null && intent.Extras != null) + { + foreach (var key in intent.Extras.KeySet()) + msg.AppendLine(key + "=" + intent.Extras.Get(key).ToString()); + } + + //Store the message + var prefs = GetSharedPreferences(context.PackageName, FileCreationMode.Private); + var edit = prefs.Edit(); + edit.PutString("last_msg", msg.ToString()); + edit.Commit(); + + string message = intent.Extras.GetString("message"); + if (!string.IsNullOrEmpty(message)) + { + createNotification("New todo item!", "Todo item: " + message); + return; + } + + string msg2 = intent.Extras.GetString("msg"); + if (!string.IsNullOrEmpty(msg2)) + { + createNotification("New hub message!", msg2); + return; + } + + // createNotification("PushSharp-GCM Msg Rec'd", "Message Received for C2DM-Sharp... Tap to View!"); + createNotification("Unknown message details", msg.ToString()); + } + + protected override bool OnRecoverableError (Context context, string errorId) + { + Log.Warn(PushHandlerBroadcastReceiver.TAG, "Recoverable Error: " + errorId); + + return base.OnRecoverableError (context, errorId); + } + + protected override void OnError (Context context, string errorId) + { + Log.Error(PushHandlerBroadcastReceiver.TAG, "GCM Error: " + errorId); + } + + void createNotification(string title, string desc) + { + //Create notification + var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager; + + //Create an intent to show ui + var uiIntent = new Intent(this, typeof(TodoActivity)); + + //Create the notification + var notification = new Notification(Android.Resource.Drawable.SymActionEmail, title); + + //Auto cancel will remove the notification once the user touches it + notification.Flags = NotificationFlags.AutoCancel; + + //Set the notification info + //we use the pending intent, passing our ui intent over which will get called + //when the notification is tapped. + notification.SetLatestEventInfo(this, title, desc, PendingIntent.GetActivity(this, 0, uiIntent, 0)); + + //Show the notification + notificationManager.Notify(1, notification); + } + } +} + diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml new file mode 100644 index 000000000..9a7d53ce4 --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..2bc8c83f4 --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XamarinTodoQuickStart")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/SoMA/Components/xamarin.mobile-0.6.2.1/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/AboutResources.txt similarity index 100% rename from SoMA/Components/xamarin.mobile-0.6.2.1/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/AboutResources.txt diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs new file mode 100644 index 000000000..9ced019cb --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/Resource.designer.cs @@ -0,0 +1,234 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("XamarinTodoQuickStart.Resource", IsApplication=true)] + +namespace XamarinTodoQuickStart +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + global::Gcm.Client.Resource.String.library_name = global::XamarinTodoQuickStart.Resource.String.library_name; + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_in_right = global::XamarinTodoQuickStart.Resource.Animation.slide_in_right; + global::Xamarin.Auth._MobileServices.Resource.Animation.slide_out_left = global::XamarinTodoQuickStart.Resource.Animation.slide_out_left; + global::Xamarin.Auth._MobileServices.Resource.Drawable.ic_arrow_back = global::XamarinTodoQuickStart.Resource.Drawable.ic_arrow_back; + global::Xamarin.Auth._MobileServices.Resource.Id.webview = global::XamarinTodoQuickStart.Resource.Id.webview; + global::Xamarin.Auth._MobileServices.Resource.Layout.activity_webview = global::XamarinTodoQuickStart.Resource.Layout.activity_webview; + global::Xamarin.Auth._MobileServices.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::Xamarin.Auth._MobileServices.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + global::Xamarin.Auth._MobileServices.Resource.String.title_activity_webview = global::XamarinTodoQuickStart.Resource.String.title_activity_webview; + global::PCLCrypto.Resource.String.ApplicationName = global::XamarinTodoQuickStart.Resource.String.ApplicationName; + global::PCLCrypto.Resource.String.Hello = global::XamarinTodoQuickStart.Resource.String.Hello; + } + + public partial class Animation + { + + // aapt resource value: 0x7f040000 + public const int slide_in_right = 2130968576; + + // aapt resource value: 0x7f040001 + public const int slide_out_left = 2130968577; + + static Animation() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Animation() + { + } + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int ic_arrow_back = 2130837504; + + // aapt resource value: 0x7f020001 + public const int ic_launcher = 2130837505; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + // aapt resource value: 0x7f080000 + public const int LinearLayout1 = 2131230720; + + // aapt resource value: 0x7f080004 + public const int buttonAddTodo = 2131230724; + + // aapt resource value: 0x7f080007 + public const int checkTodoItem = 2131230727; + + // aapt resource value: 0x7f080005 + public const int listViewTodo = 2131230725; + + // aapt resource value: 0x7f080002 + public const int loadingProgressBar = 2131230722; + + // aapt resource value: 0x7f080008 + public const int menu_refresh = 2131230728; + + // aapt resource value: 0x7f080003 + public const int textNewTodo = 2131230723; + + // aapt resource value: 0x7f080001 + public const int textViewTitle = 2131230721; + + // aapt resource value: 0x7f080006 + public const int webview = 2131230726; + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + // aapt resource value: 0x7f030000 + public const int Activity_To_Do = 2130903040; + + // aapt resource value: 0x7f030001 + public const int activity_webview = 2130903041; + + // aapt resource value: 0x7f030002 + public const int Row_List_To_Do = 2130903042; + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class Menu + { + + // aapt resource value: 0x7f070000 + public const int activity_main = 2131165184; + + static Menu() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Menu() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f050002 + public const int ApplicationName = 2131034114; + + // aapt resource value: 0x7f050001 + public const int Hello = 2131034113; + + // aapt resource value: 0x7f050006 + public const int add_button_text = 2131034118; + + // aapt resource value: 0x7f050005 + public const int add_textbox_hint = 2131034117; + + // aapt resource value: 0x7f050000 + public const int app_name = 2131034112; + + // aapt resource value: 0x7f050009 + public const int checkbox_text = 2131034121; + + // aapt resource value: 0x7f050004 + public const int library_name = 2131034116; + + // aapt resource value: 0x7f050008 + public const int menu_refresh = 2131034120; + + // aapt resource value: 0x7f050007 + public const int mobile_services = 2131034119; + + // aapt resource value: 0x7f050003 + public const int title_activity_webview = 2131034115; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + + public partial class Style + { + + // aapt resource value: 0x7f060000 + public const int AppBaseTheme = 2131099648; + + // aapt resource value: 0x7f060001 + public const int AppTheme = 2131099649; + + static Style() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Style() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..b2f7c2b5f Binary files /dev/null and b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-hdpi/ic_launcher.png differ diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..c2219b558 Binary files /dev/null and b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-ldpi/ic_launcher.png differ diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..b2c79b7ed Binary files /dev/null and b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-mdpi/ic_launcher.png differ diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..fc4b43087 Binary files /dev/null and b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/drawable-xhdpi/ic_launcher.png differ diff --git a/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml new file mode 100644 index 000000000..2e8775ee8 --- /dev/null +++ b/Azure/NotificationHubs/Android/XamarinTodoQuickStart/Resources/layout/Activity_To_Do.axml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard new file mode 100755 index 000000000..5894b2a4e --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/MainStoryboard_iPhone.storyboard @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/Default.png b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/Default.png new file mode 100755 index 000000000..4c8ca6f69 Binary files /dev/null and b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/Default.png differ diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/Default@2x.png b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/Default@2x.png new file mode 100755 index 000000000..35b84cffe Binary files /dev/null and b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/Default@2x.png differ diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib new file mode 100644 index 000000000..9ca3deadd --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/Resources/LaunchScreen.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoItem.cs b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoItem.cs new file mode 100644 index 000000000..44869a5df --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoItem.cs @@ -0,0 +1,17 @@ +using System; +using Newtonsoft.Json; + +namespace XamarinTodoQuickStart +{ + public class TodoItem + { + // Tables created prior to November 2013 should use 'int' type. Check your configuration. + public string Id { get; set; } + + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + [JsonProperty(PropertyName = "complete")] + public bool Complete { get; set; } + } +} \ No newline at end of file diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoListViewController.cs b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoListViewController.cs new file mode 100644 index 000000000..a1bfda013 --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoListViewController.cs @@ -0,0 +1,173 @@ +// This file has been autogenerated from parsing an Objective-C header file added in Xcode. +using System; +using Foundation; +using UIKit; +using System.Threading.Tasks; + +namespace XamarinTodoQuickStart +{ + public partial class TodoListViewController : UITableViewController + { + // Private Variables + private TodoService todoService; + private bool useRefreshControl = false; + + // Constructor + public TodoListViewController(IntPtr handle) : base(handle) + { + } + + public override async void ViewDidLoad() + { + base.ViewDidLoad(); + + todoService = TodoService.DefaultService; + + todoService.BusyUpdate += (bool busy) => { + if (busy) + activityIndicator.StartAnimating(); + else + activityIndicator.StopAnimating(); + }; + + AddRefreshControl(); + + await RefreshAsync(); + } + + async Task RefreshAsync() + { + // only activate the refresh control if the feature is available + if (useRefreshControl) + RefreshControl.BeginRefreshing(); + + await todoService.RefreshDataAsync(); + + if (useRefreshControl) + RefreshControl.EndRefreshing(); + + TableView.ReloadData(); + } + + #region UITableView methods + public override nint RowsInSection(UITableView tableview, nint section) + { + if (todoService == null || todoService.Items == null) + return 0; + + return todoService.Items.Count; + } + + public override nint NumberOfSections(UITableView tableView) + { + return 1; + } + + public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) + { + const string CellIdentifier = @"Cell"; + var cell = tableView.DequeueReusableCell(CellIdentifier); + if (cell == null) { + cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); + } + + // Set the label on the cell and make sure the label color is black (in case this cell + // has been reused and was previously greyed out + var label = (UILabel)cell.ViewWithTag(1); + label.TextColor = UIColor.Black; + label.Text = todoService.Items [indexPath.Row].Text; + + return cell; + } + + public override string TitleForDeleteConfirmation(UITableView tableView, NSIndexPath indexPath) + { + // Customize the Delete button to say "complete" + return @"complete"; + } + + public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath) + { + // Find the item that is about to be edited + var item = todoService.Items[indexPath.Row]; + + // If the item is complete, then this is just pending upload. Editing is not allowed + if (item.Complete) + return UITableViewCellEditingStyle.None; + + // Otherwise, allow the delete button to appear + return UITableViewCellEditingStyle.Delete; + } + + public async override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) + { + // Find item that was commited for editing (completed) + var item = todoService.Items[indexPath.Row]; + + // Change the appearance to look greyed out until we remove the item + var label = (UILabel)TableView.CellAt(indexPath).ViewWithTag(1); + label.TextColor = UIColor.Gray; + + // Ask the todoService to set the item's complete value to YES, and remove the row if successful + await todoService.CompleteItemAsync(item); + + // Remove the row from the UITableView + tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Top); + } + + #endregion + + #region UI Actions + + async partial void OnAdd(NSObject sender) + { + if (string.IsNullOrWhiteSpace(itemText.Text)) + return; + + var newItem = new TodoItem() { + Text = itemText.Text, + Complete = false + }; + + int index = await todoService.InsertTodoItemAsync(newItem); + if (index != -1) + { + TableView.InsertRows(new [] { NSIndexPath.FromItemSection(index, 0) }, + UITableViewRowAnimation.Top); + + itemText.Text = ""; + } + } + + #endregion + + #region UITextFieldDelegate methods + + [Export ("textFieldShouldReturn:")] + public virtual bool ShouldReturn(UITextField textField) + { + textField.ResignFirstResponder(); + return true; + } + + #endregion + + #region * iOS Specific Code + + // This method will add the UIRefreshControl to the table view if + // it is available, ie, we are running on iOS 6+ + private void AddRefreshControl() + { + if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { + // the refresh control is available, let's add it + RefreshControl = new UIRefreshControl(); + RefreshControl.ValueChanged += async (sender, e) => { + await RefreshAsync(); + }; + useRefreshControl = true; + } + } + + #endregion + } +} diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs new file mode 100644 index 000000000..8c7c47d97 --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoListViewController.designer.cs @@ -0,0 +1,36 @@ +// WARNING +// +// This file has been generated automatically by Xamarin Studio to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace XamarinTodoQuickStart +{ + [Register ("TodoListViewController")] + partial class TodoListViewController + { + [Outlet] + UIKit.UIActivityIndicatorView activityIndicator { get; set; } + + [Outlet] + UIKit.UITextField itemText { get; set; } + + [Action ("OnAdd:")] + partial void OnAdd (Foundation.NSObject sender); + + void ReleaseDesignerOutlets () + { + if (itemText != null) { + itemText.Dispose (); + itemText = null; + } + + if (activityIndicator != null) { + activityIndicator.Dispose (); + activityIndicator = null; + } + } + } +} diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoService.cs b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoService.cs new file mode 100644 index 000000000..d3c23e519 --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/TodoService.cs @@ -0,0 +1,147 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using System.Collections.Generic; +using Microsoft.WindowsAzure.MobileServices; +using UIKit; + +namespace XamarinTodoQuickStart +{ + public class TodoService : DelegatingHandler + { + private static TodoService todoServiceInstance = new TodoService(); + public static TodoService DefaultService { get { return todoServiceInstance; } } + + private MobileServiceClient client; + private IMobileServiceTable todoTable; + + public List Items { get; private set;} + private int busyCount = 0; + + // Public events + public event Action BusyUpdate; + + // Constructor + protected TodoService() + { + Items = new List(); + + CurrentPlatform.Init (); + // Initialize the Mobile Service client with your URL and key + client = new MobileServiceClient(Constants.ApplicationURL); + + // Create an MSTable instance to allow us to work with the TodoItem table + todoTable = client.GetTable (); + } + + async public Task> RefreshDataAsync() + { + try + { + // This code refreshes the entries in the list view by querying the TodoItems table. + // The query excludes completed TodoItems + Items = await todoTable + .Where (todoItem => todoItem.Complete == false).ToListAsync(); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + return null; + } + + return Items; + } + + public async Task InsertTodoItemAsync(TodoItem todoItem) + { + try + { + // This code inserts a new TodoItem into the database. When the operation completes + // and Mobile Services has assigned an Id, the item is added to the CollectionView + await todoTable.InsertAsync(todoItem); + + Items.Add(todoItem); + + return Items.IndexOf(todoItem); + + } + catch (MobileServiceInvalidOperationException e) + { + // In a previous version of Azure Mobile Services this exception was wrapped + // in an Exception. This is why I've duplicated the code for handling it, + // but probably for newer versions of Azure Mobile services you could + // have simpler exception handling. + Console.Error.WriteLine(@"ERROR {0}", e.Message); + + UIAlertView alert = new UIAlertView() { + Title = "Error", + Message = e.Message + } ; + alert.AddButton("Ok"); + alert.Show(); + + return -1; + } + catch (Exception ex) + { + var exDetail = (ex.InnerException.InnerException as MobileServiceInvalidOperationException); + Console.WriteLine(exDetail.Message); + + UIAlertView alert = new UIAlertView() { + Title = "Error", + Message = exDetail.Message + } ; + alert.AddButton("Ok"); + alert.Show(); + + return -1; + } + } + + public async Task CompleteItemAsync(TodoItem item) + { + try + { + // This code takes a freshly completed TodoItem and updates the database. When the MobileService + // responds, the item is removed from the list + item.Complete = true; + await todoTable.UpdateAsync(item); + Items.Remove(item); + + } + catch (MobileServiceInvalidOperationException e) + { + Console.Error.WriteLine (@"ERROR {0}", e.Message); + } + } + + void Busy(bool busy) + { + // assumes always executes on UI thread + if (busy) + { + if (busyCount++ == 0 && BusyUpdate != null) + BusyUpdate(true); + } + else + { + if (--busyCount == 0 && BusyUpdate != null) + BusyUpdate(false); + } + } + + #region implemented abstract members of HttpMessageHandler + + protected override async Task SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + Busy (true); + var response = await base.SendAsync (request, cancellationToken); + + Busy (false); + return response; + } + + #endregion + } +} \ No newline at end of file diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj new file mode 100644 index 000000000..476a51cef --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/XamarinTodoQuickStart.iOS.csproj @@ -0,0 +1,167 @@ + + + + Debug + iPhoneSimulator + {07F1CD1B-626F-4BE5-9840-97B44CBB94C9} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + XamarinTodoQuickStart + Resources + XamarinTodoQuickStart + Xamarin.iOS + v1.0 + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + SdkOnly + false + true + + x86_64 + NSUrlSessionHandler + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + false + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + true + false + iPhone Developer + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + iPhone Developer + false + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\Ad-Hoc + prompt + 4 + iPhone Distribution + true + false + Automatic:AdHoc + + ARM64 + NSUrlSessionHandler + + + full + true + bin\iPhone\AppStore + prompt + 4 + iPhone Distribution + false + Automatic:AppStore + ARM64 + NSUrlSessionHandler + + + + + + + + + + ..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll + + + ..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll + + + ..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll + + + ..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll + + + ..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll + + + ..\packages\Validation.2.2.8\lib\dotnet\Validation.dll + + + ..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll + + + ..\packages\Microsoft.Azure.Mobile.Client.4.0.2\lib\xamarinios10\Microsoft.Azure.Mobile.Client.dll + + + + + + + + + + + + + + + + + TodoListViewController.cs + + + + + + + + + + + + + + + + 1.3.1 + False + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/packages.config b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/packages.config new file mode 100644 index 000000000..06847c21c --- /dev/null +++ b/Azure/ValidateModifyData/iOS/XamarinTodoQuickStart/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Azure/ValidateModifyData/readme.md b/Azure/ValidateModifyData/readme.md new file mode 100644 index 000000000..708c7a2b4 --- /dev/null +++ b/Azure/ValidateModifyData/readme.md @@ -0,0 +1,5 @@ +Validate and Modify Data +===================== + +using Windows Azure and Xamarin +------------------------------- diff --git a/BackgroundLocationDemo/BackgroundLocationDemo.sln b/BackgroundLocationDemo/BackgroundLocationDemo.sln index 2efad049f..db456d94a 100644 --- a/BackgroundLocationDemo/BackgroundLocationDemo.sln +++ b/BackgroundLocationDemo/BackgroundLocationDemo.sln @@ -1,42 +1,38 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Location.iOS", "Location.iOS\Location.iOS.csproj", "{D2D08A68-F3B6-4730-96F9-9053CD76B2A5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Location.Droid", "Location.Android\Location.Droid.csproj", "{89E83FD6-327A-4976-B720-E28B0970F516}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Ad-Hoc|Any CPU = Ad-Hoc|Any CPU + Ad-Hoc|iPhone = Ad-Hoc|iPhone + Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator + AppStore|Any CPU = AppStore|Any CPU + AppStore|iPhone = AppStore|iPhone + AppStore|iPhoneSimulator = AppStore|iPhoneSimulator Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator Debug|iPhone = Debug|iPhone + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|Any CPU = Release|Any CPU Release|iPhone = Release|iPhone - Ad-Hoc|iPhone = Ad-Hoc|iPhone - AppStore|iPhone = AppStore|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhone.Build.0 = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|Any CPU.Build.0 = Debug|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhone.Build.0 = Debug|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Release|Any CPU.ActiveCfg = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Release|Any CPU.Build.0 = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhone.ActiveCfg = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhone.Build.0 = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhoneSimulator {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone + {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator + {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator + {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.AppStore|Any CPU.ActiveCfg = AppStore|iPhoneSimulator {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.AppStore|iPhone.ActiveCfg = AppStore|iPhone {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.AppStore|iPhone.Build.0 = AppStore|iPhone + {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator + {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -49,6 +45,41 @@ Global {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Release|iPhone.Build.0 = Release|iPhone {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {D2D08A68-F3B6-4730-96F9-9053CD76B2A5}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|Any CPU.Deploy.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|Any CPU.Deploy.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhone.Build.0 = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.AppStore|iPhoneSimulator.Deploy.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhone.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Release|Any CPU.Build.0 = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhone.ActiveCfg = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhone.Build.0 = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {89E83FD6-327A-4976-B720-E28B0970F516}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F4624114-C8F8-4D9B-B634-5315C81F91D7} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Location.iOS\Location.iOS.csproj diff --git a/BackgroundLocationDemo/location.Android/App.cs b/BackgroundLocationDemo/location.Android/App.cs index ce5f94bdb..a76d1f77d 100644 --- a/BackgroundLocationDemo/location.Android/App.cs +++ b/BackgroundLocationDemo/location.Android/App.cs @@ -1,87 +1,111 @@ using System; -using System.Threading; using System.Threading.Tasks; +using Android.App; using Android.Content; +using Android.OS; using Android.Util; using Location.Droid.Services; -/// -/// Singleton class for Application wide objects. -/// namespace Location.Droid { - public class App - { - // events - public event EventHandler LocationServiceConnected = delegate {}; - - // declarations - protected readonly string logTag = "App"; - protected LocationServiceConnection locationServiceConnection; - - // properties - - public static App Current - { - get { return current; } - } private static App current; - - public LocationService LocationService - { - get { - if (this.locationServiceConnection.Binder == null) - throw new Exception ("Service not bound yet"); - // note that we use the ServiceConnection to get the Binder, and the Binder to get the Service here - return this.locationServiceConnection.Binder.Service; - } - } - - #region Application context - - static App () - { - current = new App(); - } - protected App () - { - // starting a service like this is blocking, so we want to do it on a background thread - new Task ( () => { - - // start our main service - Log.Debug (logTag, "Calling StartService"); - Android.App.Application.Context.StartService (new Intent (Android.App.Application.Context, typeof(LocationService))); - - // create a new service connection so we can get a binder to the service - this.locationServiceConnection = new LocationServiceConnection (null); - - // this event will fire when the Service connectin in the OnServiceConnected call - this.locationServiceConnection.ServiceConnected += (object sender, ServiceConnectedEventArgs e) => { - - Log.Debug (logTag, "Service Connected"); - // we will use this event to notify MainActivity when to start updating the UI - this.LocationServiceConnected ( this, e ); - - }; - - // bind our service (Android goes and finds the running service by type, and puts a reference - // on the binder to that service) - // The Intent tells the OS where to find our Service (the Context) and the Type of Service - // we're looking for (LocationService) - Intent locationServiceIntent = new Intent (Android.App.Application.Context, typeof(LocationService)); - Log.Debug (logTag, "Calling service binding"); - - // Finally, we can bind to the Service using our Intent and the ServiceConnection we - // created in a previous step. - Android.App.Application.Context.BindService (locationServiceIntent, locationServiceConnection, Bind.AutoCreate); - - } ).Start (); - } - - #endregion - - } -} + public class App + { + protected static LocationServiceConnection locationServiceConnection; + + // declarations + protected readonly string logTag = "App"; + + static App() + { + Current = new App(); + } + + protected App() + { + // create a new service connection so we can get a binder to the service + locationServiceConnection = new LocationServiceConnection(null); + + // this event will fire when the Service connectin in the OnServiceConnected call + locationServiceConnection.ServiceConnected += (sender, e) => + { + Log.Debug(logTag, "Service Connected"); + // we will use this event to notify MainActivity when to start updating the UI + LocationServiceConnected(this, e); + }; + } + + // properties + + public static App Current { get; } + + public LocationService LocationService + { + get + { + if (locationServiceConnection.Binder == null) + { + throw new Exception("Service not bound yet"); + } + // note that we use the ServiceConnection to get the Binder, and the Binder to get the Service here + return locationServiceConnection.Binder.Service; + } + } + // events + public event EventHandler LocationServiceConnected = delegate { }; + + public static void StartLocationService() + { + // Starting a service like this is blocking, so we want to do it on a background thread + new Task(() => + { + // Start our main service + Log.Debug("App", "Calling StartService"); + + // Check if device is running Android 8.0 or higher and if so, use the newer StartForegroundService() method + if (Build.VERSION.SdkInt >= BuildVersionCodes.O) + { + Application.Context.StartForegroundService(new Intent(Application.Context, typeof(LocationService))); + } + else // For older versions, use the traditional StartService() method + { + Application.Context.StartService(new Intent(Application.Context, typeof(LocationService))); + } + + // bind our service (Android goes and finds the running service by type, and puts a reference + // on the binder to that service) + // The Intent tells the OS where to find our Service (the Context) and the Type of Service + // we're looking for (LocationService) + var locationServiceIntent = new Intent(Application.Context, typeof(LocationService)); + Log.Debug("App", "Calling service binding"); + + // Finally, we can bind to the Service using our Intent and the ServiceConnection we + // created in a previous step. + Application.Context.BindService(locationServiceIntent, locationServiceConnection, Bind.AutoCreate); + }).Start(); + } + + public static void StopLocationService() + { + // Check for nulls in case StartLocationService task has not yet completed. + Log.Debug("App", "StopLocationService"); + + // Unbind from the LocationService; otherwise, StopSelf (below) will not work: + if (locationServiceConnection != null) + { + Log.Debug("App", "Unbinding from LocationService"); + Application.Context.UnbindService(locationServiceConnection); + } + + // Stop the LocationService: + if (Current.LocationService != null) + { + Log.Debug("App", "Stopping the LocationService"); + Current.LocationService.StopSelf(); + } + } + } +} diff --git a/BackgroundLocationDemo/location.Android/Location.Droid.csproj b/BackgroundLocationDemo/location.Android/Location.Droid.csproj index dee7a4451..9ce7177ca 100644 --- a/BackgroundLocationDemo/location.Android/Location.Droid.csproj +++ b/BackgroundLocationDemo/location.Android/Location.Droid.csproj @@ -1,4 +1,4 @@ - + Debug @@ -16,6 +16,8 @@ Resources\Resource.designer.cs Resource location.Androidd + v8.1 + false True @@ -75,9 +77,21 @@ - - - + + 27.0.2.1 + + + 27.0.2.1 + + + 27.0.2.1 + + + + + + + \ No newline at end of file diff --git a/BackgroundLocationDemo/location.Android/MainActivity.cs b/BackgroundLocationDemo/location.Android/MainActivity.cs index 06ad3e29e..2d4be3b18 100644 --- a/BackgroundLocationDemo/location.Android/MainActivity.cs +++ b/BackgroundLocationDemo/location.Android/MainActivity.cs @@ -1,117 +1,181 @@ using System; + +using Android; using Android.App; -using Android.Widget; +using Android.Content.PM; +using Android.Locations; using Android.OS; +using Android.Support.Design.Widget; +using Android.Support.V4.App; +using Android.Support.V4.Content; +using Android.Support.V7.App; using Android.Util; -using Android.Locations; -using Location.Droid.Services; +using Android.Views; +using Android.Widget; namespace Location.Droid { - [Activity (Label = "AndroidLocationService", MainLauncher = true)] - public class MainActivity : Activity - { - readonly string logTag = "MainActivity"; - - // make our labels - TextView latText; - TextView longText; - TextView altText; - TextView speedText; - TextView bearText; - TextView accText; - - #region Lifecycle - - //Lifecycle stages - protected override void OnCreate (Bundle bundle) - { - base.OnCreate (bundle); - - SetContentView (Resource.Layout.Main); - - // This event fires when the ServiceConnection lets the client (our App class) know that - // the Service is connected. We use this event to start updating the UI with location - // updates from the Service - App.Current.LocationServiceConnected += (object sender, ServiceConnectedEventArgs e) => { - Log.Debug (logTag, "ServiceConnected Event Raised"); - // notifies us of location changes from the system - App.Current.LocationService.LocationChanged += HandleLocationChanged; - //notifies us of user changes to the location provider (ie the user disables or enables GPS) - App.Current.LocationService.ProviderDisabled += HandleProviderDisabled; - App.Current.LocationService.ProviderEnabled += HandleProviderEnabled; - // notifies us of the changing status of a provider (ie GPS no longer available) - App.Current.LocationService.StatusChanged += HandleStatusChanged; - }; - - latText = FindViewById (Resource.Id.lat); - longText = FindViewById (Resource.Id.longx); - altText = FindViewById (Resource.Id.alt); - speedText = FindViewById (Resource.Id.speed); - bearText = FindViewById (Resource.Id.bear); - accText = FindViewById (Resource.Id.acc); - } - - protected override void OnPause() - { - Log.Debug (logTag, "Location app is moving to background"); - base.OnPause(); - } - - protected override void OnResume() - { - Log.Debug (logTag, "Location app is moving into foreground"); - base.OnPause(); - } - - protected override void OnDestroy () - { - Log.Debug (logTag, "Location app is becoming inactive"); - base.OnDestroy (); - } - - #endregion - - #region Android Location Service methods - - /// - /// Updates UI with location data - /// - public void HandleLocationChanged(object sender, LocationChangedEventArgs e) - { - Android.Locations.Location location = e.Location; - Log.Debug (logTag, "Foreground updating"); - - // these events are on a background thread, need to update on the UI thread - RunOnUiThread (() => { - latText.Text = String.Format ("Latitude: {0}", location.Latitude); - longText.Text = String.Format ("Longitude: {0}", location.Longitude); - altText.Text = String.Format ("Altitude: {0}", location.Altitude); - speedText.Text = String.Format ("Speed: {0}", location.Speed); - accText.Text = String.Format ("Accuracy: {0}", location.Accuracy); - bearText.Text = String.Format ("Bearing: {0}", location.Bearing); - }); - - } - - public void HandleProviderDisabled(object sender, ProviderDisabledEventArgs e) - { - Log.Debug (logTag, "Location provider disabled event raised"); - } - - public void HandleProviderEnabled(object sender, ProviderEnabledEventArgs e) - { - Log.Debug (logTag, "Location provider enabled event raised"); - } - - public void HandleStatusChanged(object sender, StatusChangedEventArgs e) - { - Log.Debug (logTag, "Location status changed, event raised"); - } - - #endregion - - } + [Activity(Label = "LocationDroid", MainLauncher = true, + ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout)] + public class MainActivity : AppCompatActivity + { + static readonly int RC_REQUEST_LOCATION_PERMISSION = 1000; + static readonly string TAG = "MainActivity"; + static readonly string[] REQUIRED_PERMISSIONS = {Manifest.Permission.AccessFineLocation}; + TextView accText; + TextView altText; + TextView bearText; + + // make our labels + TextView latText; + TextView longText; + TextView speedText; + + //Lifecycle stages + protected override void OnCreate(Bundle bundle) + { + base.OnCreate(bundle); + Log.Debug(TAG, "OnCreate: Location app is coming to life."); + + SetContentView(Resource.Layout.Main); + + // This event fires when the ServiceConnection lets the client (our App class) know that + // the Service is connected. We use this event to start updating the UI with location + // updates from the Service + App.Current.LocationServiceConnected += (sender, e) => + { + Log.Debug(TAG, "ServiceConnected Event Raised"); + // notifies us of location changes from the system + App.Current.LocationService.LocationChanged += HandleLocationChanged; + //notifies us of user changes to the location provider (ie the user disables or enables GPS) + App.Current.LocationService.ProviderDisabled += HandleProviderDisabled; + App.Current.LocationService.ProviderEnabled += HandleProviderEnabled; + // notifies us of the changing status of a provider (ie GPS no longer available) + App.Current.LocationService.StatusChanged += HandleStatusChanged; + }; + + + latText = FindViewById(Resource.Id.lat); + longText = FindViewById(Resource.Id.longx); + altText = FindViewById(Resource.Id.alt); + speedText = FindViewById(Resource.Id.speed); + bearText = FindViewById(Resource.Id.bear); + accText = FindViewById(Resource.Id.acc); + + altText.Text = "altitude"; + speedText.Text = "speed"; + bearText.Text = "bearing"; + accText.Text = "accuracy"; + + // Start the location service: + if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) == (int) Permission.Granted) + { + Log.Debug(TAG, "User already has granted permission."); + App.StartLocationService(); + } + else + { + Log.Debug(TAG, "Have to request permission from the user. "); + RequestLocationPermission(); + } + } + + protected override void OnResume() + { + Log.Debug(TAG, "OnResume: Location app is moving into foreground"); + base.OnResume(); + } + + protected override void OnPause() + { + Log.Debug(TAG, "OnPause: Location app is moving to background"); + base.OnPause(); + } + + protected override void OnDestroy() + { + Log.Debug(TAG, "OnDestroy: Location app is becoming inactive"); + base.OnDestroy(); + + // Stop the location service: + App.StopLocationService(); + } + + public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) + { + if (requestCode == RC_REQUEST_LOCATION_PERMISSION) + { + if (grantResults.Length == 1 && grantResults[0] == Permission.Granted) + { + Log.Debug(TAG, "User granted permission for location."); + App.StartLocationService(); + } + else + { + Log.Warn(TAG, "User did not grant permission for the location."); + } + } + else + { + base.OnRequestPermissionsResult(requestCode, permissions, grantResults); + } + } + + void RequestLocationPermission() + { + if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessFineLocation)) + { + var layout = FindViewById(Android.Resource.Id.Content); + Snackbar.Make(layout, + Resource.String.permission_location_rationale, + Snackbar.LengthIndefinite) + .SetAction(Resource.String.ok, + new Action(delegate + { + ActivityCompat.RequestPermissions(this, REQUIRED_PERMISSIONS, + RC_REQUEST_LOCATION_PERMISSION); + }) + ).Show(); + } + else + { + ActivityCompat.RequestPermissions(this, REQUIRED_PERMISSIONS, RC_REQUEST_LOCATION_PERMISSION); + } + } + + /// + /// Updates UI with location data + /// + public void HandleLocationChanged(object sender, LocationChangedEventArgs e) + { + var location = e.Location; + Log.Debug(TAG, "Foreground updating"); + + // these events are on a background thread, need to update on the UI thread + RunOnUiThread(() => + { + latText.Text = $"Latitude: {location.Latitude}"; + longText.Text = $"Longitude: {location.Longitude}"; + altText.Text = $"Altitude: {location.Altitude}"; + speedText.Text = $"Speed: {location.Speed}"; + accText.Text = $"Accuracy: {location.Accuracy}"; + bearText.Text = $"Bearing: {location.Bearing}"; + }); + } + + public void HandleProviderDisabled(object sender, ProviderDisabledEventArgs e) + { + Log.Debug(TAG, "Location provider disabled event raised"); + } + + public void HandleProviderEnabled(object sender, ProviderEnabledEventArgs e) + { + Log.Debug(TAG, "Location provider enabled event raised"); + } + + public void HandleStatusChanged(object sender, StatusChangedEventArgs e) + { + Log.Debug(TAG, "Location status changed, event raised"); + } + } } - - diff --git a/BackgroundLocationDemo/location.Android/Properties/AndroidManifest.xml b/BackgroundLocationDemo/location.Android/Properties/AndroidManifest.xml index b0bf69e53..baba745b1 100644 --- a/BackgroundLocationDemo/location.Android/Properties/AndroidManifest.xml +++ b/BackgroundLocationDemo/location.Android/Properties/AndroidManifest.xml @@ -1,8 +1,6 @@  - - - - - + + + \ No newline at end of file diff --git a/BackgroundLocationDemo/location.Android/Resources/layout/Main.axml b/BackgroundLocationDemo/location.Android/Resources/layout/Main.axml index cd2330e3e..f5435ba43 100644 --- a/BackgroundLocationDemo/location.Android/Resources/layout/Main.axml +++ b/BackgroundLocationDemo/location.Android/Resources/layout/Main.axml @@ -10,6 +10,7 @@ android:layout_height="wrap_content" android:id="@+id/textView1" /> - Hello World, Click Me! - Location.Droidd + Location.Droid + OK + This app is running in the background + This app requires access to the device location in order to work. diff --git a/BackgroundLocationDemo/location.Android/Resources/values/colours.xml b/BackgroundLocationDemo/location.Android/Resources/values/colours.xml new file mode 100644 index 000000000..95c11a1ad --- /dev/null +++ b/BackgroundLocationDemo/location.Android/Resources/values/colours.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + \ No newline at end of file diff --git a/BackgroundLocationDemo/location.Android/Resources/values/styles.xml b/BackgroundLocationDemo/location.Android/Resources/values/styles.xml new file mode 100644 index 000000000..2ecbd4b2c --- /dev/null +++ b/BackgroundLocationDemo/location.Android/Resources/values/styles.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/BackgroundLocationDemo/location.Android/Services/LocationService.cs b/BackgroundLocationDemo/location.Android/Services/LocationService.cs index 1fbdee1bc..23dc89dba 100644 --- a/BackgroundLocationDemo/location.Android/Services/LocationService.cs +++ b/BackgroundLocationDemo/location.Android/Services/LocationService.cs @@ -1,117 +1,136 @@ using System; using Android.App; -using Android.Util; using Android.Content; -using Android.OS; using Android.Locations; +using Android.OS; +using Android.Support.V4.App; +using Android.Util; namespace Location.Droid.Services { - [Service] - public class LocationService : Service, ILocationListener - { - public event EventHandler LocationChanged = delegate { }; - public event EventHandler ProviderDisabled = delegate { }; - public event EventHandler ProviderEnabled = delegate { }; - public event EventHandler StatusChanged = delegate { }; - - public LocationService() - { - } - - // Set our location manager as the system location service - protected LocationManager LocMgr = Android.App.Application.Context.GetSystemService ("location") as LocationManager; - - readonly string logTag = "LocationService"; - IBinder binder; - - public override void OnCreate () - { - base.OnCreate (); - Log.Debug (logTag, "OnCreate called in the Location Service"); - } - - // This gets called when StartService is called in our App class - public override StartCommandResult OnStartCommand (Intent intent, StartCommandFlags flags, int startId) - { - Log.Debug (logTag, "LocationService started"); - - return StartCommandResult.Sticky; - } - - // This gets called once, the first time any client bind to the Service - // and returns an instance of the LocationServiceBinder. All future clients will - // reuse the same instance of the binder - public override IBinder OnBind (Intent intent) - { - Log.Debug (logTag, "Client now bound to service"); - - binder = new LocationServiceBinder (this); - return binder; - } - - // Handle location updates from the location manager - public void StartLocationUpdates () - { - //we can set different location criteria based on requirements for our app - - //for example, we might want to preserve power, or get extreme accuracy - var locationCriteria = new Criteria(); - - locationCriteria.Accuracy = Accuracy.NoRequirement; - locationCriteria.PowerRequirement = Power.NoRequirement; - - // get provider: GPS, Network, etc. - var locationProvider = LocMgr.GetBestProvider(locationCriteria, true); - Log.Debug (logTag, string.Format ("You are about to get location updates via {0}", locationProvider)); - - // Get an initial fix on location - LocMgr.RequestLocationUpdates(locationProvider, 2000, 0, this); - - Log.Debug (logTag, "Now sending location updates"); - } - - public override void OnDestroy () - { - base.OnDestroy (); - Log.Debug (logTag, "Service has been terminated"); - } - - #region ILocationListener implementation - // ILocationListener is a way for the Service to subscribe for updates - // from the System location Service - - public void OnLocationChanged (Android.Locations.Location location) - { - this.LocationChanged (this, new LocationChangedEventArgs (location)); - - // This should be updating every time we request new location updates - // both when teh app is in the background, and in the foreground - Log.Debug (logTag, String.Format ("Latitude is {0}", location.Latitude)); - Log.Debug (logTag, String.Format ("Longitude is {0}", location.Longitude)); - Log.Debug (logTag, String.Format ("Altitude is {0}", location.Altitude)); - Log.Debug (logTag, String.Format ("Speed is {0}", location.Speed)); - Log.Debug (logTag, String.Format ("Accuracy is {0}", location.Accuracy)); - Log.Debug (logTag, String.Format ("Bearing is {0}", location.Bearing)); - } - - public void OnProviderDisabled (string provider) - { - this.ProviderDisabled (this, new ProviderDisabledEventArgs (provider)); - } - - public void OnProviderEnabled (string provider) - { - this.ProviderEnabled (this, new ProviderEnabledEventArgs (provider)); - } - - public void OnStatusChanged (string provider, Availability status, Bundle extras) - { - this.StatusChanged (this, new StatusChangedEventArgs (provider, status, extras)); - } - - #endregion - - } + [Service] + public class LocationService : Service, ILocationListener + { + const int SERVICE_RUNNING_NOTIFICATION_ID = 123; + const string NOTIFICATION_CHANNEL_ID = "com.company.app.channel"; + + readonly string logTag = "LocationService"; + IBinder binder; + + // Set our location manager as the system location service + protected LocationManager LocMgr = Application.Context.GetSystemService("location") as LocationManager; + + // ILocationListener is a way for the Service to subscribe for updates + // from the System location Service + + public void OnLocationChanged(Android.Locations.Location location) + { + LocationChanged(this, new LocationChangedEventArgs(location)); + + // This should be updating every time we request new location updates + // both when teh app is in the background, and in the foreground + Log.Debug(logTag, $"Latitude is {location.Latitude}"); + Log.Debug(logTag, $"Longitude is {location.Longitude}"); + Log.Debug(logTag, $"Altitude is {location.Altitude}"); + Log.Debug(logTag, $"Speed is {location.Speed}"); + Log.Debug(logTag, $"Accuracy is {location.Accuracy}"); + Log.Debug(logTag, $"Bearing is {location.Bearing}"); + } + + public void OnProviderDisabled(string provider) + { + ProviderDisabled(this, new ProviderDisabledEventArgs(provider)); + } + + public void OnProviderEnabled(string provider) + { + ProviderEnabled(this, new ProviderEnabledEventArgs(provider)); + } + + public void OnStatusChanged(string provider, Availability status, Bundle extras) + { + StatusChanged(this, new StatusChangedEventArgs(provider, status, extras)); + } + + public event EventHandler LocationChanged = delegate { }; + public event EventHandler ProviderDisabled = delegate { }; + public event EventHandler ProviderEnabled = delegate { }; + public event EventHandler StatusChanged = delegate { }; + + public override void OnCreate() + { + base.OnCreate(); + Log.Debug(logTag, "OnCreate called in the Location Service"); + } + + // This gets called when StartService is called in our App class + [Obsolete("deprecated in base class")] + public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) + { + Log.Debug(logTag, "LocationService started"); + + // Check if device is running Android 8.0 or higher and call StartForeground() if so + if (Build.VERSION.SdkInt >= BuildVersionCodes.O) + { + var notification = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) + .SetContentTitle(Resources.GetString(Resource.String.app_name)) + .SetContentText(Resources.GetString(Resource.String.notification_text)) + .SetSmallIcon(Resource.Drawable.notification_icon_background) + .SetOngoing(true) + .Build(); + + var notificationManager = + GetSystemService(NotificationService) as NotificationManager; + + var chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "On-going Notification", NotificationImportance.Min); + + notificationManager.CreateNotificationChannel(chan); + + StartForeground(SERVICE_RUNNING_NOTIFICATION_ID, notification); + } + + return StartCommandResult.Sticky; + } + + // This gets called once, the first time any client bind to the Service + // and returns an instance of the LocationServiceBinder. All future clients will + // reuse the same instance of the binder + public override IBinder OnBind(Intent intent) + { + Log.Debug(logTag, "Client now bound to service"); + + binder = new LocationServiceBinder(this); + return binder; + } + + // Handle location updates from the location manager + public void StartLocationUpdates() + { + //we can set different location criteria based on requirements for our app - + //for example, we might want to preserve power, or get extreme accuracy + var locationCriteria = new Criteria(); + + locationCriteria.Accuracy = Accuracy.NoRequirement; + locationCriteria.PowerRequirement = Power.NoRequirement; + + // get provider: GPS, Network, etc. + var locationProvider = LocMgr.GetBestProvider(locationCriteria, true); + Log.Debug(logTag, string.Format("You are about to get location updates via {0}", locationProvider)); + + // Get an initial fix on location + LocMgr.RequestLocationUpdates(locationProvider, 2000, 0, this); + + Log.Debug(logTag, "Now sending location updates"); + } + + public override void OnDestroy() + { + base.OnDestroy(); + Log.Debug(logTag, "Service has been terminated"); + + // Stop getting updates from the location manager: + LocMgr.RemoveUpdates(this); + } + } } - diff --git a/BackgroundLocationDemo/location.Android/Services/LocationServiceBinder.cs b/BackgroundLocationDemo/location.Android/Services/LocationServiceBinder.cs index 11aed72b3..d0ed8ce07 100644 --- a/BackgroundLocationDemo/location.Android/Services/LocationServiceBinder.cs +++ b/BackgroundLocationDemo/location.Android/Services/LocationServiceBinder.cs @@ -1,23 +1,22 @@ using System; + using Android.OS; namespace Location.Droid.Services { - //This is our Binder subclass, the LocationServiceBinder - public class LocationServiceBinder : Binder - { - public LocationService Service - { - get { return this.service; } - } protected LocationService service; + //This is our Binder subclass, the LocationServiceBinder + public class LocationServiceBinder : Binder + { + protected LocationService service; - public bool IsBound { get; set; } - - // constructor - public LocationServiceBinder (LocationService service) - { - this.service = service; - } - } -} + // constructor + public LocationServiceBinder(LocationService service) + { + this.service = service; + } + public LocationService Service => service; + + public bool IsBound { get; set; } + } +} diff --git a/BackgroundLocationDemo/location.Android/Services/LocationServiceConnection.cs b/BackgroundLocationDemo/location.Android/Services/LocationServiceConnection.cs index 06b8d1ec0..8b023830a 100644 --- a/BackgroundLocationDemo/location.Android/Services/LocationServiceConnection.cs +++ b/BackgroundLocationDemo/location.Android/Services/LocationServiceConnection.cs @@ -4,51 +4,54 @@ using Android.OS; using Android.Util; +using Object = Java.Lang.Object; + namespace Location.Droid.Services { - public class LocationServiceConnection : Java.Lang.Object, IServiceConnection - { - public event EventHandler ServiceConnected = delegate {}; - - public LocationServiceBinder Binder - { - get { return this.binder; } - set { this.binder = value; } - } - protected LocationServiceBinder binder; - - public LocationServiceConnection (LocationServiceBinder binder) - { - if (binder != null) { - this.binder = binder; - } - } - - // This gets called when a client tries to bind to the Service with an Intent and an - // instance of the ServiceConnection. The system will locate a binder associated with the - // running Service - public void OnServiceConnected (ComponentName name, IBinder service) - { - // cast the binder located by the OS as our local binder subclass - LocationServiceBinder serviceBinder = service as LocationServiceBinder; - if (serviceBinder != null) { - this.binder = serviceBinder; - this.binder.IsBound = true; - Log.Debug ( "ServiceConnection", "OnServiceConnected Called" ); - // raise the service connected event - this.ServiceConnected(this, new ServiceConnectedEventArgs () { Binder = service } ); - - // now that the Service is bound, we can start gathering some location data - serviceBinder.Service.StartLocationUpdates(); - } - } - - // This will be called when the Service unbinds, or when the app crashes - public void OnServiceDisconnected (ComponentName name) - { - this.binder.IsBound = false; - Log.Debug ( "ServiceConnection", "Service unbound" ); - } - } -} + public class LocationServiceConnection : Object, IServiceConnection + { + protected LocationServiceBinder binder; + + public LocationServiceConnection(LocationServiceBinder binder) + { + if (binder != null) + { + this.binder = binder; + } + } + + public LocationServiceBinder Binder + { + get => binder; + set => binder = value; + } + // This gets called when a client tries to bind to the Service with an Intent and an + // instance of the ServiceConnection. The system will locate a binder associated with the + // running Service + public void OnServiceConnected(ComponentName name, IBinder service) + { + // cast the binder located by the OS as our local binder subclass + if (service is LocationServiceBinder serviceBinder) + { + binder = serviceBinder; + binder.IsBound = true; + Log.Debug("ServiceConnection", "OnServiceConnected Called"); + // raise the service connected event + ServiceConnected(this, new ServiceConnectedEventArgs {Binder = service}); + + // now that the Service is bound, we can start gathering some location data + serviceBinder.Service.StartLocationUpdates(); + } + } + + // This will be called when the Service unbinds, or when the app crashes + public void OnServiceDisconnected(ComponentName name) + { + binder.IsBound = false; + Log.Debug("ServiceConnection", "Service unbound"); + } + + public event EventHandler ServiceConnected = delegate { }; + } +} diff --git a/BackgroundLocationDemo/location.Android/Services/ServiceConnectedEventArgs.cs b/BackgroundLocationDemo/location.Android/Services/ServiceConnectedEventArgs.cs index 76fe8b7dc..6ebbbdc8c 100644 --- a/BackgroundLocationDemo/location.Android/Services/ServiceConnectedEventArgs.cs +++ b/BackgroundLocationDemo/location.Android/Services/ServiceConnectedEventArgs.cs @@ -1,10 +1,11 @@ using System; + using Android.OS; namespace Location.Droid.Services { - public class ServiceConnectedEventArgs : EventArgs - { - public IBinder Binder { get; set; } - } -} \ No newline at end of file + public class ServiceConnectedEventArgs : EventArgs + { + public IBinder Binder { get; set; } + } +} diff --git a/BackgroundLocationDemo/location.iOS/Info.plist b/BackgroundLocationDemo/location.iOS/Info.plist index 4eddb7184..e3928fae5 100644 --- a/BackgroundLocationDemo/location.iOS/Info.plist +++ b/BackgroundLocationDemo/location.iOS/Info.plist @@ -21,7 +21,7 @@ UIInterfaceOrientationLandscapeRight MinimumOSVersion - 6.1 + 8.0 CFBundleIconFiles icon-57 @@ -39,5 +39,7 @@ location + CFBundleIdentifier + com.xamarin.backgroundlocation diff --git a/BackgroundLocationDemo/location.iOS/Location.iOS.csproj b/BackgroundLocationDemo/location.iOS/Location.iOS.csproj index aad5a0587..6176e03de 100644 --- a/BackgroundLocationDemo/location.iOS/Location.iOS.csproj +++ b/BackgroundLocationDemo/location.iOS/Location.iOS.csproj @@ -1,4 +1,4 @@ - + Debug @@ -25,9 +25,9 @@ False None True - - + i386 + NSUrlSessionHandler none @@ -38,6 +38,7 @@ False None i386 + NSUrlSessionHandler True @@ -50,9 +51,9 @@ False True iPhone Developer - - + ARMv7 + NSUrlSessionHandler none @@ -63,6 +64,7 @@ False iPhone Developer ARMv7, ARM64 + NSUrlSessionHandler none @@ -75,6 +77,7 @@ Automatic:AdHoc iPhone Distribution ARMv7, ARM64 + NSUrlSessionHandler none @@ -86,6 +89,7 @@ iPhone Distribution Automatic:AppStore ARMv7, ARM64 + NSUrlSessionHandler diff --git a/BackgroundLocationDemo/location.iOS/LocationManager.cs b/BackgroundLocationDemo/location.iOS/LocationManager.cs index 96551e17b..49f68e6f8 100644 --- a/BackgroundLocationDemo/location.iOS/LocationManager.cs +++ b/BackgroundLocationDemo/location.iOS/LocationManager.cs @@ -8,23 +8,33 @@ namespace Location.iOS { public class LocationManager { - + protected CLLocationManager locMgr; // event for the location changing public event EventHandler LocationUpdated = delegate { }; public LocationManager () { - this.locMgr = new CLLocationManager(); + this.locMgr = new CLLocationManager (); + + this.locMgr.PausesLocationUpdatesAutomatically = false; + + // iOS 8 has additional permissions requirements + if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { + locMgr.RequestAlwaysAuthorization (); // works in background + //locMgr.RequestWhenInUseAuthorization (); // only in foreground + } + + if (UIDevice.CurrentDevice.CheckSystemVersion (9, 0)) { + locMgr.AllowsBackgroundLocationUpdates = true; + } LocationUpdated += PrintLocation; } // create a location manager to get system location updates to the application - public CLLocationManager LocMgr - { - get { - return this.locMgr; - } - } protected CLLocationManager locMgr; + public CLLocationManager LocMgr { + get { return this.locMgr; } + } + public void StartLocationUpdates () { @@ -70,7 +80,7 @@ public void StartLocationUpdates () } //This will keep going in the background and the foreground - public void PrintLocation (object sender, LocationUpdatedEventArgs e) + public void PrintLocation (object sender, LocationUpdatedEventArgs e) { CLLocation location = e.Location; diff --git a/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPad.xib b/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPad.xib index 9c552c2c4..3898d56b1 100644 --- a/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPad.xib +++ b/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPad.xib @@ -1,593 +1,105 @@ - - - 768 - 12C3012 - 3084 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - YES - IBProxyObject - IBUILabel - IBUIView - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 292 - {{76, 57}, {66, 21}} - - - NO - YES - NO - IBIPadFramework - Latitude: - - 1 - MCAwIDAAA - darkTextColor - - - 1 - 10 - 2 - - 1 - 17 - - - Helvetica - 17 - 16 - - - - - 292 - {{308, 57}, {80, 21}} - - - NO - YES - NO - IBIPadFramework - Longitude: - - - 1 - 10 - 2 - - - - - - 292 - {{276, 86}, {112, 21}} - - - NO - YES - NO - IBIPadFramework - Course: - - - 1 - 10 - 2 - - - - - - 292 - {{80, 86}, {62, 21}} - - - NO - YES - NO - IBIPadFramework - Altitude: - - - 1 - 10 - 2 - - - - - - 292 - {{150, 57}, {150, 21}} - - - NO - YES - NO - IBIPadFramework - [lat] - - - 1 - 10 - - - - - - 292 - {{396, 57}, {150, 21}} - - - NO - YES - NO - IBIPadFramework - [lon] - - - 1 - 10 - - - - - - 292 - {{150, 86}, {150, 21}} - - - NO - YES - NO - IBIPadFramework - [alt] - - - 1 - 10 - - - - - - 292 - {{396, 86}, {150, 21}} - - - NO - YES - NO - IBIPadFramework - [course] - - - 1 - 10 - - - - - - 292 - {{30, 115}, {112, 21}} - - - NO - YES - NO - IBIPadFramework - Speed: - - - 1 - 10 - 2 - - - - - - 292 - {{150, 115}, {150, 21}} - - - NO - YES - NO - IBIPadFramework - [speed] - - - 1 - 10 - - - - - - 292 - {{20, 20}, {107, 31}} - - - NO - YES - NO - IBIPadFramework - Location: - - - 1 - 10 - - HelveticaNeue-Bold - Helvetica Neue - 2 - 24 - - - HelveticaNeue-Bold - 24 - 16 - - - - {{0, 20}, {768, 1004}} - - - - 3 - MQA - - 2 - - - - 2 - - IBIPadFramework - - - - - YES - - - view - - - - 7 - - - - lblAltitude - - - - 24 - - - - lblCourse - - - - 25 - - - - lblLatitude - - - - 26 - - - - lblLongitude - - - - 27 - - - - lblSpeed - - - - 29 - - - - - YES - - 0 - - YES - - - - - - 1 - - - YES - - - - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 8 - - - - - 9 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - 13 - - - - - 14 - - - - - 15 - - - - - 16 - - - - - 17 - - - - - 22 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 1.IBLastUsedUIStatusBarStylesToTargetRuntimesMap - 1.IBPluginDependency - 10.IBPluginDependency - 11.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 14.IBPluginDependency - 15.IBPluginDependency - 16.IBPluginDependency - 17.IBPluginDependency - 22.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - MainViewController_iPad - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - IBCocoaTouchFramework - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 34 - - - - YES - - MainViewController_iPad - UIViewController - - YES - - YES - lblAltitude - lblCourse - lblDistanceToParis - lblLatitude - lblLongitude - lblMagneticHeading - lblSpeed - lblTrueHeading - - - YES - UILabel - UILabel - UILabel - UILabel - UILabel - UILabel - UILabel - UILabel - - - - YES - - YES - lblAltitude - lblCourse - lblDistanceToParis - lblLatitude - lblLongitude - lblMagneticHeading - lblSpeed - lblTrueHeading - - - YES - - lblAltitude - UILabel - - - lblCourse - UILabel - - - lblDistanceToParis - UILabel - - - lblLatitude - UILabel - - - lblLongitude - UILabel - - - lblMagneticHeading - UILabel - - - lblSpeed - UILabel - - - lblTrueHeading - UILabel - - - - - IBProjectSource - ./Classes/MainViewController_iPad.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 2083 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPhone.xib b/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPhone.xib index bbf32b435..39eb81e1e 100644 --- a/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPhone.xib +++ b/BackgroundLocationDemo/location.iOS/MainScreen/MainViewController_iPhone.xib @@ -1,94 +1,18 @@ - - - 768 - 13F34 - 6250 - 1265.21 - 698.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 6244 - - - IBProxyObject - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - - - - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - - - MainViewController_iPhone - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 35 - - - - - UIResponder - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - - 0 - IBCocoaTouchFramework - NO - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - - + + + + + + + + + + + + + + + + + diff --git a/BluetoothLEExplorer/BluetoothLEExplorer.Droid/BluetoothLEExplorer.Droid.csproj b/BluetoothLEExplorer/BluetoothLEExplorer.Droid/BluetoothLEExplorer.Droid.csproj index d3d458da3..9778c1a89 100644 --- a/BluetoothLEExplorer/BluetoothLEExplorer.Droid/BluetoothLEExplorer.Droid.csproj +++ b/BluetoothLEExplorer/BluetoothLEExplorer.Droid/BluetoothLEExplorer.Droid.csproj @@ -17,7 +17,7 @@ False Xamarin.Robotics.BluetoothLEExplorer.Droid Properties\AndroidManifest.xml - v4.3 + v4.4 true diff --git a/BluetoothLEExplorer/BluetoothLEExplorer.Droid/Properties/AndroidManifest.xml b/BluetoothLEExplorer/BluetoothLEExplorer.Droid/Properties/AndroidManifest.xml index 670b29094..785e3d63b 100644 --- a/BluetoothLEExplorer/BluetoothLEExplorer.Droid/Properties/AndroidManifest.xml +++ b/BluetoothLEExplorer/BluetoothLEExplorer.Droid/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@  - + diff --git a/BluetoothLEExplorer/BluetoothLEExplorer.iOS/BluetoothLEExplorer.iOS.csproj b/BluetoothLEExplorer/BluetoothLEExplorer.iOS/BluetoothLEExplorer.iOS.csproj index 0f87fe7f6..9299a2782 100644 --- a/BluetoothLEExplorer/BluetoothLEExplorer.iOS/BluetoothLEExplorer.iOS.csproj +++ b/BluetoothLEExplorer/BluetoothLEExplorer.iOS/BluetoothLEExplorer.iOS.csproj @@ -27,6 +27,7 @@ true i386 BluetoothLEExploreriOS + NSUrlSessionHandler full @@ -39,6 +40,7 @@ Entitlements.plist i386 BluetoothLEExploreriOS + NSUrlSessionHandler true @@ -52,12 +54,11 @@ Entitlements.plist true iPhone Developer - - + ARMv7 - - + XamarinRoboticsBluetoothLEExploreriOS + NSUrlSessionHandler full @@ -70,6 +71,7 @@ iPhone Developer ARMv7, ARM64 XamarinRoboticsBluetoothLEExploreriOS + NSUrlSessionHandler full @@ -84,6 +86,7 @@ iPhone Distribution ARMv7, ARM64 XamarinRoboticsBluetoothLEExploreriOS + NSUrlSessionHandler full @@ -97,6 +100,7 @@ Automatic:AppStore ARMv7, ARM64 XamarinRoboticsBluetoothLEExploreriOS + NSUrlSessionHandler @@ -104,7 +108,7 @@ - ..\Components\mbprogresshud-0.9.0\lib\ios-unified\MBProgressHUD.dll + ..\packages\mbprogresshud.0.9.2.0\lib\Xamarin.iOS\MBProgressHUD.dll @@ -115,6 +119,7 @@ + @@ -180,10 +185,4 @@ - - - 0.9.0 - False - - \ No newline at end of file diff --git a/BluetoothLEExplorer/BluetoothLEExplorer.iOS/Info.plist b/BluetoothLEExplorer/BluetoothLEExplorer.iOS/Info.plist index 801d9daf2..2e39d87f6 100644 --- a/BluetoothLEExplorer/BluetoothLEExplorer.iOS/Info.plist +++ b/BluetoothLEExplorer/BluetoothLEExplorer.iOS/Info.plist @@ -15,7 +15,7 @@ UIInterfaceOrientationLandscapeRight MinimumOSVersion - 6.0 + 8.0 CFBundleIconFiles Icon diff --git a/BluetoothLEExplorer/BluetoothLEExplorer.iOS/packages.config b/BluetoothLEExplorer/BluetoothLEExplorer.iOS/packages.config new file mode 100644 index 000000000..8a7ad1010 --- /dev/null +++ b/BluetoothLEExplorer/BluetoothLEExplorer.iOS/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8.info b/BluetoothLEExplorer/Components/mbprogresshud-0.8.info deleted file mode 100644 index 31e9b1821..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8.info +++ /dev/null @@ -1 +0,0 @@ -{"Name":"Progress HUD","Id":413,"Alias":"mbprogresshud","Description":"Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog\nthat shows a progress indicator and a status label. It\u0027s the perfect\ncontrol for giving the user feedback when work is being done in a\nbackground thread.\n\nHere\u0027s an example:\n\n```csharp\nusing MBProgressHUD;\n...\n\npublic override void ViewDidLoad ()\n{\n\tbase.ViewDidLoad ();\n\n\tvar hud = new MTMBProgressHUD (View) {\n\t\tLabelText = \"Waiting...\",\n\t\tRemoveFromSuperViewOnHide = true\n\t};\n\n\tView.AddSubview (hud);\n\t\t\n\thud.Show (animated: true);\n\thud.Hide (animated: true, delay: 5);\n}\n```\n\n*Some component screenshots assembled with [PlaceIt](http://placeit.breezi.com/).*\n","Version":"0.8","Summary":"A translucent, HUD-style dialog that shows a progress indicator and a status label.","QuickStart":"Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog\nthat shows a progress indicator and a status label. It\u0027s the perfect\ncontrol for giving the user feedback when work is being done in a\nbackground thread.\n\nHere\u0027s an example:\n\n```csharp\nusing MBProgressHUD;\n...\n\npublic override void ViewDidLoad ()\n{\n\tbase.ViewDidLoad ();\n\t\n\tvar hud = new MTMBProgressHUD (View) {\n\t\tLabelText = \"Waiting...\",\n\t\tRemoveFromSuperViewOnHide = true\n\t};\n\n\tView.AddSubview (hud);\n\t\t\n\thud.Show (animated: true);\n\thud.Hide (animated: true, delay: 5);\n}\n```\n\n## Details\n\nThe main guideline you need to follow when dealing with MBProgressHUD while running long-running\ntasks is keeping the main thread work-free, so the UI can be updated promptly. This is accomplished\nby using MBProgressHUD on the main thread to show progress, while running heavy tasks on a\nbackground thread.\n","Hash":"ce432959547bc90ee2ce15b8ead273d5","TargetPlatforms":["ios"],"TrialHash":null} \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8.png deleted file mode 100644 index 8b90c637c..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/Details.md b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/Details.md deleted file mode 100644 index 06deaa684..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/Details.md +++ /dev/null @@ -1,28 +0,0 @@ -Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog -that shows a progress indicator and a status label. It's the perfect -control for giving the user feedback when work is being done in a -background thread. - -Here's an example: - -```csharp -using MBProgressHUD; -... - -public override void ViewDidLoad () -{ - base.ViewDidLoad (); - - var hud = new MTMBProgressHUD (View) { - LabelText = "Waiting...", - RemoveFromSuperViewOnHide = true - }; - - View.AddSubview (hud); - - hud.Show (animated: true); - hud.Hide (animated: true, delay: 5); -} -``` - -*Some component screenshots assembled with [PlaceIt](http://placeit.breezi.com/).* diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/GettingStarted.md b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/GettingStarted.md deleted file mode 100644 index a15cd8c83..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/GettingStarted.md +++ /dev/null @@ -1,33 +0,0 @@ -Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog -that shows a progress indicator and a status label. It's the perfect -control for giving the user feedback when work is being done in a -background thread. - -Here's an example: - -```csharp -using MBProgressHUD; -... - -public override void ViewDidLoad () -{ - base.ViewDidLoad (); - - var hud = new MTMBProgressHUD (View) { - LabelText = "Waiting...", - RemoveFromSuperViewOnHide = true - }; - - View.AddSubview (hud); - - hud.Show (animated: true); - hud.Hide (animated: true, delay: 5); -} -``` - -## Details - -The main guideline you need to follow when dealing with MBProgressHUD while running long-running -tasks is keeping the main thread work-free, so the UI can be updated promptly. This is accomplished -by using MBProgressHUD on the main thread to show progress, while running heavy tasks on a -background thread. diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/License.md b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/License.md deleted file mode 100644 index 44ad9854c..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/License.md +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2013 Jonathan George - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/Manifest.xml b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/Manifest.xml deleted file mode 100644 index dc814f813..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/Manifest.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - Progress HUD - Jonathan George - https://github.com/jdg/MBProgressHUD - 0.8 - A translucent, HUD-style dialog that shows a progress indicator and a status label. - - - - - - iOS Sample - iOS Sample - - - \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/icons/mbprogresshud_128x128.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/icons/mbprogresshud_128x128.png deleted file mode 100644 index 8b90c637c..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/icons/mbprogresshud_128x128.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/icons/mbprogresshud_512x512.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/icons/mbprogresshud_512x512.png deleted file mode 100644 index f490b0677..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/icons/mbprogresshud_512x512.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/screenshots/screenshot1.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/screenshots/screenshot1.png deleted file mode 100644 index eaad3281b..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/component/screenshots/screenshot1.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/lib/ios/MBProgressHUD.dll b/BluetoothLEExplorer/Components/mbprogresshud-0.8/lib/ios/MBProgressHUD.dll deleted file mode 100644 index 3a251d761..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/lib/ios/MBProgressHUD.dll and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo.sln b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo.sln deleted file mode 100644 index c45864901..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MBProgressHUDDemo", "MBProgressHUDDemo\MBProgressHUDDemo.csproj", "{9B7943D5-29E1-4F04-B9F5-0D640BB05D06}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - Ad-Hoc|iPhone = Ad-Hoc|iPhone - AppStore|iPhone = AppStore|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.AppStore|iPhone.Build.0 = AppStore|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhone.ActiveCfg = Debug|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhone.Build.0 = Debug|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhone.ActiveCfg = Release|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhone.Build.0 = Release|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = MBProgressHUDDemo\MBProgressHUDDemo.csproj - EndGlobalSection -EndGlobal diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/AppDelegate.cs b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/AppDelegate.cs deleted file mode 100644 index 55465affa..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/AppDelegate.cs +++ /dev/null @@ -1,420 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using MonoTouch.Foundation; -using MonoTouch.UIKit; - -using MBProgressHUD; -using MonoTouch.Dialog; - -namespace MBProgressHUDDemo -{ - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register ("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate - { - // class-level declarations - UIWindow window; - UINavigationController navController; - DialogViewController dvcDialog; - MTMBProgressHUD hud; - - // vars for managing NSUrlConnection Demo - public long expectedLength; - public long currentLength; - - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching (UIApplication app, NSDictionary options) - { - window = new UIWindow (UIScreen.MainScreen.Bounds); - - var root = new RootElement("MBProgressHUD") - { - new Section ("Samples") - { - new StringElement ("Simple indeterminate progress", ShowSimple), - new StringElement ("With label", ShowWithLabel), - new StringElement ("With details label", ShowWithDetailsLabel), - new StringElement ("Determinate mode", ShowWithLabelDeterminate), - new StringElement ("Annular determinate mode", ShowWithLabelAnnularDeterminate), - new StringElement ("Horizontal determinate mode", ShowWithLabelDeterminateHorizontalBar), - new StringElement ("Custom view", ShowWithCustomView), - new StringElement ("Mode switching", ShowWithLabelMixed), - new StringElement ("Using handlers", ShowUsingHandlers), - new StringElement ("On Window", ShowOnWindow), - new StringElement ("NSURLConnection", ShowUrl), - new StringElement ("Dim background", ShowWithGradient), - new StringElement ("Text only", ShowTextOnly), - new StringElement ("Colored", ShowWithColor), - } - }; - - - dvcDialog = new DialogViewController(UITableViewStyle.Grouped, root, false); - navController = new UINavigationController(dvcDialog); - - window.RootViewController = navController; - window.MakeKeyAndVisible (); - - return true; - } - - #region Button Actions - void ShowSimple () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector("MyTask"), this, null, true); - } - - void ShowWithLabel () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyTask"), this, null, true); - } - - void ShowWithDetailsLabel () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - hud.DetailsLabelText = "updating data"; - hud.Square = true; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyTask"), this, null, true); - } - - void ShowWithLabelDeterminate () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.Determinate; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithLabelAnnularDeterminate () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview(hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.AnnularDeterminate; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithLabelDeterminateHorizontalBar () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview(hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.DeterminateHorizontalBar; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithCustomView () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set custom view mode - hud.Mode = MBProgressHUDMode.CustomView; - - // The sample image is based on the work by http://www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ - // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Completed"; - - // Show the HUD - hud.Show(true); - - // Hide the HUD after 3 seconds - hud.Hide (true, 3); - } - - void ShowWithLabelMixed () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Connecting"; - hud.MinSize = new System.Drawing.SizeF (135f, 135f); - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyMixedTask"), this, null, true); - } - - void ShowUsingHandlers () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Add information to your HUD - hud.LabelText = "With a handler"; - - // We show the hud while executing MyTask, and then we clean up - hud.Show (true, () => { - MyTask(); - }, () => { - hud.RemoveFromSuperview(); - hud = null; - }); - } - - void ShowOnWindow () - { - // The hud will dispable all input on the window - hud = new MTMBProgressHUD (window); - this.window.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyTask"), this, null, true); - } - - void ShowUrl () - { - // Show the hud on top most view - hud = MTMBProgressHUD.ShowHUD (this.navController.View, true); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - NSUrl url = new NSUrl ("https://github.com/matej/MBProgressHUD/zipball/master"); - NSUrlRequest request = new NSUrlRequest (url); - - NSUrlConnection connection = new NSUrlConnection (request, new MyNSUrlConnectionDelegete (this, hud)); - connection.Start(); - } - - void ShowWithGradient () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set HUD to dim Background - hud.DimBackground = true; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show(new MonoTouch.ObjCRuntime.Selector ("MyTask"), this, null, true); - } - - void ShowTextOnly () - { - // Show the hud on top most view - hud = MTMBProgressHUD.ShowHUD (this.navController.View, true); - - // Configure for text only and offset down - hud.Mode = MBProgressHUDMode.Text; - hud.LabelText = "Some message..."; - hud.Margin = 10f; - hud.YOffset = 150f; - hud.RemoveFromSuperViewOnHide = true; - - hud.Hide (true, 3); - } - - void ShowWithColor () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set the hud to display with a color - hud.Color = new UIColor (0.23f, 0.5f, 0.82f, 0.90f); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show(new MonoTouch.ObjCRuntime.Selector ("MyTask"), this, null, true); - } - - #endregion - - #region fake tasks and Hide Handler - - [Export ("MyTask")] - void MyTask () - { - System.Threading.Thread.Sleep(3000); - } - - [Export ("MyProgressTask")] - void MyProgressTask () - { - float progress = 0.0f; - - while (progress < 1.0f) { - progress += 0.01f; - hud.Progress = progress; - System.Threading.Thread.Sleep(50); - } - } - - [Export ("MyMixedTask")] - void MyMixedTask () - { - // Indeterminate mode - System.Threading.Thread.Sleep(2000); - - // Switch to determinate mode - hud.Mode = MBProgressHUDMode.Determinate; - hud.LabelText = "Progress"; - float progress = 0.0f; - while (progress < 1.0f) - { - progress += 0.01f; - hud.Progress = progress; - System.Threading.Thread.Sleep(50); - } - - // Back to indeterminate mode - hud.Mode = MBProgressHUDMode.Indeterminate; - hud.LabelText = "Cleaning up"; - System.Threading.Thread.Sleep(2000); - - // The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ - // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) - // Since HUD is already on screen, we must set It's custom vien on Main Thread - BeginInvokeOnMainThread ( ()=> { - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - }); - - hud.Mode = MBProgressHUDMode.CustomView; - hud.LabelText = "Completed"; - System.Threading.Thread.Sleep (2000); - } - - void HandleDidHide (object sender, EventArgs e) - { - hud.RemoveFromSuperview(); - hud = null; - } - - #endregion - } - - // Custom NSUrlConnectionDelegate that handles NSUrlConnection Events - public class MyNSUrlConnectionDelegete : MonoTouch.Foundation.NSUrlConnectionDelegate - { - AppDelegate del; - MTMBProgressHUD hud; - - public MyNSUrlConnectionDelegete (AppDelegate del, MTMBProgressHUD hud) - { - this.del = del; - this.hud = hud; - } - - public override void ReceivedResponse (NSUrlConnection connection, NSUrlResponse response) - { - del.expectedLength = response.ExpectedContentLength; - del.currentLength = 0; - hud.Mode = MBProgressHUDMode.Determinate; - } - - public override void ReceivedData (NSUrlConnection connection, NSData data) - { - del.currentLength += data.Length; - hud.Progress = (del.currentLength / (float) del.expectedLength); - } - - public override void FinishedLoading (NSUrlConnection connection) - { - BeginInvokeOnMainThread ( ()=> { - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - }); - hud.Mode = MBProgressHUDMode.CustomView; - hud.Hide(true, 2); - } - - public override void FailedWithError (NSUrlConnection connection, NSError error) - { - hud.Hide(true); - } - } -} - diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Info.plist b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Info.plist deleted file mode 100644 index 213aa8747..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Info.plist +++ /dev/null @@ -1,21 +0,0 @@ - - - - - CFBundleIconFiles - - Icon.png - Icon@2x.png - - UIDeviceFamily - - 1 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/MBProgressHUDDemo.csproj b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/MBProgressHUDDemo.csproj deleted file mode 100644 index 654f1b8c9..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/MBProgressHUDDemo.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - - Debug - iPhoneSimulator - 10.0.0 - 2.0 - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06} - {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - MBProgressHUDDemo - Resources - MBProgressHUDDemo - - - True - full - False - bin\iPhoneSimulator\Debug - DEBUG; - prompt - 4 - False - True - True - None - - - none - True - bin\iPhoneSimulator\Release - prompt - 4 - False - None - - - True - full - False - bin\iPhone\Debug - DEBUG; - prompt - 4 - False - iPhone Developer - True - True - - - none - True - bin\iPhone\Release - prompt - 4 - False - iPhone Developer - - - none - True - bin\iPhone\Ad-Hoc - prompt - 4 - True - False - Automatic:AdHoc - iPhone Distribution - - - none - True - bin\iPhone\AppStore - prompt - 4 - False - iPhone Distribution - Automatic:AppStore - - - - - - - - - ../../../lib\/ios/MBProgressHUD.dll - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Main.cs b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Main.cs deleted file mode 100644 index 5b8ff936d..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Main.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using MonoTouch.Foundation; -using MonoTouch.UIKit; - -namespace MBProgressHUDDemo -{ - public class Application - { - // This is the main entry point of the application. - static void Main (string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main (args, null, "AppDelegate"); - } - } -} diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark.png deleted file mode 100644 index 89c31d3c2..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png deleted file mode 100644 index 5ac8c212d..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default-568h@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default-568h@2x.png deleted file mode 100644 index e9ab88709..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default-568h@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default.png deleted file mode 100644 index d744bd7ca..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default@2x.png deleted file mode 100644 index 79ad3dad0..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Default@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Icon.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Icon.png deleted file mode 100644 index 430cb6c27..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Icon.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Icon@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Icon@2x.png deleted file mode 100644 index 68d2e0bef..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.8/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Icon@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0.info b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0.info deleted file mode 100644 index 175a7bf33..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0.info +++ /dev/null @@ -1 +0,0 @@ -{"Name":"Progress HUD","Id":1111,"Alias":"mbprogresshud","Description":"Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog\nthat shows a progress indicator and a status label. It\u0027s the perfect\ncontrol for giving the user feedback when work is being done in a\nbackground thread.\n\nHere\u0027s an example:\n\n```csharp\nusing MBProgressHUD;\n...\n\npublic override void ViewDidLoad ()\n{\n\tbase.ViewDidLoad ();\n\n\tvar hud = new MTMBProgressHUD (View) {\n\t\tLabelText = \"Waiting...\",\n\t\tRemoveFromSuperViewOnHide = true\n\t};\n\n\tView.AddSubview (hud);\n\t\t\n\thud.Show (animated: true);\n\thud.Hide (animated: true, delay: 5);\n}\n```\n\n*Some component screenshots assembled with [PlaceIt](http://placeit.breezi.com/).*\n","Version":"0.9.0","Summary":"A translucent, HUD-style dialog that shows a progress indicator and a status label.","QuickStart":"Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog\nthat shows a progress indicator and a status label. It\u0027s the perfect\ncontrol for giving the user feedback when work is being done in a\nbackground thread.\n\nHere\u0027s an example:\n\n```csharp\nusing MBProgressHUD;\n...\n\npublic override void ViewDidLoad ()\n{\n\tbase.ViewDidLoad ();\n\t\n\tvar hud = new MTMBProgressHUD (View) {\n\t\tLabelText = \"Waiting...\",\n\t\tRemoveFromSuperViewOnHide = true\n\t};\n\n\tView.AddSubview (hud);\n\t\t\n\thud.Show (animated: true);\n\thud.Hide (animated: true, delay: 5);\n}\n```\n\n## Details\n\nThe main guideline you need to follow when dealing with MBProgressHUD while running long-running\ntasks is keeping the main thread work-free, so the UI can be updated promptly. This is accomplished\nby using MBProgressHUD on the main thread to show progress, while running heavy tasks on a\nbackground thread.\n","Hash":"9e8d921cad414729a5b04a1179f6fcda","TargetPlatforms":["ios"],"TrialHash":null} \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0.png deleted file mode 100644 index 8b90c637c..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/Details.md b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/Details.md deleted file mode 100644 index 06deaa684..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/Details.md +++ /dev/null @@ -1,28 +0,0 @@ -Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog -that shows a progress indicator and a status label. It's the perfect -control for giving the user feedback when work is being done in a -background thread. - -Here's an example: - -```csharp -using MBProgressHUD; -... - -public override void ViewDidLoad () -{ - base.ViewDidLoad (); - - var hud = new MTMBProgressHUD (View) { - LabelText = "Waiting...", - RemoveFromSuperViewOnHide = true - }; - - View.AddSubview (hud); - - hud.Show (animated: true); - hud.Hide (animated: true, delay: 5); -} -``` - -*Some component screenshots assembled with [PlaceIt](http://placeit.breezi.com/).* diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/GettingStarted.md b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/GettingStarted.md deleted file mode 100644 index a15cd8c83..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/GettingStarted.md +++ /dev/null @@ -1,33 +0,0 @@ -Progress HUD (a.k.a. MBProgressHUD) is a translucent, HUD-style dialog -that shows a progress indicator and a status label. It's the perfect -control for giving the user feedback when work is being done in a -background thread. - -Here's an example: - -```csharp -using MBProgressHUD; -... - -public override void ViewDidLoad () -{ - base.ViewDidLoad (); - - var hud = new MTMBProgressHUD (View) { - LabelText = "Waiting...", - RemoveFromSuperViewOnHide = true - }; - - View.AddSubview (hud); - - hud.Show (animated: true); - hud.Hide (animated: true, delay: 5); -} -``` - -## Details - -The main guideline you need to follow when dealing with MBProgressHUD while running long-running -tasks is keeping the main thread work-free, so the UI can be updated promptly. This is accomplished -by using MBProgressHUD on the main thread to show progress, while running heavy tasks on a -background thread. diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/License.md b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/License.md deleted file mode 100644 index 44ad9854c..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/License.md +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2013 Jonathan George - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/Manifest.xml b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/Manifest.xml deleted file mode 100644 index 8153d2f48..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/Manifest.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - Progress HUD - Xamarin Inc - http://xamarin.com/ - https://github.com/jdg/MBProgressHUD - 0.9.0 - A translucent, HUD-style dialog that shows a progress indicator and a status label. - - - - - - iOS Unified Sample - iOS Unified Sample - - - iOS Classic Sample - iOS Classic Sample - - - \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/icons/mbprogresshud_128x128.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/icons/mbprogresshud_128x128.png deleted file mode 100644 index 8b90c637c..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/icons/mbprogresshud_128x128.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/icons/mbprogresshud_512x512.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/icons/mbprogresshud_512x512.png deleted file mode 100644 index f490b0677..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/icons/mbprogresshud_512x512.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/screenshots/screenshot1.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/screenshots/screenshot1.png deleted file mode 100644 index eaad3281b..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/component/screenshots/screenshot1.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/lib/ios-unified/MBProgressHUD.dll b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/lib/ios-unified/MBProgressHUD.dll deleted file mode 100644 index b4546a404..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/lib/ios-unified/MBProgressHUD.dll and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/lib/ios/MBProgressHUD.dll b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/lib/ios/MBProgressHUD.dll deleted file mode 100644 index ae9e01737..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/lib/ios/MBProgressHUD.dll and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo-classic.sln b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo-classic.sln deleted file mode 100644 index e5772e134..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo-classic.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MBProgressHUDDemo-classic", "MBProgressHUDDemo\MBProgressHUDDemo-classic.csproj", "{9B7943D5-29E1-4F04-B9F5-0D640BB05D06}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhone.ActiveCfg = Debug|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhone.Build.0 = Debug|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhone.ActiveCfg = Release|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhone.Build.0 = Release|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = MBProgressHUDDemo\MBProgressHUDDemo-classic.csproj - EndGlobalSection -EndGlobal diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/AppDelegate.cs b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/AppDelegate.cs deleted file mode 100644 index c9f524abf..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/AppDelegate.cs +++ /dev/null @@ -1,428 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -#if __UNIFIED__ -using Foundation; -using UIKit; -using ObjCRuntime; -#else -using MonoTouch.Foundation; -using MonoTouch.UIKit; -using MonoTouch.ObjCRuntime; -using nuint = global::System.UInt32; -#endif - -using MBProgressHUD; -using MonoTouch.Dialog; - -namespace MBProgressHUDDemo -{ - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register ("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate - { - // class-level declarations - UIWindow window; - UINavigationController navController; - DialogViewController dvcDialog; - MTMBProgressHUD hud; - - // vars for managing NSUrlConnection Demo - public long expectedLength; - public nuint currentLength; - - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching (UIApplication app, NSDictionary options) - { - window = new UIWindow (UIScreen.MainScreen.Bounds); - - var root = new RootElement("MBProgressHUD") - { - new Section ("Samples") - { - new StringElement ("Simple indeterminate progress", ShowSimple), - new StringElement ("With label", ShowWithLabel), - new StringElement ("With details label", ShowWithDetailsLabel), - new StringElement ("Determinate mode", ShowWithLabelDeterminate), - new StringElement ("Annular determinate mode", ShowWithLabelAnnularDeterminate), - new StringElement ("Horizontal determinate mode", ShowWithLabelDeterminateHorizontalBar), - new StringElement ("Custom view", ShowWithCustomView), - new StringElement ("Mode switching", ShowWithLabelMixed), - new StringElement ("Using handlers", ShowUsingHandlers), - new StringElement ("On Window", ShowOnWindow), - new StringElement ("NSURLConnection", ShowUrl), - new StringElement ("Dim background", ShowWithGradient), - new StringElement ("Text only", ShowTextOnly), - new StringElement ("Colored", ShowWithColor), - } - }; - - - dvcDialog = new DialogViewController(UITableViewStyle.Grouped, root, false); - navController = new UINavigationController(dvcDialog); - - window.RootViewController = navController; - window.MakeKeyAndVisible (); - - return true; - } - - #region Button Actions - void ShowSimple () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector("MyTask"), this, null, true); - } - - void ShowWithLabel () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyTask"), this, null, true); - } - - void ShowWithDetailsLabel () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - hud.DetailsLabelText = "updating data"; - hud.Square = true; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyTask"), this, null, true); - } - - void ShowWithLabelDeterminate () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.Determinate; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithLabelAnnularDeterminate () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview(hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.AnnularDeterminate; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithLabelDeterminateHorizontalBar () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview(hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.DeterminateHorizontalBar; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithCustomView () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set custom view mode - hud.Mode = MBProgressHUDMode.CustomView; - - // The sample image is based on the work by http://www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ - // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Completed"; - - // Show the HUD - hud.Show(true); - - // Hide the HUD after 3 seconds - hud.Hide (true, 3); - } - - void ShowWithLabelMixed () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Connecting"; - hud.MinSize = new System.Drawing.SizeF (135f, 135f); - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyMixedTask"), this, null, true); - } - - void ShowUsingHandlers () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Add information to your HUD - hud.LabelText = "With a handler"; - - // We show the hud while executing MyTask, and then we clean up - hud.Show (true, () => { - MyTask(); - }, () => { - hud.RemoveFromSuperview(); - hud = null; - }); - } - - void ShowOnWindow () - { - // The hud will dispable all input on the window - hud = new MTMBProgressHUD (window); - this.window.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyTask"), this, null, true); - } - - void ShowUrl () - { - // Show the hud on top most view - hud = MTMBProgressHUD.ShowHUD (this.navController.View, true); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - NSUrl url = new NSUrl ("https://github.com/matej/MBProgressHUD/zipball/master"); - NSUrlRequest request = new NSUrlRequest (url); - - NSUrlConnection connection = new NSUrlConnection (request, new MyNSUrlConnectionDelegete (this, hud)); - connection.Start(); - } - - void ShowWithGradient () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set HUD to dim Background - hud.DimBackground = true; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show(new Selector ("MyTask"), this, null, true); - } - - void ShowTextOnly () - { - // Show the hud on top most view - hud = MTMBProgressHUD.ShowHUD (this.navController.View, true); - - // Configure for text only and offset down - hud.Mode = MBProgressHUDMode.Text; - hud.LabelText = "Some message..."; - hud.Margin = 10f; - hud.YOffset = 150f; - hud.RemoveFromSuperViewOnHide = true; - - hud.Hide (true, 3); - } - - void ShowWithColor () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set the hud to display with a color - hud.Color = new UIColor (0.23f, 0.5f, 0.82f, 0.90f); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show(new Selector ("MyTask"), this, null, true); - } - - #endregion - - #region fake tasks and Hide Handler - - [Export ("MyTask")] - void MyTask () - { - System.Threading.Thread.Sleep(3000); - } - - [Export ("MyProgressTask")] - void MyProgressTask () - { - float progress = 0.0f; - - while (progress < 1.0f) { - progress += 0.01f; - hud.Progress = progress; - System.Threading.Thread.Sleep(50); - } - } - - [Export ("MyMixedTask")] - void MyMixedTask () - { - // Indeterminate mode - System.Threading.Thread.Sleep(2000); - - // Switch to determinate mode - hud.Mode = MBProgressHUDMode.Determinate; - hud.LabelText = "Progress"; - float progress = 0.0f; - while (progress < 1.0f) - { - progress += 0.01f; - hud.Progress = progress; - System.Threading.Thread.Sleep(50); - } - - // Back to indeterminate mode - hud.Mode = MBProgressHUDMode.Indeterminate; - hud.LabelText = "Cleaning up"; - System.Threading.Thread.Sleep(2000); - - // The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ - // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) - // Since HUD is already on screen, we must set It's custom vien on Main Thread - BeginInvokeOnMainThread ( ()=> { - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - }); - - hud.Mode = MBProgressHUDMode.CustomView; - hud.LabelText = "Completed"; - System.Threading.Thread.Sleep (2000); - } - - void HandleDidHide (object sender, EventArgs e) - { - hud.RemoveFromSuperview(); - hud = null; - } - - #endregion - } - - // Custom NSUrlConnectionDelegate that handles NSUrlConnection Events - public class MyNSUrlConnectionDelegete : NSUrlConnectionDelegate - { - AppDelegate del; - MTMBProgressHUD hud; - - public MyNSUrlConnectionDelegete (AppDelegate del, MTMBProgressHUD hud) - { - this.del = del; - this.hud = hud; - } - - public override void ReceivedResponse (NSUrlConnection connection, NSUrlResponse response) - { - del.expectedLength = response.ExpectedContentLength; - del.currentLength = 0; - hud.Mode = MBProgressHUDMode.Determinate; - } - - public override void ReceivedData (NSUrlConnection connection, NSData data) - { - del.currentLength += data.Length; - hud.Progress = (del.currentLength / (float) del.expectedLength); - } - - public override void FinishedLoading (NSUrlConnection connection) - { - BeginInvokeOnMainThread ( ()=> { - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - }); - hud.Mode = MBProgressHUDMode.CustomView; - hud.Hide(true, 2); - } - - public override void FailedWithError (NSUrlConnection connection, NSError error) - { - hud.Hide(true); - } - } -} - diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Info.plist b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Info.plist deleted file mode 100644 index f917428fc..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - MinimumOSVersion - 7.0 - XSAppIconAssets - Resources/Images.xcassets/AppIcons.appiconset - XSLaunchImageAssets - Resources/Images.xcassets/LaunchImage.launchimage - - diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/MBProgressHUDDemo-classic.csproj b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/MBProgressHUDDemo-classic.csproj deleted file mode 100644 index 3c3c8647a..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/MBProgressHUDDemo-classic.csproj +++ /dev/null @@ -1,111 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06} - {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - MBProgressHUDDemo - Resources - MBProgressHUDDemo - - - True - full - False - bin\classic\iPhoneSimulator\Debug - obj\classic\iPhoneSimulator\Debug - DEBUG; - prompt - 4 - False - True - None - - - i386 - - - none - True - bin\classic\iPhoneSimulator\Release - obj\classic\iPhoneSimulator\Release - prompt - 4 - False - None - - - i386 - - - True - full - False - bin\classic\iPhone\Debug - obj\classic\iPhone\Debug - DEBUG; - prompt - 4 - False - iPhone Developer - True - - - ARMv7, ARMv7s - - - none - True - bin\classic\iPhone\Release - obj\classic\iPhone\Release - prompt - 4 - False - iPhone Developer - - - ARMv7, ARMv7s - - - - - - - - - ../../../lib\/ios/MBProgressHUD.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Main.cs b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Main.cs deleted file mode 100644 index 902aba186..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Main.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -#if __UNIFIED__ -using Foundation; -using UIKit; -#else -using MonoTouch.Foundation; -using MonoTouch.UIKit; -#endif - -namespace MBProgressHUDDemo -{ - public class Application - { - // This is the main entry point of the application. - static void Main (string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main (args, null, "AppDelegate"); - } - } -} diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/37x-Checkmark.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/37x-Checkmark.png deleted file mode 100644 index 89c31d3c2..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/37x-Checkmark.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png deleted file mode 100644 index 5ac8c212d..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Contents.json deleted file mode 100644 index 66ecbc8d3..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Contents.json +++ /dev/null @@ -1 +0,0 @@ -{"images":[{"idiom":"iphone","filename":"Icon.png","size":"57x57","scale":"1x"},{"idiom":"iphone","filename":"Icon@2x.png","size":"57x57","scale":"2x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon.png deleted file mode 100644 index 430cb6c27..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png deleted file mode 100644 index 68d2e0bef..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 8e0a67799..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "images": [ - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "filename": "Default.png", - "size": "320x480", - "scale": "1x" - }, - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "filename": "Default@2x.png", - "size": "320x480", - "scale": "2x" - }, - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "filename": "Default-568h@2x.png", - "size": "320x568", - "subtype": "retina4", - "scale": "2x" - }, - { - "orientation": "portrait", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Portrait~ipad.png", - "size": "768x1004", - "scale": "1x" - }, - { - "orientation": "landscape", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Landscape~ipad.png", - "size": "1024x748", - "scale": "1x" - }, - { - "orientation": "portrait", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Portrait@2x~ipad.png", - "size": "768x1004", - "scale": "2x" - }, - { - "orientation": "landscape", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Landscape@2x~ipad.png", - "size": "1024x748", - "scale": "2x" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index 3a34926de..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png deleted file mode 100644 index 083108d43..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png deleted file mode 100644 index fa60c33fc..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png deleted file mode 100644 index a918de883..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png deleted file mode 100644 index 9f687505f..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default.png deleted file mode 100644 index 4b9b9f146..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png deleted file mode 100644 index a7349599a..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo-classic/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo.sln b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo.sln deleted file mode 100644 index e19cf48aa..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MBProgressHUDDemo", "MBProgressHUDDemo\MBProgressHUDDemo.csproj", "{9B7943D5-29E1-4F04-B9F5-0D640BB05D06}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhone.ActiveCfg = Debug|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhone.Build.0 = Debug|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhone.ActiveCfg = Release|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhone.Build.0 = Release|iPhone - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = MBProgressHUDDemo\MBProgressHUDDemo.csproj - EndGlobalSection -EndGlobal diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/AppDelegate.cs b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/AppDelegate.cs deleted file mode 100644 index c9f524abf..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/AppDelegate.cs +++ /dev/null @@ -1,428 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -#if __UNIFIED__ -using Foundation; -using UIKit; -using ObjCRuntime; -#else -using MonoTouch.Foundation; -using MonoTouch.UIKit; -using MonoTouch.ObjCRuntime; -using nuint = global::System.UInt32; -#endif - -using MBProgressHUD; -using MonoTouch.Dialog; - -namespace MBProgressHUDDemo -{ - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register ("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate - { - // class-level declarations - UIWindow window; - UINavigationController navController; - DialogViewController dvcDialog; - MTMBProgressHUD hud; - - // vars for managing NSUrlConnection Demo - public long expectedLength; - public nuint currentLength; - - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching (UIApplication app, NSDictionary options) - { - window = new UIWindow (UIScreen.MainScreen.Bounds); - - var root = new RootElement("MBProgressHUD") - { - new Section ("Samples") - { - new StringElement ("Simple indeterminate progress", ShowSimple), - new StringElement ("With label", ShowWithLabel), - new StringElement ("With details label", ShowWithDetailsLabel), - new StringElement ("Determinate mode", ShowWithLabelDeterminate), - new StringElement ("Annular determinate mode", ShowWithLabelAnnularDeterminate), - new StringElement ("Horizontal determinate mode", ShowWithLabelDeterminateHorizontalBar), - new StringElement ("Custom view", ShowWithCustomView), - new StringElement ("Mode switching", ShowWithLabelMixed), - new StringElement ("Using handlers", ShowUsingHandlers), - new StringElement ("On Window", ShowOnWindow), - new StringElement ("NSURLConnection", ShowUrl), - new StringElement ("Dim background", ShowWithGradient), - new StringElement ("Text only", ShowTextOnly), - new StringElement ("Colored", ShowWithColor), - } - }; - - - dvcDialog = new DialogViewController(UITableViewStyle.Grouped, root, false); - navController = new UINavigationController(dvcDialog); - - window.RootViewController = navController; - window.MakeKeyAndVisible (); - - return true; - } - - #region Button Actions - void ShowSimple () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector("MyTask"), this, null, true); - } - - void ShowWithLabel () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyTask"), this, null, true); - } - - void ShowWithDetailsLabel () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - hud.DetailsLabelText = "updating data"; - hud.Square = true; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyTask"), this, null, true); - } - - void ShowWithLabelDeterminate () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.Determinate; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithLabelAnnularDeterminate () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview(hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.AnnularDeterminate; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithLabelDeterminateHorizontalBar () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview(hud); - - // Set determinate mode - hud.Mode = MBProgressHUDMode.DeterminateHorizontalBar; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyProgressTask"), this, null, true); - } - - void ShowWithCustomView () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set custom view mode - hud.Mode = MBProgressHUDMode.CustomView; - - // The sample image is based on the work by http://www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ - // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Completed"; - - // Show the HUD - hud.Show(true); - - // Hide the HUD after 3 seconds - hud.Hide (true, 3); - } - - void ShowWithLabelMixed () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Connecting"; - hud.MinSize = new System.Drawing.SizeF (135f, 135f); - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyMixedTask"), this, null, true); - } - - void ShowUsingHandlers () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Add information to your HUD - hud.LabelText = "With a handler"; - - // We show the hud while executing MyTask, and then we clean up - hud.Show (true, () => { - MyTask(); - }, () => { - hud.RemoveFromSuperview(); - hud = null; - }); - } - - void ShowOnWindow () - { - // The hud will dispable all input on the window - hud = new MTMBProgressHUD (window); - this.window.AddSubview (hud); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Add information to your HUD - hud.LabelText = "Loading"; - - // Show the HUD while the provided method executes in a new thread - hud.Show (new Selector ("MyTask"), this, null, true); - } - - void ShowUrl () - { - // Show the hud on top most view - hud = MTMBProgressHUD.ShowHUD (this.navController.View, true); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - NSUrl url = new NSUrl ("https://github.com/matej/MBProgressHUD/zipball/master"); - NSUrlRequest request = new NSUrlRequest (url); - - NSUrlConnection connection = new NSUrlConnection (request, new MyNSUrlConnectionDelegete (this, hud)); - connection.Start(); - } - - void ShowWithGradient () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set HUD to dim Background - hud.DimBackground = true; - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show(new Selector ("MyTask"), this, null, true); - } - - void ShowTextOnly () - { - // Show the hud on top most view - hud = MTMBProgressHUD.ShowHUD (this.navController.View, true); - - // Configure for text only and offset down - hud.Mode = MBProgressHUDMode.Text; - hud.LabelText = "Some message..."; - hud.Margin = 10f; - hud.YOffset = 150f; - hud.RemoveFromSuperViewOnHide = true; - - hud.Hide (true, 3); - } - - void ShowWithColor () - { - // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) - hud = new MTMBProgressHUD (navController.View); - navController.View.AddSubview (hud); - - // Set the hud to display with a color - hud.Color = new UIColor (0.23f, 0.5f, 0.82f, 0.90f); - - // Regiser for DidHide Event so we can remove it from the window at the right time - hud.DidHide += HandleDidHide; - - // Show the HUD while the provided method executes in a new thread - hud.Show(new Selector ("MyTask"), this, null, true); - } - - #endregion - - #region fake tasks and Hide Handler - - [Export ("MyTask")] - void MyTask () - { - System.Threading.Thread.Sleep(3000); - } - - [Export ("MyProgressTask")] - void MyProgressTask () - { - float progress = 0.0f; - - while (progress < 1.0f) { - progress += 0.01f; - hud.Progress = progress; - System.Threading.Thread.Sleep(50); - } - } - - [Export ("MyMixedTask")] - void MyMixedTask () - { - // Indeterminate mode - System.Threading.Thread.Sleep(2000); - - // Switch to determinate mode - hud.Mode = MBProgressHUDMode.Determinate; - hud.LabelText = "Progress"; - float progress = 0.0f; - while (progress < 1.0f) - { - progress += 0.01f; - hud.Progress = progress; - System.Threading.Thread.Sleep(50); - } - - // Back to indeterminate mode - hud.Mode = MBProgressHUDMode.Indeterminate; - hud.LabelText = "Cleaning up"; - System.Threading.Thread.Sleep(2000); - - // The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ - // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) - // Since HUD is already on screen, we must set It's custom vien on Main Thread - BeginInvokeOnMainThread ( ()=> { - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - }); - - hud.Mode = MBProgressHUDMode.CustomView; - hud.LabelText = "Completed"; - System.Threading.Thread.Sleep (2000); - } - - void HandleDidHide (object sender, EventArgs e) - { - hud.RemoveFromSuperview(); - hud = null; - } - - #endregion - } - - // Custom NSUrlConnectionDelegate that handles NSUrlConnection Events - public class MyNSUrlConnectionDelegete : NSUrlConnectionDelegate - { - AppDelegate del; - MTMBProgressHUD hud; - - public MyNSUrlConnectionDelegete (AppDelegate del, MTMBProgressHUD hud) - { - this.del = del; - this.hud = hud; - } - - public override void ReceivedResponse (NSUrlConnection connection, NSUrlResponse response) - { - del.expectedLength = response.ExpectedContentLength; - del.currentLength = 0; - hud.Mode = MBProgressHUDMode.Determinate; - } - - public override void ReceivedData (NSUrlConnection connection, NSData data) - { - del.currentLength += data.Length; - hud.Progress = (del.currentLength / (float) del.expectedLength); - } - - public override void FinishedLoading (NSUrlConnection connection) - { - BeginInvokeOnMainThread ( ()=> { - hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); - }); - hud.Mode = MBProgressHUDMode.CustomView; - hud.Hide(true, 2); - } - - public override void FailedWithError (NSUrlConnection connection, NSError error) - { - hud.Hide(true); - } - } -} - diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Info.plist b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Info.plist deleted file mode 100644 index f917428fc..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - MinimumOSVersion - 7.0 - XSAppIconAssets - Resources/Images.xcassets/AppIcons.appiconset - XSLaunchImageAssets - Resources/Images.xcassets/LaunchImage.launchimage - - diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/MBProgressHUDDemo.csproj b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/MBProgressHUDDemo.csproj deleted file mode 100644 index 5e0bfc888..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/MBProgressHUDDemo.csproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {9B7943D5-29E1-4F04-B9F5-0D640BB05D06} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - MBProgressHUDDemo - Resources - MBProgressHUDDemo - - - True - full - False - bin\unified\iPhoneSimulator\Debug - obj\unified\iPhoneSimulator\Debug - DEBUG;__UNIFIED__ - prompt - 4 - False - True - None - - - i386, x86_64 - - - none - True - bin\unified\iPhoneSimulator\Release - obj\unified\iPhoneSimulator\Release - __UNIFIED__ - prompt - 4 - False - None - - - i386, x86_64 - - - True - full - False - bin\unified\iPhone\Debug - obj\unified\iPhone\Debug - DEBUG;__UNIFIED__ - prompt - 4 - False - iPhone Developer - True - - - ARMv7, ARMv7s, ARM64 - - - none - True - bin\unified\iPhone\Release - obj\unified\iPhone\Release - __UNIFIED__ - prompt - 4 - False - iPhone Developer - - - ARMv7, ARMv7s, ARM64 - - - - - - - - - ../../../lib\/ios-unified/MBProgressHUD.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Main.cs b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Main.cs deleted file mode 100644 index 902aba186..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Main.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -#if __UNIFIED__ -using Foundation; -using UIKit; -#else -using MonoTouch.Foundation; -using MonoTouch.UIKit; -#endif - -namespace MBProgressHUDDemo -{ - public class Application - { - // This is the main entry point of the application. - static void Main (string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main (args, null, "AppDelegate"); - } - } -} diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark.png deleted file mode 100644 index 89c31d3c2..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png deleted file mode 100644 index 5ac8c212d..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/37x-Checkmark@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Contents.json deleted file mode 100644 index 66ecbc8d3..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Contents.json +++ /dev/null @@ -1 +0,0 @@ -{"images":[{"idiom":"iphone","filename":"Icon.png","size":"57x57","scale":"1x"},{"idiom":"iphone","filename":"Icon@2x.png","size":"57x57","scale":"2x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon.png deleted file mode 100644 index 430cb6c27..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png deleted file mode 100644 index 68d2e0bef..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 8e0a67799..000000000 --- a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "images": [ - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "filename": "Default.png", - "size": "320x480", - "scale": "1x" - }, - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "filename": "Default@2x.png", - "size": "320x480", - "scale": "2x" - }, - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "filename": "Default-568h@2x.png", - "size": "320x568", - "subtype": "retina4", - "scale": "2x" - }, - { - "orientation": "portrait", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Portrait~ipad.png", - "size": "768x1004", - "scale": "1x" - }, - { - "orientation": "landscape", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Landscape~ipad.png", - "size": "1024x748", - "scale": "1x" - }, - { - "orientation": "portrait", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Portrait@2x~ipad.png", - "size": "768x1004", - "scale": "2x" - }, - { - "orientation": "landscape", - "idiom": "ipad", - "extent": "to-status-bar", - "filename": "Default-Landscape@2x~ipad.png", - "size": "1024x748", - "scale": "2x" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} \ No newline at end of file diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index 3a34926de..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png deleted file mode 100644 index 083108d43..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png deleted file mode 100644 index fa60c33fc..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png deleted file mode 100644 index a918de883..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png deleted file mode 100644 index 9f687505f..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default.png deleted file mode 100644 index 4b9b9f146..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default.png and /dev/null differ diff --git a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png b/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png deleted file mode 100644 index a7349599a..000000000 Binary files a/BluetoothLEExplorer/Components/mbprogresshud-0.9.0/samples/MBProgressHUDDemo/MBProgressHUDDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png and /dev/null differ diff --git a/BluetoothLEExplorer/Metadata.xml b/BluetoothLEExplorer/Metadata.xml index e836f4cf0..b8558ce1c 100644 --- a/BluetoothLEExplorer/Metadata.xml +++ b/BluetoothLEExplorer/Metadata.xml @@ -6,8 +6,6 @@ Device Features Android, iOS Starter - This is a cross-platform app that lets you scan for nearby -Bluetooth Low Energy devices, connect to them, enumerate their services, and -then enumerate those service characteristics + This is a cross-platform app that demonstrates how to explore Bluetooth LE devices true diff --git a/BouncingGame/BouncingGame.sln b/BouncingGame/BouncingGame.sln new file mode 100644 index 000000000..f060f1424 --- /dev/null +++ b/BouncingGame/BouncingGame.sln @@ -0,0 +1,57 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncingGame.iOS", "BouncingGame\BouncingGame.iOS\BouncingGame.iOS.csproj", "{F573202E-DBA2-4D5C-8DB1-A8D956DB8643}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncingGame.Android", "BouncingGame\BouncingGame.Android\BouncingGame.Android.csproj", "{F86E12A1-1689-43F6-9D03-8C98DFE84E42}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncingGame.Common", "BouncingGame\BouncingGame.Common\BouncingGame.Common.csproj", "{CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Debug|iPhone.Build.0 = Debug|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Release|Any CPU.Build.0 = Release|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Release|iPhone.ActiveCfg = Release|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Release|iPhone.Build.0 = Release|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Debug|iPhone.ActiveCfg = Debug|iPhone + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Debug|iPhone.Build.0 = Debug|iPhone + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Release|Any CPU.ActiveCfg = Release|iPhone + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Release|Any CPU.Build.0 = Release|iPhone + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Release|iPhone.ActiveCfg = Release|iPhone + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Release|iPhone.Build.0 = Release|iPhone + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Debug|iPhone.Build.0 = Debug|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Release|Any CPU.Build.0 = Release|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Release|iPhone.ActiveCfg = Release|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Release|iPhone.Build.0 = Release|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {F86E12A1-1689-43F6-9D03-8C98DFE84E42}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Assets/AboutAssets.txt b/BouncingGame/BouncingGame/BouncingGame.Android/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/BouncingGame.Android.csproj b/BouncingGame/BouncingGame/BouncingGame.Android/BouncingGame.Android.csproj new file mode 100644 index 000000000..f5a7a37e0 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/BouncingGame.Android.csproj @@ -0,0 +1,97 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {F86E12A1-1689-43F6-9D03-8C98DFE84E42} + Library + BouncingGame.Android + Assets + Resources + Resource + Resources\Resource.designer.cs + True + False + BouncingGame.Android + v4.4 + Properties\AndroidManifest.xml + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\MonoGame.Framework.dll + + + + + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E} + BouncingGame.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Assets\Content\paddle.png + + + Assets\Content\ball.png + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/MainActivity.cs b/BouncingGame/BouncingGame/BouncingGame.Android/MainActivity.cs new file mode 100644 index 000000000..445db7041 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/MainActivity.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; + +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; + +using CocosSharp; + +namespace BouncingGame.Android +{ + [Activity (Label = "BouncingGame.Android", + MainLauncher = true, + Icon = "@drawable/icon", + AlwaysRetainTaskState = true, + ScreenOrientation = ScreenOrientation.Portrait, + LaunchMode = LaunchMode.SingleInstance, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)] + public class MainActivity : Activity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + // Set our view from the "main" layout resource + SetContentView (Resource.Layout.Main); + + // Get our game view from the layout resource, + // and attach the view created event to it + CCGameView gameView = (CCGameView)FindViewById (Resource.Id.GameView); + gameView.ViewCreated += LoadGame; + } + + void LoadGame (object sender, EventArgs e) + { + CCGameView gameView = sender as CCGameView; + if (gameView != null) + { + var contentSearchPaths = new List () { "Fonts", "Sounds" }; + CCSizeI viewSize = gameView.ViewSize; + + int width = 768; + int height = 1027; + + // Set world dimensions + gameView.DesignResolution = new CCSizeI (width, height); + + // Determine whether to use the high or low def versions of our images + // Make sure the default texel to content size ratio is set correctly + // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) + if (width < viewSize.Width) + { + contentSearchPaths.Add ("Images/Hd"); + CCSprite.DefaultTexelToContentSizeRatio = 2.0f; + } + else + { + contentSearchPaths.Add ("Images/Ld"); + CCSprite.DefaultTexelToContentSizeRatio = 1.0f; + } + + gameView.ContentManager.SearchPaths = contentSearchPaths; + + CCScene gameScene = new CCScene (gameView); + + gameScene.AddLayer (new GameLayer ()); + gameView.RunWithScene (gameScene); + } + + } + } +} + + diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Properties/AndroidManifest.xml b/BouncingGame/BouncingGame/BouncingGame.Android/Properties/AndroidManifest.xml new file mode 100644 index 000000000..88509c54d --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Properties/AssemblyInfo.cs b/BouncingGame/BouncingGame/BouncingGame.Android/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..258bd3647 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("BouncingGame.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("vchelaru")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/SoMA/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/AboutResources.txt similarity index 100% rename from SoMA/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to BouncingGame/BouncingGame/BouncingGame.Android/Resources/AboutResources.txt diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/Resource.designer.cs b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/Resource.designer.cs new file mode 100644 index 000000000..ec1a48e2d --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/Resource.designer.cs @@ -0,0 +1,109 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("BouncingGame.Android.Resource", IsApplication=true)] + +namespace BouncingGame.Android +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int Icon = 2130837504; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + // aapt resource value: 0x7f050000 + public const int GameView = 2131034112; + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + // aapt resource value: 0x7f030000 + public const int Main = 2130903040; + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f040000 + public const int app_name = 2130968576; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-hdpi/Icon.png b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-hdpi/Icon.png new file mode 100644 index 000000000..f4c804644 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-hdpi/Icon.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-mdpi/Icon.png b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-mdpi/Icon.png new file mode 100644 index 000000000..ef1e1ee7d Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-mdpi/Icon.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xhdpi/Icon.png b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xhdpi/Icon.png new file mode 100644 index 000000000..b7e2e57aa Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xhdpi/Icon.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xxhdpi/Icon.png b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xxhdpi/Icon.png new file mode 100644 index 000000000..8d20a38d1 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xxhdpi/Icon.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xxxhdpi/Icon.png b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xxxhdpi/Icon.png new file mode 100644 index 000000000..6d9919c41 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/drawable-xxxhdpi/Icon.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/layout/Main.axml b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/layout/Main.axml new file mode 100644 index 000000000..77959ac22 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/layout/Main.axml @@ -0,0 +1,11 @@ + + + + + diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/Resources/values/Strings.xml b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/values/Strings.xml new file mode 100644 index 000000000..f95d5bda4 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/Resources/values/Strings.xml @@ -0,0 +1,4 @@ + + + BouncingGame.Android + diff --git a/BouncingGame/BouncingGame/BouncingGame.Android/packages.config b/BouncingGame/BouncingGame/BouncingGame.Android/packages.config new file mode 100644 index 000000000..4354d62ef --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Android/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.Common/BouncingGame.Common.csproj b/BouncingGame/BouncingGame/BouncingGame.Common/BouncingGame.Common.csproj new file mode 100644 index 000000000..f92bf5974 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Common/BouncingGame.Common.csproj @@ -0,0 +1,50 @@ + + + + Debug + AnyCPU + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E} + Library + BouncingGame.Common + BouncingGame.Common + v4.5 + Profile111 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\box2d.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\MonoGame.Framework.dll + + + + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.Common/GameLayer.cs b/BouncingGame/BouncingGame/BouncingGame.Common/GameLayer.cs new file mode 100644 index 000000000..6d97066cb --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Common/GameLayer.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using CocosSharp; + +namespace BouncingGame +{ + public class GameLayer : CCLayerColor + { + CCSprite paddleSprite; + CCSprite ballSprite; + CCLabel scoreLabel; + + float ballXVelocity; + float ballYVelocity; + + // How much to modify the ball's y velocity per second: + const float gravity = 140; + + int score; + + public GameLayer () : base (CCColor4B.Black) + { + // "paddle" refers to the paddle.png image + paddleSprite = new CCSprite ("paddle"); + paddleSprite.PositionX = 100; + paddleSprite.PositionY = 100; + AddChild (paddleSprite); + + ballSprite = new CCSprite ("ball"); + ballSprite.PositionX = 320; + ballSprite.PositionY = 600; + AddChild (ballSprite); + + scoreLabel = new CCLabel ("Score: 0", "Arial", 20, CCLabelFormat.SystemFont); + scoreLabel.PositionX = 50; + scoreLabel.PositionY = 1000; + scoreLabel.AnchorPoint = CCPoint.AnchorUpperLeft; + AddChild (scoreLabel); + + Schedule (RunGameLogic); + } + + void RunGameLogic(float frameTimeInSeconds) + { + // This is a linear approximation, so not 100% accurate + ballYVelocity += frameTimeInSeconds * -gravity; + ballSprite.PositionX += ballXVelocity * frameTimeInSeconds; + ballSprite.PositionY += ballYVelocity * frameTimeInSeconds; + // New Code: + // Check if the two CCSprites overlap... + bool doesBallOverlapPaddle = ballSprite.BoundingBoxTransformedToParent.IntersectsRect( + paddleSprite.BoundingBoxTransformedToParent); + // ... and if the ball is moving downward. + bool isMovingDownward = ballYVelocity < 0; + if (doesBallOverlapPaddle && isMovingDownward) + { + // First let's invert the velocity: + ballYVelocity *= -1; + // Then let's assign a random to the ball's x velocity: + const float minXVelocity = -300; + const float maxXVelocity = 300; + ballXVelocity = CCRandom.GetRandomFloat (minXVelocity, maxXVelocity); + // New code: + score++; + scoreLabel.Text = "Score: " + score; + } + // First let’s get the ball position: + float ballRight = ballSprite.BoundingBoxTransformedToParent.MaxX; + float ballLeft = ballSprite.BoundingBoxTransformedToParent.MinX; + // Then let’s get the screen edges + float screenRight = VisibleBoundsWorldspace.MaxX; + float screenLeft = VisibleBoundsWorldspace.MinX; + + // Check if the ball is either too far to the right or left: + bool shouldReflectXVelocity = + (ballRight > screenRight && ballXVelocity > 0) || + (ballLeft < screenLeft && ballXVelocity < 0); + + if (shouldReflectXVelocity) + { + ballXVelocity *= -1; + } + } + + protected override void AddedToScene () + { + base.AddedToScene (); + + // Use the bounds to layout the positioning of our drawable assets + CCRect bounds = VisibleBoundsWorldspace; + + // Register for touch events + var touchListener = new CCEventListenerTouchAllAtOnce (); + touchListener.OnTouchesEnded = OnTouchesEnded; + touchListener.OnTouchesMoved = HandleTouchesMoved; + AddEventListener (touchListener, this); + } + + void OnTouchesEnded (List touches, CCEvent touchEvent) + { + if (touches.Count > 0) + { + // Perform touch handling here + } + } + + void HandleTouchesMoved (System.Collections.Generic.List touches, CCEvent touchEvent) + { + // we only care about the first touch: + var locationOnScreen = touches [0].Location; + paddleSprite.PositionX = locationOnScreen.X; + } + } +} diff --git a/BouncingGame/BouncingGame/BouncingGame.Common/packages.config b/BouncingGame/BouncingGame/BouncingGame.Common/packages.config new file mode 100644 index 000000000..ad4b976d2 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.Common/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/AppDelegate.cs b/BouncingGame/BouncingGame/BouncingGame.iOS/AppDelegate.cs new file mode 100644 index 000000000..4520f23a3 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/AppDelegate.cs @@ -0,0 +1,60 @@ +using Foundation; +using UIKit; + +namespace BouncingGame.iOS +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to application events from iOS. + [Register ("AppDelegate")] + public class AppDelegate : UIApplicationDelegate + { + // class-level declarations + + public override UIWindow Window + { + get; + set; + } + + public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) + { + // Override point for customization after application launch. + // If not required for your application you can safely delete this method + + return true; + } + + public override void OnResignActivation (UIApplication application) + { + // Invoked when the application is about to move from active to inactive state. + // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) + // or when the user quits the application and it begins the transition to the background state. + // Games should use this method to pause the game. + } + + public override void DidEnterBackground (UIApplication application) + { + // Use this method to release shared resources, save user data, invalidate timers and store the application state. + // If your application supports background exection this method is called instead of WillTerminate when the user quits. + } + + public override void WillEnterForeground (UIApplication application) + { + // Called as part of the transiton from background to active state. + // Here you can undo many of the changes made on entering the background. + } + + public override void OnActivated (UIApplication application) + { + // Restart any tasks that were paused (or not yet started) while the application was inactive. + // If the application was previously in the background, optionally refresh the user interface. + } + + public override void WillTerminate (UIApplication application) + { + // Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground. + } + } +} + + diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/BouncingGame.iOS.csproj b/BouncingGame/BouncingGame/BouncingGame.iOS/BouncingGame.iOS.csproj new file mode 100644 index 000000000..d7586e12e --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/BouncingGame.iOS.csproj @@ -0,0 +1,146 @@ + + + + Debug + iPhoneSimulator + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {F573202E-DBA2-4D5C-8DB1-A8D956DB8643} + Exe + BouncingGame.iOS + Resources + BouncingGame.iOS + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + false + i386, x86_64 + None + true + true + iPhone Developer + true + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + iPhone Developer + NSUrlSessionHandler + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + false + i386 + None + iPhone Developer + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + iPhone Developer + true + true + true + NSUrlSessionHandler + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\box2d.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\MonoGame.Framework.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\MonoGame.Framework.Net.dll + + + + + {CFFC49D8-33C7-4944-A9A7-A6D2AEDD7F0E} + BouncingGame.Common + + + + + + + + + + + + + + + + + + + + + + + ViewController.cs + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Content/ball.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Content/ball.png new file mode 100755 index 000000000..676636a46 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Content/ball.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Content/paddle.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Content/paddle.png new file mode 100755 index 000000000..7e01a345e Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Content/paddle.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Entitlements.plist b/BouncingGame/BouncingGame/BouncingGame.iOS/Entitlements.plist new file mode 100644 index 000000000..9ae599370 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Info.plist b/BouncingGame/BouncingGame/BouncingGame.iOS/Info.plist new file mode 100644 index 000000000..ab47d0b9a --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDisplayName + BouncingGame + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 8.0 + UIDeviceFamily + + 1 + 2 + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIMainStoryboardFile~ipad + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + + CFBundleName + BouncingGame + CFBundleIdentifier + com.xamarin.bouncinggame + XSAppIconAssets + Resources/Images.xcassets/AppIcon.appiconset + + diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Main.cs b/BouncingGame/BouncingGame/BouncingGame.iOS/Main.cs new file mode 100644 index 000000000..6f6dddef8 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Main.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace BouncingGame.iOS +{ + public class Application + { + // This is the main entry point of the application. + static void Main (string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main (args, null, "AppDelegate"); + } + } +} diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Main.storyboard b/BouncingGame/BouncingGame/BouncingGame.iOS/Main.storyboard new file mode 100644 index 000000000..d4464bb8d --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Main.storyboard @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Contents.json b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..df3f4a695 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,220 @@ +{ + "images": [ + { + "filename": "Icon40x40.png", + "size": "20x20", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon60x60.png", + "size": "20x20", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon58x58.png", + "size": "29x29", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon87x87.png", + "size": "29x29", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon80x80.png", + "size": "40x40", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon120x120.png", + "size": "40x40", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon120x120.png", + "size": "60x60", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon180x180.png", + "size": "60x60", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "Icon20x20.png", + "size": "20x20", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon40x40.png", + "size": "20x20", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon29x29.png", + "size": "29x29", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon58x58.png", + "size": "29x29", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon40x40.png", + "size": "40x40", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon80x80.png", + "size": "40x40", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon167x167.png", + "size": "83.5x83.5", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon76x76.png", + "size": "76x76", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "Icon152x152.png", + "size": "76x76", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "Icon1024x1024.png", + "size": "1024x1024", + "scale": "1x", + "idiom": "ios-marketing" + }, + { + "role": "notificationCenter", + "size": "24x24", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "notificationCenter", + "size": "27.5x27.5", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "companionSettings", + "size": "29x29", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "companionSettings", + "size": "29x29", + "scale": "3x", + "idiom": "watch" + }, + { + "role": "appLauncher", + "size": "40x40", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "longLook", + "size": "44x44", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "quickLook", + "size": "86x86", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "quickLook", + "size": "98x98", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "size": "16x16", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "16x16", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "32x32", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "32x32", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "128x128", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "128x128", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "256x256", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "256x256", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "512x512", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "512x512", + "scale": "2x", + "idiom": "mac" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon1024x1024.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon1024x1024.png new file mode 100644 index 000000000..830b23933 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon1024x1024.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon120x120.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon120x120.png new file mode 100644 index 000000000..a91bfc568 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon120x120.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon152x152.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon152x152.png new file mode 100644 index 000000000..a2882210f Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon152x152.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon167x167.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon167x167.png new file mode 100644 index 000000000..2badfaa18 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon167x167.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon180x180.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon180x180.png new file mode 100644 index 000000000..c2f79a690 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon180x180.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon20x20.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon20x20.png new file mode 100644 index 000000000..2af5ac48d Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon20x20.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon29x29.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon29x29.png new file mode 100644 index 000000000..f145292e2 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon29x29.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon40x40.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon40x40.png new file mode 100644 index 000000000..ad7e66171 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon40x40.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon58x58.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon58x58.png new file mode 100644 index 000000000..39c9c087a Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon58x58.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon60x60.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon60x60.png new file mode 100644 index 000000000..70584f903 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon60x60.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon76x76.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon76x76.png new file mode 100644 index 000000000..f8ef4696c Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon76x76.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon80x80.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon80x80.png new file mode 100644 index 000000000..cc63bbf90 Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon80x80.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon87x87.png b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon87x87.png new file mode 100644 index 000000000..ee697547a Binary files /dev/null and b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon87x87.png differ diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/Contents.json b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/Contents.json new file mode 100644 index 000000000..4caf392f9 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/LaunchScreen.xib b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/LaunchScreen.xib new file mode 100644 index 000000000..c069a9807 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/Resources/LaunchScreen.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/ViewController.cs b/BouncingGame/BouncingGame/BouncingGame.iOS/ViewController.cs new file mode 100644 index 000000000..a8508fc87 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/ViewController.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using UIKit; +using CocosSharp; + +namespace BouncingGame.iOS +{ + public partial class ViewController : UIViewController + { + public ViewController (IntPtr handle) : base (handle) + { + } + + public override void ViewDidLoad () + { + base.ViewDidLoad (); + + if (GameView != null) + { + // Set loading event to be called once game view is fully initialised + GameView.ViewCreated += LoadGame; + } + } + + public override void ViewWillDisappear (bool animated) + { + base.ViewWillDisappear (animated); + + + if (GameView != null) + GameView.Paused = true; + } + + public override void ViewDidAppear (bool animated) + { + base.ViewDidAppear (animated); + + if (GameView != null) + GameView.Paused = false; + } + + public override void DidReceiveMemoryWarning () + { + base.DidReceiveMemoryWarning (); + // Release any cached data, images, etc that aren't in use. + } + + void LoadGame (object sender, EventArgs e) + { + CCGameView gameView = sender as CCGameView; + + if (gameView != null) + { + var contentSearchPaths = new List () { "Fonts", "Sounds" }; + CCSizeI viewSize = gameView.ViewSize; + + int width = 768; + int height = 1027; + + // Set world dimensions + gameView.DesignResolution = new CCSizeI (width, height); + + // Determine whether to use the high or low def versions of our images + // Make sure the default texel to content size ratio is set correctly + // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) + if (width < viewSize.Width) + { + contentSearchPaths.Add ("Images/Hd"); + CCSprite.DefaultTexelToContentSizeRatio = 2.0f; + } + else + { + contentSearchPaths.Add ("Images/Ld"); + CCSprite.DefaultTexelToContentSizeRatio = 1.0f; + } + + gameView.ContentManager.SearchPaths = contentSearchPaths; + + CCScene gameScene = new CCScene (gameView); + gameScene.AddLayer (new GameLayer ()); + gameView.RunWithScene (gameScene); + } + } + } +} + diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/ViewController.designer.cs b/BouncingGame/BouncingGame/BouncingGame.iOS/ViewController.designer.cs new file mode 100644 index 000000000..69eea7f2a --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/ViewController.designer.cs @@ -0,0 +1,27 @@ +// WARNING +// +// This file has been generated automatically by Visual Studio from the outlets and +// actions declared in your storyboard file. +// Manual changes to this file will not be maintained. +// +using Foundation; +using System; +using System.CodeDom.Compiler; + +namespace BouncingGame.iOS +{ + [Register ("ViewController")] + partial class ViewController + { + [Outlet] + CocosSharp.CCGameView GameView { get; set; } + + void ReleaseDesignerOutlets () + { + if (GameView != null) { + GameView.Dispose (); + GameView = null; + } + } + } +} \ No newline at end of file diff --git a/BouncingGame/BouncingGame/BouncingGame.iOS/packages.config b/BouncingGame/BouncingGame/BouncingGame.iOS/packages.config new file mode 100644 index 000000000..f9d024b44 --- /dev/null +++ b/BouncingGame/BouncingGame/BouncingGame.iOS/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/BouncingGame/Metadata.xml b/BouncingGame/Metadata.xml new file mode 100644 index 000000000..d80c61eeb --- /dev/null +++ b/BouncingGame/Metadata.xml @@ -0,0 +1,9 @@ + + + 1ce06130-52a7-4541-af7f-8a1ccf4586aa + false + Beginner + Indie + Getting Started, Games + true + diff --git a/BouncingGame/README.md b/BouncingGame/README.md new file mode 100644 index 000000000..b5b307555 --- /dev/null +++ b/BouncingGame/README.md @@ -0,0 +1,13 @@ +CocosSharp BouncingGame Project for iOS and Android +==================================== + +This is a small, complete game using CocosSharp for iOS and Android. It is the result of working through the the entire Introduction to CocosSharp walkthrough. + +This game is built against CocosSharp 1.7.1.0. + +The game can be played by touching the screen to move the paddle at the bottom of the screen horizontally. The goal is to keep the ball from falling off-screen. Each bounce awards the player one point. + +Author +------ + +Victor Chelaru \ No newline at end of file diff --git a/BouncingGame/Resources/Content.zip b/BouncingGame/Resources/Content.zip new file mode 100644 index 000000000..b79e397b9 Binary files /dev/null and b/BouncingGame/Resources/Content.zip differ diff --git a/BouncingGame/Resources/Entities.zip b/BouncingGame/Resources/Entities.zip new file mode 100644 index 000000000..ca76dde33 Binary files /dev/null and b/BouncingGame/Resources/Entities.zip differ diff --git a/BouncingGame/Resources/Tiled.zip b/BouncingGame/Resources/Tiled.zip new file mode 100644 index 000000000..c26d8183b Binary files /dev/null and b/BouncingGame/Resources/Tiled.zip differ diff --git a/BouncingGame/Resources/ball.png b/BouncingGame/Resources/ball.png new file mode 100644 index 000000000..676636a46 Binary files /dev/null and b/BouncingGame/Resources/ball.png differ diff --git a/BouncingGame/Screenshots/FinalBouncingGameScreen.png b/BouncingGame/Screenshots/FinalBouncingGameScreen.png new file mode 100644 index 000000000..751c62dc3 Binary files /dev/null and b/BouncingGame/Screenshots/FinalBouncingGameScreen.png differ diff --git a/CCAction/ActionProject.sln b/CCAction/ActionProject.sln new file mode 100644 index 000000000..f594070b4 --- /dev/null +++ b/CCAction/ActionProject.sln @@ -0,0 +1,57 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionProject.iOS", "ActionProject\ActionProject.iOS\ActionProject.iOS.csproj", "{A6D1486F-3126-4F53-954E-B0BBB792AF98}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionProject.Android", "ActionProject\ActionProject.Android\ActionProject.Android.csproj", "{5529C07C-5F1E-4186-85F1-DB119F2CF6AA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionProject.Common", "ActionProject\ActionProject.Common\ActionProject.Common.csproj", "{211A2950-C246-4449-BF8E-FDE25B6D1EE8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Debug|iPhone.Build.0 = Debug|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Release|Any CPU.Build.0 = Release|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Release|iPhone.ActiveCfg = Release|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Release|iPhone.Build.0 = Release|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {211A2950-C246-4449-BF8E-FDE25B6D1EE8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Debug|iPhone.Build.0 = Debug|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Release|Any CPU.Build.0 = Release|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Release|iPhone.ActiveCfg = Release|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Release|iPhone.Build.0 = Release|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Debug|iPhone.ActiveCfg = Debug|iPhone + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Debug|iPhone.Build.0 = Debug|iPhone + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Release|Any CPU.ActiveCfg = Release|iPhone + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Release|Any CPU.Build.0 = Release|iPhone + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Release|iPhone.ActiveCfg = Release|iPhone + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Release|iPhone.Build.0 = Release|iPhone + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {A6D1486F-3126-4F53-954E-B0BBB792AF98}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + EndGlobalSection +EndGlobal diff --git a/CCAction/ActionProject/ActionProject.Android/ActionProject.Android.csproj b/CCAction/ActionProject/ActionProject.Android/ActionProject.Android.csproj new file mode 100644 index 000000000..8e1c1a4d5 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/ActionProject.Android.csproj @@ -0,0 +1,90 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {5529C07C-5F1E-4186-85F1-DB119F2CF6AA} + Library + ActionProject.Android + Assets + Resources + Resource + Resources\Resource.designer.cs + True + False + ActionProject.Android + v5.0 + Properties\AndroidManifest.xml + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\MonoAndroid10\box2d.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\MonoAndroid10\CocosSharp.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\MonoAndroid10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\MonoAndroid10\MonoGame.Framework.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\MonoAndroid10\MonoGame.Framework.Net.dll + + + + + {211A2950-C246-4449-BF8E-FDE25B6D1EE8} + ActionProject.Common + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CCAction/ActionProject/ActionProject.Android/Assets/AboutAssets.txt b/CCAction/ActionProject/ActionProject.Android/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/CCAction/ActionProject/ActionProject.Android/MainActivity.cs b/CCAction/ActionProject/ActionProject.Android/MainActivity.cs new file mode 100644 index 000000000..801c54bda --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/MainActivity.cs @@ -0,0 +1,38 @@ +using System; +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Microsoft.Xna.Framework; + +using CocosSharp; + +namespace ActionProject +{ + [Activity ( + Label = "ActionProject.Android", + AlwaysRetainTaskState = true, + Icon = "@drawable/icon", + Theme = "@android:style/Theme.NoTitleBar", + ScreenOrientation = ScreenOrientation.Landscape | ScreenOrientation.ReverseLandscape, + LaunchMode = LaunchMode.SingleInstance, + MainLauncher = true, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden) + ] + public class MainActivity : AndroidGameActivity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + var application = new CCApplication (); + application.ApplicationDelegate = new GameAppDelegate (); + SetContentView (application.AndroidContentView); + application.StartGame (); + } + } +} + + diff --git a/CCAction/ActionProject/ActionProject.Android/Properties/AndroidManifest.xml b/CCAction/ActionProject/ActionProject.Android/Properties/AndroidManifest.xml new file mode 100644 index 000000000..725ee5add --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CCAction/ActionProject/ActionProject.Android/Properties/AssemblyInfo.cs b/CCAction/ActionProject/ActionProject.Android/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d2372c94c --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("ActionProject.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("vchelaru")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/SoMA/Components/xamarin.social-1.0.1/samples/Xamarin.Social.Sample.Android/Components/xamarin.mobile-0.6.2/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/CCAction/ActionProject/ActionProject.Android/Resources/AboutResources.txt similarity index 100% rename from SoMA/Components/xamarin.social-1.0.1/samples/Xamarin.Social.Sample.Android/Components/xamarin.mobile-0.6.2/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to CCAction/ActionProject/ActionProject.Android/Resources/AboutResources.txt diff --git a/CCAction/ActionProject/ActionProject.Android/Resources/Resource.designer.cs b/CCAction/ActionProject/ActionProject.Android/Resources/Resource.designer.cs new file mode 100644 index 000000000..9d446712d --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/Resources/Resource.designer.cs @@ -0,0 +1,77 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("ActionProject.Android.Resource", IsApplication=true)] + +namespace ActionProject.Android +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int Icon = 2130837504; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f030000 + public const int app_name = 2130903040; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Camera/Components/xamarin.mobile-0.6.3/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/drawable/Icon.png b/CCAction/ActionProject/ActionProject.Android/Resources/drawable/Icon.png similarity index 100% rename from Camera/Components/xamarin.mobile-0.6.3/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/drawable/Icon.png rename to CCAction/ActionProject/ActionProject.Android/Resources/drawable/Icon.png diff --git a/CCAction/ActionProject/ActionProject.Android/Resources/values/Strings.xml b/CCAction/ActionProject/ActionProject.Android/Resources/values/Strings.xml new file mode 100644 index 000000000..58f9e7b0d --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/Resources/values/Strings.xml @@ -0,0 +1,4 @@ + + + ActionProject.Android + diff --git a/CCAction/ActionProject/ActionProject.Android/packages.config b/CCAction/ActionProject/ActionProject.Android/packages.config new file mode 100644 index 000000000..48075819d --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Android/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCAction/ActionProject/ActionProject.Common/ActionProject.Common.csproj b/CCAction/ActionProject/ActionProject.Common/ActionProject.Common.csproj new file mode 100644 index 000000000..9fffacaf0 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Common/ActionProject.Common.csproj @@ -0,0 +1,53 @@ + + + + Debug + AnyCPU + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {211A2950-C246-4449-BF8E-FDE25B6D1EE8} + Library + ActionProject.Common + ActionProject.Common + v4.5 + Profile111 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + + + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\portable-net45+win+wpa81+wp81\box2d.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\portable-net45+win+wpa81+wp81\CocosSharp.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\portable-net45+win+wpa81+wp81\MonoGame.Framework.dll + + + + + + \ No newline at end of file diff --git a/CCAction/ActionProject/ActionProject.Common/GameAppDelegate.cs b/CCAction/ActionProject/ActionProject.Common/GameAppDelegate.cs new file mode 100644 index 000000000..5cc2a659d --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Common/GameAppDelegate.cs @@ -0,0 +1,53 @@ +using CocosSharp; + +namespace ActionProject +{ + public class GameAppDelegate : CCApplicationDelegate + { + public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow) + { + application.PreferMultiSampling = false; + application.ContentRootDirectory = "Content"; + application.ContentSearchPaths.Add ("animations"); + application.ContentSearchPaths.Add ("fonts"); + application.ContentSearchPaths.Add ("sounds"); + + CCSize windowSize = mainWindow.WindowSizeInPixels; + + float desiredWidth = 1024.0f; + float desiredHeight = 768.0f; + + // This will set the world bounds to be (0,0, w, h) + // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved + CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); + + // Determine whether to use the high or low def versions of our images + // Make sure the default texel to content size ratio is set correctly + // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) + if (desiredWidth < windowSize.Width) { + application.ContentSearchPaths.Add ("images/hd"); + CCSprite.DefaultTexelToContentSizeRatio = 2.0f; + } else { + application.ContentSearchPaths.Add ("images/ld"); + CCSprite.DefaultTexelToContentSizeRatio = 1.0f; + } + + var scene = new CCScene (mainWindow); + var gameLayer = new GameLayer (); + + scene.AddChild (gameLayer); + + mainWindow.RunWithScene (scene); + } + + public override void ApplicationDidEnterBackground (CCApplication application) + { + application.Paused = true; + } + + public override void ApplicationWillEnterForeground (CCApplication application) + { + application.Paused = false; + } + } +} diff --git a/CCAction/ActionProject/ActionProject.Common/GameLayer.cs b/CCAction/ActionProject/ActionProject.Common/GameLayer.cs new file mode 100644 index 000000000..01513256f --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Common/GameLayer.cs @@ -0,0 +1,231 @@ +using System; +using System.Collections.Generic; +using CocosSharp; +using ActionProject.Common; + +namespace ActionProject +{ + public class GameLayer : CCLayer + { + readonly List VariableOptions = new List { + "Position", + "Scale", + "Rotation", + "LineWidth" + }; + readonly List EasingOptions = new List { + "", + "CCEaseBack", + "CCEaseBounce", + "CCEaseElastic", + "CCEaseExponential", + "CCEaseSine" + }; + + List OutInOptions = new List { + "Out", + "In", + "Both" + }; + + int currentVariableIndex; + int currentEasingIndex; + int currentInOutIndex; + + readonly CCNode drawNodeRoot; + readonly LineNode lineNode; + + CCLabel variableLabel; + CCLabel easingLabel; + CCLabel inOutLabel; + + const float DefaultCircleRadius = 40f; + + public GameLayer () + { + + drawNodeRoot = new CCNode { + PositionX = 500f, + PositionY = 350f + }; + + AddChild (drawNodeRoot); + + CCDrawNode circle; + circle = new CCDrawNode (); + circle.DrawSolidCircle (CCPoint.Zero, DefaultCircleRadius, CCColor4B.Red); + drawNodeRoot.AddChild (circle); + + lineNode = new LineNode (); + drawNodeRoot.AddChild (lineNode); + + variableLabel = new CCLabel ("Hello", "Arial", 46f, CCLabelFormat.SystemFont); + variableLabel.HorizontalAlignment = CCTextAlignment.Left; + variableLabel.AnchorPoint = new CCPoint (0f, 0f); + variableLabel.PositionX = 48f; + variableLabel.PositionY = 390f; + AddChild (variableLabel); + + easingLabel = new CCLabel ("Hello", "Arial", 46f, CCLabelFormat.SystemFont); + easingLabel.HorizontalAlignment = CCTextAlignment.Left; + easingLabel.AnchorPoint = new CCPoint (0f, 0f); + easingLabel.PositionX = 48f; + easingLabel.PositionY = 330f; + AddChild (easingLabel); + + inOutLabel = new CCLabel ("Hello", "Arial", 46f, CCLabelFormat.SystemFont); + inOutLabel.HorizontalAlignment = CCTextAlignment.Left; + inOutLabel.AnchorPoint = new CCPoint (0, 0); + inOutLabel.PositionX = 48f; + inOutLabel.PositionY = 270f; + AddChild (inOutLabel); + + UpdateLabels (); + } + + protected override void AddedToScene () + { + base.AddedToScene (); + + var touchListener = new CCEventListenerTouchAllAtOnce (); + touchListener.OnTouchesEnded = OnTouchesEnded; + AddEventListener (touchListener, this); + } + + void OnTouchesEnded (List touches, CCEvent touchEvent) + { + if (touches.Count > 0) { + var touch = touches [0]; + + if (easingLabel.BoundingBoxTransformedToWorld.ContainsPoint (touch.Location)) { + HandleEasingLabelTouched (); + } else if (inOutLabel.BoundingBoxTransformedToWorld.ContainsPoint (touch.Location)) { + HandleInOutLabelTouched (); + } else if (variableLabel.BoundingBoxTransformedToWorld.ContainsPoint (touch.Location)) { + HandleVariableLabelTouched (); + } else { + HandleMoveCircle (touch); + } + } + } + + void HandleVariableLabelTouched () + { + currentVariableIndex++; + currentVariableIndex = currentVariableIndex % VariableOptions.Count; + + UpdateLabels (); + } + + void HandleEasingLabelTouched () + { + currentEasingIndex++; + currentEasingIndex = currentEasingIndex % EasingOptions.Count; + + UpdateLabels (); + } + + void HandleInOutLabelTouched () + { + currentInOutIndex++; + currentInOutIndex = currentInOutIndex % OutInOptions.Count; + + UpdateLabels (); + } + + void UpdateLabels () + { + variableLabel.Text = VariableOptions [currentVariableIndex]; + easingLabel.Text = EasingOptions [currentEasingIndex]; + inOutLabel.Text = OutInOptions [currentInOutIndex]; + } + + void HandleMoveCircle (CCTouch touch) + { + const float timeToTake = 1.5f; // in seconds + CCFiniteTimeAction coreAction = null; + + // By default all actions will be added directly to the + // root node - it has values for Position, Scale, and Rotation. + CCNode nodeToAddTo = drawNodeRoot; + + switch (VariableOptions [currentVariableIndex]) { + case "Position": + coreAction = new CCMoveTo(timeToTake, touch.Location); + break; + case "Scale": + var distance = CCPoint.Distance (touch.Location, drawNodeRoot.Position); + var desiredScale = distance / DefaultCircleRadius; + coreAction = new CCScaleTo (timeToTake, desiredScale); + break; + case "Rotation": + float differenceY = touch.Location.Y - drawNodeRoot.PositionY; + float differenceX = touch.Location.X - drawNodeRoot.PositionX; + + float angleInDegrees = -1 * CCMathHelper.ToDegrees ( + (float)Math.Atan2 (differenceY, differenceX)); + + coreAction = new CCRotateTo (timeToTake, angleInDegrees); + + break; + case "LineWidth": + coreAction = new LineWidthAction (timeToTake, touch.Location.X / 40f); + // The LineWidthAction is a special action designed to work only on + // LineNode instances, so we have to set the nodeToAddTo to the lineNode: + nodeToAddTo = lineNode; + break; + } + + CCAction easing = null; + switch (EasingOptions [currentEasingIndex]) { + case "CCEaseBack": + if (currentInOutIndex == 0) + easing = new CCEaseBackOut (coreAction); + else if (currentInOutIndex == 1) + easing = new CCEaseBackIn (coreAction); + else + easing = new CCEaseBackInOut (coreAction); + + break; + case "CCEaseBounce": + if (currentInOutIndex == 0) + easing = new CCEaseBounceOut (coreAction); + else if (currentInOutIndex == 1) + easing = new CCEaseBounceIn (coreAction); + else + easing = new CCEaseBounceInOut (coreAction); + + break; + case "CCEaseElastic": + if (currentInOutIndex == 0) + easing = new CCEaseElasticOut (coreAction); + else if (currentInOutIndex == 1) + easing = new CCEaseElasticIn (coreAction); + else + easing = new CCEaseElasticInOut (coreAction); + + break; + case "CCEaseExponential": + if (currentInOutIndex == 0) + easing = new CCEaseExponentialOut (coreAction); + else if (currentInOutIndex == 1) + easing = new CCEaseExponentialIn (coreAction); + else + easing = new CCEaseExponentialInOut (coreAction); + + break; + case "CCEaseSine": + if (currentInOutIndex == 0) + easing = new CCEaseSineOut (coreAction); + else if (currentInOutIndex == 1) + easing = new CCEaseSineIn (coreAction); + else + easing = new CCEaseSineInOut (coreAction); + + break; + } + + nodeToAddTo.AddAction (easing ?? coreAction); + } + } +} diff --git a/CCAction/ActionProject/ActionProject.Common/LineNode.cs b/CCAction/ActionProject/ActionProject.Common/LineNode.cs new file mode 100644 index 000000000..fe7c4882d --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Common/LineNode.cs @@ -0,0 +1,38 @@ +using System; +using CocosSharp; + +namespace ActionProject +{ + public class LineNode : CCNode + { + readonly CCDrawNode line; + float width; + + public float Width { + get { + return width; + } + set { + width = value; + + UpdateLine (); + } + } + + public LineNode () + { + line = new CCDrawNode (); + Width = 10; + AddChild (line); + } + + void UpdateLine () + { + line.Clear (); + + var effectiveWidth = Math.Max (0, width); + line.DrawLine (CCPoint.Zero, new CCPoint (40, 0), effectiveWidth / 2, new CCColor4F (1, 1, 0, 1)); + } + } +} + diff --git a/CCAction/ActionProject/ActionProject.Common/LineWidthAction.cs b/CCAction/ActionProject/ActionProject.Common/LineWidthAction.cs new file mode 100644 index 000000000..e8eb11d10 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Common/LineWidthAction.cs @@ -0,0 +1,50 @@ +using System; +using CocosSharp; + +namespace ActionProject.Common +{ + public class LineWidthAction : CCFiniteTimeAction + { + readonly float endWidth; + + public LineWidthAction (float duration, float width) : base (duration) + { + endWidth = width; + } + + public override CCFiniteTimeAction Reverse () + { + throw new NotImplementedException (); + } + + protected override CCActionState StartAction (CCNode target) + { + return new LineWidthState (this, target, endWidth); + } + } + + public class LineWidthState : CCFiniteTimeActionState + { + readonly float deltaWidth; + readonly float startWidth; + readonly LineNode castedTarget; + + public LineWidthState (LineWidthAction action, CCNode target, float endWidth) : base (action, target) + { + castedTarget = target as LineNode; + + if (castedTarget == null) { + throw new InvalidOperationException ("The argument target must be a LineNode"); + } + + startWidth = castedTarget.Width; + deltaWidth = endWidth - startWidth; + } + + public override void Update (float time) + { + castedTarget.Width = startWidth + deltaWidth * time; + } + } +} + diff --git a/CCAction/ActionProject/ActionProject.Common/packages.config b/CCAction/ActionProject/ActionProject.Common/packages.config new file mode 100644 index 000000000..867fc5985 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.Common/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCAction/ActionProject/ActionProject.iOS/ActionProject.iOS.csproj b/CCAction/ActionProject/ActionProject.iOS/ActionProject.iOS.csproj new file mode 100644 index 000000000..8a21de076 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.iOS/ActionProject.iOS.csproj @@ -0,0 +1,106 @@ + + + + Debug + iPhoneSimulator + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {A6D1486F-3126-4F53-954E-B0BBB792AF98} + Exe + ActionProject.iOS + Resources + ActionProject.iOS + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + false + i386 + None + true + true + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + Entitlements.plist + ARMv7, ARM64 + false + iPhone Developer + NSUrlSessionHandler + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + i386 + false + None + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + iPhone Developer + true + NSUrlSessionHandler + + + + + + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\Xamarin.iOS10\box2d.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\Xamarin.iOS10\CocosSharp.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\Xamarin.iOS10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\Xamarin.iOS10\MonoGame.Framework.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.6.2.0\lib\Xamarin.iOS10\MonoGame.Framework.Net.dll + + + + + {211A2950-C246-4449-BF8E-FDE25B6D1EE8} + ActionProject.Common + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CCAction/ActionProject/ActionProject.iOS/AppDelegate.cs b/CCAction/ActionProject/ActionProject.iOS/AppDelegate.cs new file mode 100644 index 000000000..3c3efff27 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.iOS/AppDelegate.cs @@ -0,0 +1,26 @@ +using Foundation; +using UIKit; +using CocosSharp; + +namespace ActionProject +{ + [Register ("AppDelegate")] + public class AppDelegate : UIApplicationDelegate + { + public override void FinishedLaunching (UIApplication application) + { + var ccApp = new CCApplication { + ApplicationDelegate = new GameAppDelegate () + }; + + ccApp.StartGame (); + } + + static void Main (string[] args) + { + UIApplication.Main (args, null, "AppDelegate"); + } + } +} + + diff --git a/CCAction/ActionProject/ActionProject.iOS/Entitlements.plist b/CCAction/ActionProject/ActionProject.iOS/Entitlements.plist new file mode 100644 index 000000000..e9a3005f7 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.iOS/Entitlements.plist @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CCAction/ActionProject/ActionProject.iOS/Info.plist b/CCAction/ActionProject/ActionProject.iOS/Info.plist new file mode 100644 index 000000000..aecae95c2 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.iOS/Info.plist @@ -0,0 +1,37 @@ + + + + + CFBundleDisplayName + ActionProject.iOS + CFBundleIdentifier + com.your-company.ActionProject.iOS + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 7.0 + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/AnalogClock/AnalogClock.iOS/Resources/Default-568h@2x.png b/CCAction/ActionProject/ActionProject.iOS/Resources/Default-568h@2x.png similarity index 100% rename from AnalogClock/AnalogClock.iOS/Resources/Default-568h@2x.png rename to CCAction/ActionProject/ActionProject.iOS/Resources/Default-568h@2x.png diff --git a/CCAction/ActionProject/ActionProject.iOS/packages.config b/CCAction/ActionProject/ActionProject.iOS/packages.config new file mode 100644 index 000000000..5a4e71219 --- /dev/null +++ b/CCAction/ActionProject/ActionProject.iOS/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCAction/Metadata.xml b/CCAction/Metadata.xml new file mode 100644 index 000000000..65578c015 --- /dev/null +++ b/CCAction/Metadata.xml @@ -0,0 +1,11 @@ + + + e292572f-2b2b-4d78-afa3-a35b27f8151f + false + Intermediate + Games + Android, iOS + Indie + A simple project showing common and custom CCAction implementations. + true + diff --git a/CCAction/README.md b/CCAction/README.md new file mode 100644 index 000000000..70680ed33 --- /dev/null +++ b/CCAction/README.md @@ -0,0 +1,10 @@ +CCAction Demo +================ + +This solution contains an iOS and Android CocosSharp project which shows how to work with the CCAction object. It includes usage for common implementations such as CCMove as well as many easing CCAction implementations. It also includes a custom CCAction implementation for changing the visual object’s line width. + +This demo is built against CocosSharp 1.5.0.1. + +Authors +------- +Victor Chelaru \ No newline at end of file diff --git a/CCAction/Screenshots/CCActionGif.gif b/CCAction/Screenshots/CCActionGif.gif new file mode 100644 index 000000000..8490fcb25 Binary files /dev/null and b/CCAction/Screenshots/CCActionGif.gif differ diff --git a/CCAudioEngine/CCAudioEngineSample.sln b/CCAudioEngine/CCAudioEngineSample.sln new file mode 100644 index 000000000..eebdf0f56 --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCAudioEngineSample.Android", "CCAudioEngineSample\CCAudioEngineSample.Android\CCAudioEngineSample.Android.csproj", "{F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCAudioEngineSample.Common", "CCAudioEngineSample\CCAudioEngineSample.Common\CCAudioEngineSample.Common.csproj", "{3CD04199-5BFD-4860-95B7-4E685BB3B9EA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D}.Release|Any CPU.Build.0 = Release|Any CPU + {3CD04199-5BFD-4860-95B7-4E685BB3B9EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CD04199-5BFD-4860-95B7-4E685BB3B9EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CD04199-5BFD-4860-95B7-4E685BB3B9EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CD04199-5BFD-4860-95B7-4E685BB3B9EA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/AboutAssets.txt b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/ContentProject.mgcb b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/ContentProject.mgcb new file mode 100644 index 000000000..c7ae67f08 --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/ContentProject.mgcb @@ -0,0 +1,27 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:.\ +/intermediateDir:obj +/platform:Android +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + +#begin FruityFalls.mp3 +/importer:Mp3Importer +/processor:SongProcessor +/processorParam:Quality=Best +/build:FruityFalls.mp3 + +#begin Electricity.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Electricity.wav + diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/Electricity.wav b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/Electricity.wav new file mode 100644 index 000000000..3638f1d39 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/Electricity.wav differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/Electricity.xnb b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/Electricity.xnb new file mode 100644 index 000000000..0126380f0 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/Electricity.xnb differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.m4a b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.m4a new file mode 100644 index 000000000..935e39533 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.m4a differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.mp3 b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.mp3 new file mode 100644 index 000000000..152e350e6 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.mp3 differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.xnb b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.xnb new file mode 100644 index 000000000..2077cfb8e Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Assets/Content/FruityFalls.xnb differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/CCAudioEngineSample.Android.csproj b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/CCAudioEngineSample.Android.csproj new file mode 100644 index 000000000..87d5595fd --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/CCAudioEngineSample.Android.csproj @@ -0,0 +1,89 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {F1AE6514-2F0E-4285-98C9-5A1CA3D68E4D} + Library + CCAudioEngineSample.Android + True + Resources\Resource.designer.cs + Resource + Resources + Assets + True + CCAudioEngineSample.Android + v6.0 + Properties\AndroidManifest.xml + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + None + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\MonoGame.Framework.dll + + + + + {3CD04199-5BFD-4860-95B7-4E685BB3B9EA} + CCAudioEngineSample.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/MainActivity.cs b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/MainActivity.cs new file mode 100644 index 000000000..bc2fbb7d0 --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/MainActivity.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; + +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; + +using CocosSharp; + +namespace CCAudioEngineSample.Android +{ + [Activity (Label = "CCAudioEngineSample.Android", MainLauncher = true, Icon = "@drawable/icon", + AlwaysRetainTaskState = true, + LaunchMode = LaunchMode.SingleInstance, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)] + public class MainActivity : Activity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + // Set our view from the "main" layout resource + SetContentView (Resource.Layout.Main); + + // Get our game view from the layout resource, + // and attach the view created event to it + CCGameView gameView = (CCGameView)FindViewById (Resource.Id.GameView); + gameView.ViewCreated += LoadGame; + } + + void LoadGame (object sender, EventArgs e) + { + CCGameView gameView = sender as CCGameView; + + if (gameView != null) { + var contentSearchPaths = new List () { "Fonts", "Sounds" }; + CCSizeI viewSize = gameView.ViewSize; + + int height = 1024; + int width = 768; + + // Set world dimensions + gameView.DesignResolution = new CCSizeI (width, height); + + // Determine whether to use the high or low def versions of our images + // Make sure the default texel to content size ratio is set correctly + // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) + if (width < viewSize.Width) { + contentSearchPaths.Add ("Images/Hd"); + CCSprite.DefaultTexelToContentSizeRatio = 2.0f; + } else { + contentSearchPaths.Add ("Images/Ld"); + CCSprite.DefaultTexelToContentSizeRatio = 1.0f; + } + + gameView.ContentManager.SearchPaths = contentSearchPaths; + + CCScene gameScene = new CCScene (gameView); + gameScene.AddLayer (new GameLayer ()); + gameView.RunWithScene (gameScene); + } + } + } +} + + diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Properties/AndroidManifest.xml b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Properties/AndroidManifest.xml new file mode 100644 index 000000000..b62f9a2fa --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Properties/AssemblyInfo.cs b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..26f7779ba --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("CCAudioEngineSample.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("vchel")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/SoMA/Components/xamarin.social-1.0.1/samples/Xamarin.Social.Sample.iOS/Components/xamarin.mobile-0.6.2/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/AboutResources.txt similarity index 100% rename from SoMA/Components/xamarin.social-1.0.1/samples/Xamarin.Social.Sample.iOS/Components/xamarin.mobile-0.6.2/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/AboutResources.txt diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-hdpi/Icon.png b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-hdpi/Icon.png new file mode 100644 index 000000000..f4c804644 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-hdpi/Icon.png differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-mdpi/Icon.png b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-mdpi/Icon.png new file mode 100644 index 000000000..ef1e1ee7d Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-mdpi/Icon.png differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xhdpi/Icon.png b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xhdpi/Icon.png new file mode 100644 index 000000000..b7e2e57aa Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xhdpi/Icon.png differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xxhdpi/Icon.png b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xxhdpi/Icon.png new file mode 100644 index 000000000..8d20a38d1 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xxhdpi/Icon.png differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xxxhdpi/Icon.png b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xxxhdpi/Icon.png new file mode 100644 index 000000000..6d9919c41 Binary files /dev/null and b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/drawable-xxxhdpi/Icon.png differ diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/layout/Main.axml b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/layout/Main.axml new file mode 100644 index 000000000..77959ac22 --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/layout/Main.axml @@ -0,0 +1,11 @@ + + + + + diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/values/Strings.xml b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/values/Strings.xml new file mode 100644 index 000000000..207f070ad --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/Resources/values/Strings.xml @@ -0,0 +1,4 @@ + + + CCAudioEngineSample.Android + diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/packages.config b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/packages.config new file mode 100644 index 000000000..4354d62ef --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Android/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/CCAudioEngineSample.Common.csproj b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/CCAudioEngineSample.Common.csproj new file mode 100644 index 000000000..bebc15f3a --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/CCAudioEngineSample.Common.csproj @@ -0,0 +1,50 @@ + + + + Debug + AnyCPU + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {3CD04199-5BFD-4860-95B7-4E685BB3B9EA} + Library + CCAudioEngineSample.Common + CCAudioEngineSample.Common + v4.5 + Profile111 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\box2d.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\MonoGame.Framework.dll + + + + + + \ No newline at end of file diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/GameLayer.cs b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/GameLayer.cs new file mode 100644 index 000000000..b3d9b119e --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/GameLayer.cs @@ -0,0 +1,254 @@ +using System; +using System.Collections.Generic; +using CocosSharp; + +namespace CCAudioEngineSample +{ + public class GameLayer : CCLayerColor + { + CCLabel musicLabel; + CCDrawNode musicPlayButton; + + CCLabel sfxLabel; + CCDrawNode sfxPlayButton; + + CCLabel sfxVolumeLabel; + CCLabel musicVolumeLabel; + + CCDrawNode sfxVolumeUp; + CCDrawNode sfxVolumeDown; + + CCDrawNode musicVolumeUp; + CCDrawNode musicVolumeDown; + + public GameLayer () : base (new CCColor4B(20, 20, 20)) + { + // Load and instantate your assets here + + // Make any renderable node objects (e.g. sprites) children of this layer + } + + protected override void AddedToScene () + { + base.AddedToScene (); + + // Use the bounds to layout the positioning of our drawable assets + CCRect bounds = VisibleBoundsWorldspace; + + // Register for touch events + var touchListener = new CCEventListenerTouchAllAtOnce (); + touchListener.OnTouchesEnded = OnTouchesEnded; + AddEventListener (touchListener, this); + + + CreateMusicLabel(); + CreateMusicPlayButton(); + + CreateSfxLabel(); + CreateSfxPlayButton(); + + CreateMusicVolumeControls(); + CreateSfxVolumeControls(); + + } + private void CreateMusicLabel() + { + musicLabel = new CCLabel("Music", "Arial", 24, CCLabelFormat.SystemFont); + musicLabel.PositionX = 80; + musicLabel.PositionY = this.ContentSize.Height - 40; + + this.AddChild(musicLabel); + } + + private void CreateMusicPlayButton() + { + musicPlayButton = new CCDrawNode(); + + MakePlayGraphic(musicPlayButton); + + musicPlayButton.PositionX = musicLabel.PositionX + musicLabel.BoundingBox.Size.Width; + musicPlayButton.PositionY = musicLabel.PositionY - 18; + + this.AddChild(musicPlayButton); + } + + private void CreateSfxLabel() + { + sfxLabel = new CCLabel("Sound", "Arial", 24, CCLabelFormat.SystemFont); + sfxLabel.PositionX = 500; + sfxLabel.PositionY = this.ContentSize.Height - 40; + + this.AddChild(sfxLabel); + } + + + private void CreateSfxPlayButton() + { + sfxPlayButton = new CCDrawNode(); + + MakePlayGraphic(sfxPlayButton); + + sfxPlayButton.PositionX = sfxLabel.PositionX + sfxLabel.BoundingBox.Size.Width; + sfxPlayButton.PositionY = sfxLabel.PositionY - 18; + + this.AddChild(sfxPlayButton); + } + + + private void CreateMusicVolumeControls() + { + const float x = 100; + + float y = this.ContentSize.Height - 120; + + musicVolumeUp = new CCDrawNode(); + MakeUpArrowGraphic(musicVolumeUp); + musicVolumeUp.PositionX = x; + musicVolumeUp.PositionY = y; + this.AddChild(musicVolumeUp); + + y -= 30; + + musicVolumeLabel = new CCLabel("", "Arial", 24, CCLabelFormat.SystemFont); + musicVolumeLabel.HorizontalAlignment = CCTextAlignment.Center; + musicVolumeLabel.PositionX = x; + musicVolumeLabel.PositionY = y; + UpdateMusicVolumeDisplay(); + this.AddChild(musicVolumeLabel); + + y -= 60; + + musicVolumeDown = new CCDrawNode(); + MakeDownArrowGraphic(musicVolumeDown); + musicVolumeDown.PositionX = x; + musicVolumeDown.PositionY = y; + this.AddChild(musicVolumeDown); + + } + + private void CreateSfxVolumeControls() + { + const float x = 500; + + float y = this.ContentSize.Height - 120; + + sfxVolumeUp = new CCDrawNode(); + MakeUpArrowGraphic(sfxVolumeUp); + sfxVolumeUp.PositionX = x; + sfxVolumeUp.PositionY = y; + this.AddChild(sfxVolumeUp); + + y -= 30; + + sfxVolumeLabel = new CCLabel("", "Arial", 24, CCLabelFormat.SystemFont); + sfxVolumeLabel.HorizontalAlignment = CCTextAlignment.Center; + sfxVolumeLabel.PositionX = x; + sfxVolumeLabel.PositionY = y; + UpdateSfxVolumeDisplay(); + this.AddChild(sfxVolumeLabel); + + y -= 60; + + sfxVolumeDown = new CCDrawNode(); + MakeDownArrowGraphic(sfxVolumeDown); + sfxVolumeDown.PositionX = x; + sfxVolumeDown.PositionY = y; + this.AddChild(sfxVolumeDown); + } + + private void UpdateSfxVolumeDisplay() + { + this.sfxVolumeLabel.Text = $"Volume: {CCAudioEngine.SharedEngine.EffectsVolume}"; + } + + void OnTouchesEnded (List touches, CCEvent touchEvent) + { + if (touches.Count > 0) + { + var firstTouch = touches[0]; + + if(musicPlayButton.BoundingBoxTransformedToWorld.ContainsPoint(firstTouch.Location)) + { + string fileName = "FruityFalls"; + + CCAudioEngine.SharedEngine.PlayBackgroundMusic ( + fileName, loop:false); + + } + else if (sfxPlayButton.BoundingBoxTransformedToWorld.ContainsPoint(firstTouch.Location)) + { + string fileName = "Electricity"; + + CCAudioEngine.SharedEngine.PlayEffect (fileName); + } + else if(musicVolumeUp.BoundingBoxTransformedToWorld.ContainsPoint(firstTouch.Location)) + { + CCAudioEngine.SharedEngine.BackgroundMusicVolume += .25f; + UpdateMusicVolumeDisplay(); + } + else if (musicVolumeDown.BoundingBoxTransformedToWorld.ContainsPoint(firstTouch.Location)) + { + CCAudioEngine.SharedEngine.BackgroundMusicVolume -= .25f; + UpdateMusicVolumeDisplay(); + } + else if (sfxVolumeUp.BoundingBoxTransformedToWorld.ContainsPoint(firstTouch.Location)) + { + CCAudioEngine.SharedEngine.EffectsVolume += .25f; + UpdateSfxVolumeDisplay(); + } + else if (sfxVolumeDown.BoundingBoxTransformedToWorld.ContainsPoint(firstTouch.Location)) + { + CCAudioEngine.SharedEngine.EffectsVolume -= .25f; + UpdateSfxVolumeDisplay(); + } + } + } + + private void UpdateMusicVolumeDisplay() + { + this.musicVolumeLabel.Text = $"Volume: {CCAudioEngine.SharedEngine.BackgroundMusicVolume}"; + } + + public void MakePlayGraphic(CCDrawNode drawNode) + { + drawNode.Clear(); + + const float playButtonHeight = 40; + var verts = new CCPoint[] + { + new CCPoint(0,0), + new CCPoint(0, playButtonHeight), + new CCPoint(22, playButtonHeight/2.0f) + }; + + drawNode.DrawPolygon(verts, 3, CCColor4B.Green, 1, CCColor4B.White); + } + + + + void MakeUpArrowGraphic(CCDrawNode drawNode) + { + var verts = new CCPoint[] + { + new CCPoint(0,0), + new CCPoint(20, 22), + new CCPoint(40, 0) + }; + + drawNode.DrawPolygon(verts, 3, CCColor4B.Gray, 1, CCColor4B.White); + + } + + void MakeDownArrowGraphic(CCDrawNode drawNode) + { + var verts = new CCPoint[] + { + new CCPoint(0,22), + new CCPoint(20, 0), + new CCPoint(40, 22) + }; + + drawNode.DrawPolygon(verts, 3, CCColor4B.Gray, 1, CCColor4B.White); + } + } +} diff --git a/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/packages.config b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/packages.config new file mode 100644 index 000000000..6379e9b28 --- /dev/null +++ b/CCAudioEngine/CCAudioEngineSample/CCAudioEngineSample.Common/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCAudioEngine/Metadata.xml b/CCAudioEngine/Metadata.xml new file mode 100644 index 000000000..d95a60459 --- /dev/null +++ b/CCAudioEngine/Metadata.xml @@ -0,0 +1,11 @@ + + + a96b00b2-7870-470f-9429-8e3f28f3b527 + false + Intermediate + Games + Android + Indie + A project demonstrating the CCAudioEngine class. + true + diff --git a/CCAudioEngine/README.md b/CCAudioEngine/README.md new file mode 100644 index 000000000..732443b5b --- /dev/null +++ b/CCAudioEngine/README.md @@ -0,0 +1,10 @@ +CCAudioEngine Example Project +================ + +This solution contains an Android CocosSharp project which shows how to work with the CCAudioEngine object. It displays UI for playing music, sound, and adjusting volume. + +This demo is built using CocosSharp 1.7.1. + +Authors +------- +Victor Chelaru \ No newline at end of file diff --git a/CCAudioEngine/Screenshots/Screen1.png b/CCAudioEngine/Screenshots/Screen1.png new file mode 100644 index 000000000..48d63381a Binary files /dev/null and b/CCAudioEngine/Screenshots/Screen1.png differ diff --git a/CCDrawNode/CustomRendering.sln b/CCDrawNode/CustomRendering.sln new file mode 100644 index 000000000..fb8739cec --- /dev/null +++ b/CCDrawNode/CustomRendering.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomRendering.Android", "CustomRendering\CustomRendering.Android\CustomRendering.Android.csproj", "{5B451C57-6D3C-4541-94BA-1D6E0182AB3A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomRendering.Common", "CustomRendering\CustomRendering.Common\CustomRendering.Common.csproj", "{A3421C76-5664-47E6-AB2E-CC0D25A19E94}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B451C57-6D3C-4541-94BA-1D6E0182AB3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B451C57-6D3C-4541-94BA-1D6E0182AB3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B451C57-6D3C-4541-94BA-1D6E0182AB3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B451C57-6D3C-4541-94BA-1D6E0182AB3A}.Release|Any CPU.Build.0 = Release|Any CPU + {A3421C76-5664-47E6-AB2E-CC0D25A19E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3421C76-5664-47E6-AB2E-CC0D25A19E94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3421C76-5664-47E6-AB2E-CC0D25A19E94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3421C76-5664-47E6-AB2E-CC0D25A19E94}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/Assets/AboutAssets.txt b/CCDrawNode/CustomRendering/CustomRendering.Android/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/CustomRendering.Android.csproj b/CCDrawNode/CustomRendering/CustomRendering.Android/CustomRendering.Android.csproj new file mode 100644 index 000000000..a87a2141f --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/CustomRendering.Android.csproj @@ -0,0 +1,87 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {5B451C57-6D3C-4541-94BA-1D6E0182AB3A} + Library + CustomRendering.Android + True + Resources\Resource.designer.cs + Resource + Resources + Assets + False + CustomRendering.Android + v5.0 + Properties\AndroidManifest.xml + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + None + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\MonoAndroid10\box2d.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\MonoAndroid10\CocosSharp.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\MonoAndroid10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\MonoAndroid10\MonoGame.Framework.dll + + + + + {A3421C76-5664-47E6-AB2E-CC0D25A19E94} + CustomRendering.Common + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/MainActivity.cs b/CCDrawNode/CustomRendering/CustomRendering.Android/MainActivity.cs new file mode 100644 index 000000000..51dd3fa66 --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/MainActivity.cs @@ -0,0 +1,38 @@ +using System; +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Microsoft.Xna.Framework; + +using CocosSharp; + +namespace CustomRendering +{ + [Activity ( + Label = "CustomRendering.Android", + AlwaysRetainTaskState = true, + Icon = "@drawable/icon", + Theme = "@android:style/Theme.NoTitleBar", + ScreenOrientation = ScreenOrientation.Landscape | ScreenOrientation.ReverseLandscape, + LaunchMode = LaunchMode.SingleInstance, + MainLauncher = true, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden) + ] + public class MainActivity : AndroidGameActivity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + var application = new CCApplication (); + application.ApplicationDelegate = new GameAppDelegate (); + SetContentView (application.AndroidContentView); + application.StartGame (); + } + } +} + + diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/Properties/AndroidManifest.xml b/CCDrawNode/CustomRendering/CustomRendering.Android/Properties/AndroidManifest.xml new file mode 100644 index 000000000..cf6b6de32 --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/Properties/AssemblyInfo.cs b/CCDrawNode/CustomRendering/CustomRendering.Android/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..7ee1ae449 --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("CustomRendering.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("Victor")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/SoMA/iOS/Components/xamarin.mobile-0.6.2.1/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/AboutResources.txt similarity index 100% rename from SoMA/iOS/Components/xamarin.mobile-0.6.2.1/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to CCDrawNode/CustomRendering/CustomRendering.Android/Resources/AboutResources.txt diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/Resource.designer.cs b/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/Resource.designer.cs new file mode 100644 index 000000000..65b9ae6ae --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/Resource.designer.cs @@ -0,0 +1,77 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("CustomRendering.Android.Resource", IsApplication=true)] + +namespace CustomRendering.Android +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int Icon = 2130837504; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f030000 + public const int app_name = 2130903040; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Camera/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/drawable/Icon.png b/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/drawable/Icon.png similarity index 100% rename from Camera/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/drawable/Icon.png rename to CCDrawNode/CustomRendering/CustomRendering.Android/Resources/drawable/Icon.png diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/values/Strings.xml b/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/values/Strings.xml new file mode 100644 index 000000000..601066c84 --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/Resources/values/Strings.xml @@ -0,0 +1,4 @@ + + + CustomRendering.Android + diff --git a/CCDrawNode/CustomRendering/CustomRendering.Android/packages.config b/CCDrawNode/CustomRendering/CustomRendering.Android/packages.config new file mode 100644 index 000000000..dd8f57bbb --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Android/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCDrawNode/CustomRendering/CustomRendering.Common/CustomRendering.Common.csproj b/CCDrawNode/CustomRendering/CustomRendering.Common/CustomRendering.Common.csproj new file mode 100644 index 000000000..b45cb8d2c --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Common/CustomRendering.Common.csproj @@ -0,0 +1,51 @@ + + + + Debug + AnyCPU + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {A3421C76-5664-47E6-AB2E-CC0D25A19E94} + Library + CustomRendering.Common + CustomRendering.Common + v4.5 + Profile78 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\portable-net45+win+wpa81+wp80\box2d.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\portable-net45+win+wpa81+wp80\CocosSharp.dll + + + ..\..\packages\CocosSharp.PCL.Shared.1.5.0.1\lib\portable-net45+win+wpa81+wp80\MonoGame.Framework.dll + + + + + + \ No newline at end of file diff --git a/CCDrawNode/CustomRendering/CustomRendering.Common/GameAppDelegate.cs b/CCDrawNode/CustomRendering/CustomRendering.Common/GameAppDelegate.cs new file mode 100644 index 000000000..d1a21ff3e --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Common/GameAppDelegate.cs @@ -0,0 +1,58 @@ +using System; +using CocosSharp; + + +namespace CustomRendering +{ + public class GameAppDelegate : CCApplicationDelegate + { + public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow) + { + application.PreferMultiSampling = false; + application.ContentRootDirectory = "Content"; + application.ContentSearchPaths.Add ("animations"); + application.ContentSearchPaths.Add ("fonts"); + application.ContentSearchPaths.Add ("sounds"); + + CCSize windowSize = mainWindow.WindowSizeInPixels; + + float desiredWidth = 1024.0f; + float desiredHeight = 768.0f; + + // This will set the world bounds to be (0,0, w, h) + // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved + CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); + + // Determine whether to use the high or low def versions of our images + // Make sure the default texel to content size ratio is set correctly + // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) + if (desiredWidth < windowSize.Width) + { + application.ContentSearchPaths.Add ("images/hd"); + CCSprite.DefaultTexelToContentSizeRatio = 2.0f; + } + else + { + application.ContentSearchPaths.Add ("images/ld"); + CCSprite.DefaultTexelToContentSizeRatio = 1.0f; + } + + CCScene scene = new CCScene (mainWindow); + GameLayer gameLayer = new GameLayer (); + + scene.AddChild (gameLayer); + + mainWindow.RunWithScene (scene); + } + + public override void ApplicationDidEnterBackground (CCApplication application) + { + application.Paused = true; + } + + public override void ApplicationWillEnterForeground (CCApplication application) + { + application.Paused = false; + } + } +} diff --git a/CCDrawNode/CustomRendering/CustomRendering.Common/GameLayer.cs b/CCDrawNode/CustomRendering/CustomRendering.Common/GameLayer.cs new file mode 100644 index 000000000..50cf390d2 --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Common/GameLayer.cs @@ -0,0 +1,220 @@ +using System; +using System.Collections.Generic; +using CocosSharp; + +namespace CustomRendering +{ + public class GameLayer : CCLayer + { + CCDrawNode drawNode; + + public GameLayer () + { + drawNode = new CCDrawNode (); + this.AddChild (drawNode); + + drawNode.PositionX = 100; + drawNode.PositionY = 100; + + // Uncomment one of the following to see + // an example of a given Draw call: + + CardinalSpline (); + +// CatmullRom (); + +// Circle (); + +// CubicBezier (); + +// Ellipse (); + +// Line (); + +// LineList (); + +// Polygon (); + +// QuadBezier (); + +// Rect (); + +// Segment (); + +// SolidArc (); + +// SolidCircle (); + +// TriangleList (); + } + + + + + void CardinalSpline () + { + var splinePoints = new List (); + splinePoints.Add (new CCPoint (0, 0)); + splinePoints.Add (new CCPoint (50, 70)); + splinePoints.Add (new CCPoint (0, 140)); + splinePoints.Add (new CCPoint (100, 210)); + drawNode.DrawCardinalSpline ( + config: splinePoints, + tension: 0, + segments: 64, + color: CCColor4B.Red); + } + + void CatmullRom () + { + var splinePoints = new List (); + splinePoints.Add (new CCPoint (0, 0)); + splinePoints.Add (new CCPoint (80, 90)); + splinePoints.Add (new CCPoint (100, 0)); + splinePoints.Add (new CCPoint (0, 130)); + + drawNode.DrawCatmullRom ( + points: splinePoints, + segments: 64, + color: CCColor4B.Green); + + } + + void Circle () + { + drawNode.DrawCircle ( + center: new CCPoint (0, 0), + radius: 20, + color: CCColor4B.Yellow); + } + + void CubicBezier () + { +// fantastic vid: +// https://vimeo.com/106757336 + drawNode.DrawCubicBezier ( + origin: new CCPoint (0, 0), + control1: new CCPoint (50, 150), + control2: new CCPoint (250, 150), + destination: new CCPoint (170, 0), + segments: 64, + lineWidth: 1, + color: CCColor4B.Green); + } + + void Ellipse () + { + drawNode.DrawEllipse ( + rect: new CCRect (0, 0, 130, 90), + lineWidth: 2, + color: CCColor4B.Gray); + } + + void Line () + { + drawNode.DrawLine ( + from: new CCPoint (0, 0), + to: new CCPoint (150, 30), + lineWidth: 5, + color: CCColor4B.Orange); + } + + void LineList () + { + CCV3F_C4B[] verts = new CCV3F_C4B[] { + // First line: + new CCV3F_C4B (new CCPoint (0, 0), CCColor4B.White), + new CCV3F_C4B (new CCPoint (30, 60), CCColor4B.White), + // second line, will blend from white to red: + new CCV3F_C4B (new CCPoint (60, 0), CCColor4B.White), + new CCV3F_C4B (new CCPoint (120, 120), CCColor4B.Red) + }; + + drawNode.DrawLineList (verts); + } + + void Polygon () + { + CCPoint[] verts = new CCPoint[] { + new CCPoint (0, 0), + new CCPoint (0, 100), + new CCPoint (50, 150), + new CCPoint (100, 100), + new CCPoint (100, 0) + }; + + drawNode.DrawPolygon (verts, + count: verts.Length, + fillColor: CCColor4B.White, + borderWidth: 5, + borderColor: CCColor4B.Red, + closePolygon: true); + + } + + void QuadBezier () + { + drawNode.DrawQuadBezier ( + origin: new CCPoint (0, 0), + control: new CCPoint (200, 0), + destination: new CCPoint (0, 300), + segments: 64, + lineWidth: 1, + color: CCColor4B.White); + } + + void Rect () + { + var shape = new CCRect ( + 0, 0, 100, 200); + drawNode.DrawRect (shape, + fillColor: CCColor4B.Blue, + borderWidth: 4, + borderColor: CCColor4B.White); + } + + void Segment () + { + drawNode.DrawSegment (from: new CCPoint (0, 0), + to: new CCPoint (100, 200), + radius: 5, + color: new CCColor4F (1, 1, 1, 1)); + } + + void SolidArc () + { + drawNode.DrawSolidArc ( + pos: new CCPoint (100, 100), + radius: 200, + startAngle: 0, + sweepAngle: CCMathHelper.Pi / 2, // this is in radians, clockwise + color: CCColor4B.White); + } + + void SolidCircle () + { + drawNode.DrawSolidCircle ( + pos: new CCPoint (100, 100), + radius: 50, + color: CCColor4B.Yellow); + } + + void TriangleList () + { + CCV3F_C4B[] verts = new CCV3F_C4B[] { + // First triangle: + new CCV3F_C4B (new CCPoint (0, 0), CCColor4B.White), + new CCV3F_C4B (new CCPoint (30, 60), CCColor4B.White), + new CCV3F_C4B (new CCPoint (60, 0), CCColor4B.White), + // second triangle, each point has different colors: + new CCV3F_C4B (new CCPoint (90, 0), CCColor4B.Yellow), + new CCV3F_C4B (new CCPoint (120, 60), CCColor4B.Red), + new CCV3F_C4B (new CCPoint (150, 0), CCColor4B.Blue) + }; + + drawNode.DrawTriangleList (verts); + + } + + } +} diff --git a/CCDrawNode/CustomRendering/CustomRendering.Common/packages.config b/CCDrawNode/CustomRendering/CustomRendering.Common/packages.config new file mode 100644 index 000000000..261e4ab11 --- /dev/null +++ b/CCDrawNode/CustomRendering/CustomRendering.Common/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCDrawNode/Metadata.xml b/CCDrawNode/Metadata.xml new file mode 100644 index 000000000..d699cc129 --- /dev/null +++ b/CCDrawNode/Metadata.xml @@ -0,0 +1,11 @@ + + + d27a4f19-7a94-497e-8e26-deeb1ec37e7e + false + Intermediate + Games + Android + Indie + A simple project showing all draw methods in CCDrawNode. + true + diff --git a/CCDrawNode/README.md b/CCDrawNode/README.md new file mode 100644 index 000000000..61a255e41 --- /dev/null +++ b/CCDrawNode/README.md @@ -0,0 +1,12 @@ +CCDrawNode Gallery +================ + +This solution contains an iOS and Android CocosSharp project which shows how to work with the CCDrawNode object. It includes one method for each draw function in the CCDrawNode class. + +To see each draw function, open the project and navigate to the constructor in GameLayer.cs. Once there, uncomment one of the methods and run the app. The given object will be drawn to the screen. + +This demo is built against CocosSharp 1.5.0.1. + +Authors +------- +Victor Chelaru \ No newline at end of file diff --git a/CCDrawNode/Screenshots/CardinalSpline.PNG b/CCDrawNode/Screenshots/CardinalSpline.PNG new file mode 100644 index 000000000..5f033c315 Binary files /dev/null and b/CCDrawNode/Screenshots/CardinalSpline.PNG differ diff --git a/CCDrawNode/Screenshots/Polygon.PNG b/CCDrawNode/Screenshots/Polygon.PNG new file mode 100644 index 000000000..51deb7aa7 Binary files /dev/null and b/CCDrawNode/Screenshots/Polygon.PNG differ diff --git a/CCDrawNode/Screenshots/Rect.PNG b/CCDrawNode/Screenshots/Rect.PNG new file mode 100644 index 000000000..4101b14e1 Binary files /dev/null and b/CCDrawNode/Screenshots/Rect.PNG differ diff --git a/CCDrawNode/Screenshots/SolidArc.PNG b/CCDrawNode/Screenshots/SolidArc.PNG new file mode 100644 index 000000000..030e2309b Binary files /dev/null and b/CCDrawNode/Screenshots/SolidArc.PNG differ diff --git a/CCDrawNode/Screenshots/TriangleList.PNG b/CCDrawNode/Screenshots/TriangleList.PNG new file mode 100644 index 000000000..6ebece4e6 Binary files /dev/null and b/CCDrawNode/Screenshots/TriangleList.PNG differ diff --git a/CCRenderTexture/Metadata.xml b/CCRenderTexture/Metadata.xml new file mode 100644 index 000000000..f7664a6bd --- /dev/null +++ b/CCRenderTexture/Metadata.xml @@ -0,0 +1,11 @@ + + + b2e9d707-abe4-4a47-85ca-9e4c098edc56 + false + Intermediate + Games + Android, iOS + Indie + A project showing the performance and visual benefits provided by CCRenderTexture. + true + diff --git a/CCRenderTexture/README.md b/CCRenderTexture/README.md new file mode 100644 index 000000000..dcb867ed8 --- /dev/null +++ b/CCRenderTexture/README.md @@ -0,0 +1,12 @@ +CCRenderTexture Example Project +================ + +This solution contains an iOS and Android CocosSharp project which shows how to work with the CCRenderTexture object. This app highlights the performance benefits of using CCRenderTexture in certain situations. It also shows how CCRenderTexture can be used to apply transparency to an entire entity. + +The `useRenderTarget` and `opacity` variables can be modified to see the impact of CCRenderTexture. + +This demo is built using CocosSharp 1.7.1. + +Authors +------- +Victor Chelaru \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample.sln b/CCRenderTexture/RenderTextureExample.sln new file mode 100644 index 000000000..1f5f0c251 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample.sln @@ -0,0 +1,63 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenderTextureExample.iOS", "RenderTextureExample\RenderTextureExample.iOS\RenderTextureExample.iOS.csproj", "{D557E8E0-062B-4FE2-8B45-E22024ECBB41}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenderTextureExample.Android", "RenderTextureExample\RenderTextureExample.Android\RenderTextureExample.Android.csproj", "{E69DEE00-D6D6-49E8-81AF-672B398937A9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenderTextureExample.Common", "RenderTextureExample\RenderTextureExample.Common\RenderTextureExample.Common.csproj", "{1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|iPhone = Debug|iPhone + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|Any CPU = Release|Any CPU + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Debug|iPhone.ActiveCfg = Debug|iPhone + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Debug|iPhone.Build.0 = Debug|iPhone + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Release|Any CPU.ActiveCfg = Release|iPhone + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Release|Any CPU.Build.0 = Release|iPhone + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Release|iPhone.ActiveCfg = Release|iPhone + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Release|iPhone.Build.0 = Release|iPhone + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {D557E8E0-062B-4FE2-8B45-E22024ECBB41}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|iPhone.Build.0 = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Release|Any CPU.Build.0 = Release|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Release|iPhone.ActiveCfg = Release|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Release|iPhone.Build.0 = Release|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {E69DEE00-D6D6-49E8-81AF-672B398937A9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Debug|iPhone.Build.0 = Debug|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Release|Any CPU.Build.0 = Release|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Release|iPhone.ActiveCfg = Release|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Release|iPhone.Build.0 = Release|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/AboutAssets.txt b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/AboutAssets.txt new file mode 100644 index 000000000..a9b0638eb --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/BlueGuy.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/BlueGuy.png new file mode 100644 index 000000000..dfdee6a45 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/BlueGuy.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/BlueIcon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/BlueIcon.png new file mode 100644 index 000000000..29a6d97a8 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/BlueIcon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/CardBackground.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/CardBackground.png new file mode 100644 index 000000000..13b586cf4 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/CardBackground.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/GreenGuy.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/GreenGuy.png new file mode 100644 index 000000000..de6457a6d Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/GreenGuy.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/GreenIcon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/GreenIcon.png new file mode 100644 index 000000000..28c95255b Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/GreenIcon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/OrangeGuy.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/OrangeGuy.png new file mode 100644 index 000000000..56265547d Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/OrangeGuy.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/OrangeIcon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/OrangeIcon.png new file mode 100644 index 000000000..2cffe5691 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/OrangeIcon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/Thumbs.db b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/Thumbs.db new file mode 100644 index 000000000..8c8e5e9a0 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Assets/Content/Images/Thumbs.db differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/MainActivity.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/MainActivity.cs new file mode 100644 index 000000000..d73439a96 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/MainActivity.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; + +using CocosSharp; + +namespace RenderTextureExample.Android +{ + [Activity (Label = "RenderTextureExample.Android", MainLauncher = true, Icon = "@drawable/icon", + AlwaysRetainTaskState = true, + LaunchMode = LaunchMode.SingleInstance, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)] + public class MainActivity : Activity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + // Set our view from the "main" layout resource + SetContentView (Resource.Layout.Main); + + // Get our game view from the layout resource, + // and attach the view created event to it + CCGameView gameView = (CCGameView)FindViewById (Resource.Id.GameView); + gameView.ViewCreated += LoadGame; + } + + void LoadGame (object sender, EventArgs e) + { + CCGameView gameView = sender as CCGameView; + + if (gameView != null) + { + var contentSearchPaths = new List() { "Fonts", "Sounds", "Images" }; + + int width = 512; + int height = 384; + + // Set world dimensions + gameView.DesignResolution = new CCSizeI(width, height); + + gameView.ContentManager.SearchPaths = contentSearchPaths; + + CCScene gameScene = new CCScene(gameView); + gameScene.AddLayer(new GameLayer()); + gameView.RunWithScene(gameScene); + } + } + } +} + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Properties/AndroidManifest.xml b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Properties/AndroidManifest.xml new file mode 100644 index 000000000..fc01f352a --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Properties/AssemblyInfo.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b1edce8b6 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("RenderTextureExample.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("vchelaru")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/RenderTextureExample.Android.csproj b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/RenderTextureExample.Android.csproj new file mode 100644 index 000000000..803feb641 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/RenderTextureExample.Android.csproj @@ -0,0 +1,110 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {E69DEE00-D6D6-49E8-81AF-672B398937A9} + Library + RenderTextureExample.Android + Assets + Resources + Resource + Resources\Resource.designer.cs + True + True + RenderTextureExample.Android + v6.0 + Properties\AndroidManifest.xml + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\MonoGame.Framework.dll + + + + + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC} + RenderTextureExample.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/RenderTextureExample.Android.csproj.bak b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/RenderTextureExample.Android.csproj.bak new file mode 100644 index 000000000..cebaedd08 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/RenderTextureExample.Android.csproj.bak @@ -0,0 +1,89 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {E69DEE00-D6D6-49E8-81AF-672B398937A9} + Library + RenderTextureExample.Android + Assets + Resources + Resource + Resources\Resource.designer.cs + True + True + RenderTextureExample.Android + v5.0 + Properties\AndroidManifest.xml + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\MonoAndroid10\MonoGame.Framework.dll + + + + + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC} + RenderTextureExample.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tasky/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/AboutResources.txt similarity index 100% rename from Tasky/Components/xamarin.mobile-0.7.4/samples/Xamarin.Mobile.Android.Samples/GeolocationSample/Resources/AboutResources.txt rename to CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/AboutResources.txt diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-hdpi/Icon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-hdpi/Icon.png new file mode 100644 index 000000000..f4c804644 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-hdpi/Icon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-mdpi/Icon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-mdpi/Icon.png new file mode 100644 index 000000000..ef1e1ee7d Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-mdpi/Icon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xhdpi/Icon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xhdpi/Icon.png new file mode 100644 index 000000000..b7e2e57aa Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xhdpi/Icon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xxhdpi/Icon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xxhdpi/Icon.png new file mode 100644 index 000000000..8d20a38d1 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xxhdpi/Icon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xxxhdpi/Icon.png b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xxxhdpi/Icon.png new file mode 100644 index 000000000..6d9919c41 Binary files /dev/null and b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/drawable-xxxhdpi/Icon.png differ diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/layout/Main.axml b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/layout/Main.axml new file mode 100644 index 000000000..77959ac22 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/layout/Main.axml @@ -0,0 +1,11 @@ + + + + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/values/Strings.xml b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/values/Strings.xml new file mode 100644 index 000000000..b5dc13fd7 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/Resources/values/Strings.xml @@ -0,0 +1,4 @@ + + + RenderTextureExample.Android + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/packages.config b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/packages.config new file mode 100644 index 000000000..4edced82f --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Android/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/Card.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/Card.cs new file mode 100644 index 000000000..d2f7db239 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/Card.cs @@ -0,0 +1,315 @@ +using CocosSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenderTextureExample +{ + class Card : CCNode + { + bool usesRenderTexture; + + List visualComponents = new List(); + + CCSprite background; + CCSprite colorIcon; + CCSprite monsterSprite; + CCLabel monsterNameDisplay; + CCLabel hpDisplay; + CCLabel descriptionDisplay; + + CCRenderTexture renderTexture; + + public string MonsterName + { + get + { + return monsterNameDisplay.Text; + } + set + { + monsterNameDisplay.Text = value; + } + } + + public string HpText + { + get + { + return hpDisplay.Text; + } + set + { + hpDisplay.Text = value; + } + } + + public string DescriptionText + { + get + { + return descriptionDisplay.Text; + } + set + { + descriptionDisplay.Text = value; + } + } + + public CCTexture2D ColorIconTexture + { + get + { + return colorIcon.Texture; + } + set + { + colorIcon.Texture = value; + colorIcon.IsAntialiased = false; + + } + } + + public CCTexture2D MonsterTexture + { + get + { + return monsterSprite.Texture; + } + set + { + monsterSprite.Texture = value; + ReactToMonsterSpriteTextureSet(); + } + } + + public bool UsesRenderTexture + { + get + { + return usesRenderTexture; + } + set + { + usesRenderTexture = value; + if (usesRenderTexture) + { + SwitchToRenderTexture(); + } + else + { + SwitchToRenderingComponents(); + } + } + } + + public override byte Opacity + { + get + { + return base.Opacity; + } + + set + { + base.Opacity = value; + + if (usesRenderTexture) + { + this.renderTexture.Sprite.Opacity = value; + } + else + { + foreach (var component in visualComponents) + { + component.Opacity = value; + } + } + } + } + + public Card() + { + CreateBackground(); + + CreateColorIcon(); + + CreateMonsterSprite(); + + CreateMonsterNameDisplay(); + + CreateHpDisplay(); + + CreateDescriptionDisplay(); + + AddComponentsToList(); + } + + private void CreateBackground() + { + background = new CCSprite("CardBackground.png"); + background.IsAntialiased = false; + // The background serves as the largest sprite so it essentially defines the + // card size and anchor point. Which is bottom left. + background.AnchorPoint = CCPoint.Zero; + } + + private void CreateColorIcon() + { + colorIcon = new CCSprite("GreenIcon.png"); + + colorIcon.AnchorPoint = CCPoint.Zero; + colorIcon.PositionX = 97; + colorIcon.PositionY = 72; + colorIcon.IsAntialiased = false; + } + + private void CreateMonsterSprite() + { + monsterSprite = new CCSprite("GreenGuy.png"); + monsterSprite.PositionX = background.ContentSize.Center.X; + monsterSprite.PositionY = 135; + ReactToMonsterSpriteTextureSet(); + } + + private void ReactToMonsterSpriteTextureSet() + { + monsterSprite.IsAntialiased = false; + // The TextureRectInPixels gets automatically set when the CCSprite is first + // created, but the value does not adjust automatically when the texture is changed: + monsterSprite.TextureRectInPixels = new CCRect(0, 0, + monsterSprite.Texture.PixelsWide, monsterSprite.Texture.PixelsHigh); + monsterSprite.Scale = 5; + } + + private void CreateMonsterNameDisplay() + { + monsterNameDisplay = CreateLabel("Monster Name"); + monsterNameDisplay.HorizontalAlignment = CCTextAlignment.Center; + monsterNameDisplay.PositionX = background.ContentSize.Center.X; + monsterNameDisplay.PositionY = background.ContentSize.Height - 10; + } + + private void CreateHpDisplay() + { + hpDisplay = CreateLabel("HP: 10/10"); + hpDisplay.AnchorPoint = new CCPoint(0, .5f); + hpDisplay.PositionY = 80; + hpDisplay.PositionX = 10; + } + + private void CreateDescriptionDisplay() + { + descriptionDisplay = CreateLabel("Monster Description that wraps to multiple lines", 22); + descriptionDisplay.Color = CCColor3B.Black; + descriptionDisplay.PositionX = 15; + descriptionDisplay.PositionY = 70; + descriptionDisplay.LineHeight = 75; + descriptionDisplay.Dimensions = new CCSize(180, 400); + descriptionDisplay.LineBreak = CCLabelLineBreak.Word; + descriptionDisplay.AnchorPoint = new CCPoint(0, 1); + } + + private void AddComponentsToList() + { + visualComponents.Add(background); + visualComponents.Add(colorIcon); + visualComponents.Add(monsterSprite); + visualComponents.Add(monsterNameDisplay); + visualComponents.Add(hpDisplay); + visualComponents.Add(descriptionDisplay); + } + + private void SwitchToRenderingComponents() + { + if (renderTexture != null && this.Children.Contains(renderTexture.Sprite)) + { + this.RemoveChild(renderTexture.Sprite); + } + + bool areVisualComponentsAlreadyAdded = this.Children != null && this.Children.Contains(visualComponents[0]); + + if (!areVisualComponentsAlreadyAdded) + { + foreach (var component in visualComponents) + { + this.AddChild(component); + } + } + + } + + private void SwitchToRenderTexture() + { + // The card needs to be moved to the origin (0,0) so it's rendered on the render target. + // After it's rendered to the CCRenderTexture, it will be moved back to its old position + var oldPosition = this.Position; + + // Make sure visuals are part of the card so they get rendered + bool areVisualComponentsAlreadyAdded = this.Children != null && this.Children.Contains(visualComponents[0]); + if (!areVisualComponentsAlreadyAdded) + { + // Temporarily add them so we can render the object: + foreach (var component in visualComponents) + { + this.AddChild(component); + } + } + + // Create the render texture if it hasn't yet been made: + if (renderTexture == null) + { + // Even though the game is zoomed in to create a pixellated look, we are using + // high-resolution textures. Therefore, we want to have our canvas be 2x as big as + // the background so fonts don't appear pixellated + var unitResolution = background.ContentSize; + var pixelResolution = background.ContentSize * 2; + renderTexture = new CCRenderTexture(unitResolution, pixelResolution); + } + + // We don't want the render target to be a child of the card + // when we call Visit + if (this.Children != null && this.Children.Contains(renderTexture.Sprite)) + { + this.RemoveChild(renderTexture.Sprite); + } + + // Move this instance back to the origin so it is rendered inside the render target: + this.Position = CCPoint.Zero; + + // Clears the CCRenderTexture + renderTexture.BeginWithClear(CCColor4B.Transparent); + + // Visit renders this object and all of its children + this.Visit(); + + // Ends the rendering, which means the CCRenderTexture's Sprite can be used + renderTexture.End(); + + // We no longer want the individual components to be drawn, so remove them: + foreach (var component in visualComponents) + { + this.RemoveChild(component); + } + + // add the render target sprite to this: + this.AddChild(renderTexture.Sprite); + + renderTexture.Sprite.AnchorPoint = CCPoint.Zero; + + // Move this back to its original position: + this.Position = oldPosition; + + } + + private CCLabel CreateLabel(string text, int fontSize = 28) + { + var toReturn = new CCLabel(text, "Arial", fontSize, CCLabelFormat.SystemFont); + toReturn.Scale = .5f; + + return toReturn; + } + } +} diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/GameLayer.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/GameLayer.cs new file mode 100644 index 000000000..48586dec9 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/GameLayer.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using CocosSharp; + +namespace RenderTextureExample +{ + public class GameLayer : CCLayerColor + { + public GameLayer () : base (CCColor4B.Black) + { + + } + + protected override void AddedToScene () + { + base.AddedToScene(); + + GameView.Stats.Enabled = true; + + const bool useRenderTextures = true; + const byte opacity = 255; + + const float positionIncrement = 140; + + Card card = new Card(); + card.ColorIconTexture = CCTextureCache.SharedTextureCache.AddImage("GreenIcon.png"); + card.MonsterTexture = CCTextureCache.SharedTextureCache.AddImage("GreenGuy.png"); + card.DescriptionText = "Does extra damage to water units"; + card.MonsterName = "Grobot"; + card.PositionX = 20; + card.PositionY = 100; + card.UsesRenderTexture = useRenderTextures; + card.Opacity = opacity; + this.AddChild(card); + + card = new Card(); + card.ColorIconTexture = CCTextureCache.SharedTextureCache.AddImage("BlueIcon.png"); + card.MonsterTexture = CCTextureCache.SharedTextureCache.AddImage("BlueGuy.png"); + card.DescriptionText = "Takes reduced damage from earth attacks"; + card.MonsterName = "Bluchirp"; + card.PositionX = 20 + positionIncrement; + card.PositionY = 100; + card.UsesRenderTexture = useRenderTextures; + card.Opacity = opacity; + this.AddChild(card); + + card = new Card(); + card.ColorIconTexture = CCTextureCache.SharedTextureCache.AddImage("OrangeIcon.png"); + card.MonsterTexture = CCTextureCache.SharedTextureCache.AddImage("OrangeGuy.png"); + card.DescriptionText = "High chance of preemptive attack"; + card.MonsterName = "Orange-U-Glad"; + card.PositionX = 20 + positionIncrement * 2; + card.PositionY = 100; + card.UsesRenderTexture = useRenderTextures; + card.Opacity = opacity; + this.AddChild(card); + + } + } +} diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/RenderTextureExample.Common.csproj b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/RenderTextureExample.Common.csproj new file mode 100644 index 000000000..9efadeed4 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/RenderTextureExample.Common.csproj @@ -0,0 +1,51 @@ + + + + Debug + AnyCPU + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC} + Library + RenderTextureExample.Common + RenderTextureExample.Common + v4.5 + Profile111 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\box2d.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\portable-net45+win+wpa81+wp81\MonoGame.Framework.dll + + + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/packages.config b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/packages.config new file mode 100644 index 000000000..ad4b976d2 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.Common/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/AppDelegate.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/AppDelegate.cs new file mode 100644 index 000000000..acd35d3ac --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/AppDelegate.cs @@ -0,0 +1,60 @@ +using Foundation; +using UIKit; + +namespace RenderTextureExample.iOS +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to application events from iOS. + [Register ("AppDelegate")] + public class AppDelegate : UIApplicationDelegate + { + // class-level declarations + + public override UIWindow Window + { + get; + set; + } + + public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) + { + // Override point for customization after application launch. + // If not required for your application you can safely delete this method + + return true; + } + + public override void OnResignActivation (UIApplication application) + { + // Invoked when the application is about to move from active to inactive state. + // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) + // or when the user quits the application and it begins the transition to the background state. + // Games should use this method to pause the game. + } + + public override void DidEnterBackground (UIApplication application) + { + // Use this method to release shared resources, save user data, invalidate timers and store the application state. + // If your application supports background exection this method is called instead of WillTerminate when the user quits. + } + + public override void WillEnterForeground (UIApplication application) + { + // Called as part of the transiton from background to active state. + // Here you can undo many of the changes made on entering the background. + } + + public override void OnActivated (UIApplication application) + { + // Restart any tasks that were paused (or not yet started) while the application was inactive. + // If the application was previously in the background, optionally refresh the user interface. + } + + public override void WillTerminate (UIApplication application) + { + // Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground. + } + } +} + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Entitlements.plist b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Entitlements.plist new file mode 100644 index 000000000..9ae599370 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Info.plist b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Info.plist new file mode 100644 index 000000000..d00fa0eb0 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDisplayName + ${AppName} + CFBundleIdentifier + ${AppIdentifier} + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 8.0 + UIDeviceFamily + + 1 + 2 + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIMainStoryboardFile~ipad + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Resources/Images.xcassets/AppIcons.appiconset + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Main.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Main.cs new file mode 100644 index 000000000..39de2626d --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Main.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace RenderTextureExample.iOS +{ + public class Application + { + // This is the main entry point of the application. + static void Main (string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main (args, null, "AppDelegate"); + } + } +} diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Main.storyboard b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Main.storyboard new file mode 100644 index 000000000..760aea9c2 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Main.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/RenderTextureExample.iOS.csproj b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/RenderTextureExample.iOS.csproj new file mode 100644 index 000000000..8ec94d341 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/RenderTextureExample.iOS.csproj @@ -0,0 +1,173 @@ + + + + Debug + iPhoneSimulator + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {D557E8E0-062B-4FE2-8B45-E22024ECBB41} + Exe + RenderTextureExample.iOS + Resources + RenderTextureExampleiOS + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + false + i386 + None + true + true + true + true + iPhone Developer + true + NSUrlSessionHandler + + + full + true + bin\iPhone\Release + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + true + iPhone Developer + true + NSUrlSessionHandler + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + false + i386 + None + true + iPhone Developer + true + NSUrlSessionHandler + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + iPhone Developer + true + true + true + true + true + NSUrlSessionHandler + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\box2d.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\MonoGame.Framework.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\MonoGame.Framework.Net.dll + + + + + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC} + RenderTextureExample.Common + + + + + false + + + + + + + + + + + + + + + + + + + + + + + ViewController.cs + + + + + Content\Images\BlueGuy.png + + + + + Content\Images\BlueIcon.png + + + + + Content\Images\CardBackground.png + + + + + Content\Images\GreenGuy.png + + + + + Content\Images\GreenIcon.png + + + + + Content\Images\OrangeGuy.png + + + + + Content\Images\OrangeIcon.png + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/RenderTextureExample.iOS.csproj.bak b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/RenderTextureExample.iOS.csproj.bak new file mode 100644 index 000000000..b36c1120e --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/RenderTextureExample.iOS.csproj.bak @@ -0,0 +1,132 @@ + + + + Debug + iPhoneSimulator + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {D557E8E0-062B-4FE2-8B45-E22024ECBB41} + Exe + RenderTextureExample.iOS + Resources + RenderTextureExample.iOS + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + false + i386 + None + true + true + true + true + iPhone Developer + true + + + full + true + bin\iPhone\Release + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + true + iPhone Developer + true + + + full + true + bin\iPhoneSimulator\Release + prompt + 4 + false + i386 + None + true + iPhone Developer + true + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + false + ARMv7, ARM64 + Entitlements.plist + true + iPhone Developer + true + true + true + true + true + + + + + + + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\box2d.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\CocosSharp.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\Lidgren.Network.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\MonoGame.Framework.dll + + + ..\..\packages\CocosSharp.1.7.1.0\lib\Xamarin.iOS10\MonoGame.Framework.Net.dll + + + + + {1715905D-1CF2-4A76-9DB6-F2740D5D5EBC} + RenderTextureExample.Common + + + + + + + + + + + + + + + + + + + + + + + + + + ViewController.cs + + + + \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000..24f997458 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,108 @@ +{ + "images": [ + { + "size": "29x29", + "scale": "1x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "3x", + "idiom": "iphone" + }, + { + "size": "40x40", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "40x40", + "scale": "3x", + "idiom": "iphone" + }, + { + "size": "57x57", + "scale": "1x", + "idiom": "iphone" + }, + { + "size": "57x57", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "60x60", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "60x60", + "scale": "3x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "29x29", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "40x40", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "40x40", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "50x50", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "50x50", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "72x72", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "72x72", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "76x76", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "76x76", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "120x120", + "scale": "1x", + "idiom": "car" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Resources/LaunchScreen.xib b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Resources/LaunchScreen.xib new file mode 100644 index 000000000..69c5ee8d8 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/Resources/LaunchScreen.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/ViewController.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/ViewController.cs new file mode 100644 index 000000000..0b0c82775 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/ViewController.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using UIKit; +using CocosSharp; + +namespace RenderTextureExample.iOS +{ + public partial class ViewController : UIViewController + { + public ViewController (IntPtr handle) : base (handle) + { + } + + public override void ViewDidLoad () + { + base.ViewDidLoad (); + + if (GameView != null) + { + // Set loading event to be called once game view is fully initialised + GameView.ViewCreated += LoadGame; + } + } + + public override void ViewWillDisappear (bool animated) + { + base.ViewWillDisappear (animated); + + if (GameView != null) + GameView.Paused = true; + } + + public override void ViewDidAppear (bool animated) + { + base.ViewDidAppear (animated); + + if (GameView != null) + GameView.Paused = false; + } + + public override void DidReceiveMemoryWarning () + { + base.DidReceiveMemoryWarning (); + // Release any cached data, images, etc that aren't in use. + } + + void LoadGame (object sender, EventArgs e) + { + CCGameView gameView = sender as CCGameView; + + if (gameView != null) + { + var contentSearchPaths = new List() { "Fonts", "Sounds", "Images" }; + + int width = 512; + int height = 384; + + // Set world dimensions + gameView.DesignResolution = new CCSizeI(width, height); + + gameView.ContentManager.SearchPaths = contentSearchPaths; + + CCScene gameScene = new CCScene(gameView); + gameScene.AddLayer(new GameLayer()); + gameView.RunWithScene(gameScene); + } + } + } +} + diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/ViewController.designer.cs b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/ViewController.designer.cs new file mode 100644 index 000000000..dc8b60a97 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/ViewController.designer.cs @@ -0,0 +1,26 @@ +// +// This file has been generated automatically by MonoDevelop to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; +using System.CodeDom.Compiler; + +namespace RenderTextureExample.iOS +{ + [Register ("ViewController")] + partial class ViewController + { + [Outlet] + CocosSharp.CCGameView GameView { get; set; } + + void ReleaseDesignerOutlets () + { + if (GameView != null) + { + GameView.Dispose (); + GameView = null; + } + } + } +} diff --git a/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/packages.config b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/packages.config new file mode 100644 index 000000000..f9d024b44 --- /dev/null +++ b/CCRenderTexture/RenderTextureExample/RenderTextureExample.iOS/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CCRenderTexture/Screenshots/1FullOpacity.PNG b/CCRenderTexture/Screenshots/1FullOpacity.PNG new file mode 100644 index 000000000..b7e7a585b Binary files /dev/null and b/CCRenderTexture/Screenshots/1FullOpacity.PNG differ diff --git a/CCRenderTexture/Screenshots/DrawCallReduction.PNG b/CCRenderTexture/Screenshots/DrawCallReduction.PNG new file mode 100644 index 000000000..b7e5eea93 Binary files /dev/null and b/CCRenderTexture/Screenshots/DrawCallReduction.PNG differ diff --git a/CCRenderTexture/Screenshots/Transparent.PNG b/CCRenderTexture/Screenshots/Transparent.PNG new file mode 100644 index 000000000..d5cf58574 Binary files /dev/null and b/CCRenderTexture/Screenshots/Transparent.PNG differ diff --git a/Camera/Camera.Droid/Camera.Droid.csproj b/Camera/Camera.Droid/Camera.Droid.csproj deleted file mode 100644 index 3fa0b37c2..000000000 --- a/Camera/Camera.Droid/Camera.Droid.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E6113F86-0FF9-4917-B934-BF690A6229A8} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Camera.Droid - True - Resources\Resource.designer.cs - Resource - Resources - Assets - Camera.Droid - Properties\AndroidManifest.xml - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - None - false - - - full - true - bin\Release - prompt - 4 - false - false - x86 - - - - - - - - ..\Components\xamarin.mobile-0.6.3\lib\android\Xamarin.Mobile.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0.6.3 - False - - - - - - - - - - - \ No newline at end of file diff --git a/Camera/Camera.Droid/MainActivity.cs b/Camera/Camera.Droid/MainActivity.cs deleted file mode 100644 index fe19a15ff..000000000 --- a/Camera/Camera.Droid/MainActivity.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Threading.Tasks; - -using Android.App; -using Android.Content; -using Android.Runtime; -using Android.Views; -using Android.Widget; -using Android.OS; - -using Xamarin.Media; - -namespace Camera.Droid -{ - [Activity (Label = "Camera.Droid", MainLauncher = true)] - public class MainActivity : Activity - { - - protected override void OnCreate (Bundle bundle) - { - base.OnCreate (bundle); - - // Set our view from the "main" layout resource - SetContentView (Resource.Layout.Main); - - // Get our button from the layout resource, - // and attach an event to it - Button button = FindViewById