Skip to content

Commit

Permalink
Xamarin Forms application (#6)
Browse files Browse the repository at this point in the history
* Xamarin for Android, iOS and UWP running on .NET Standard Library.

* Working on Home page

* Added MasterDetailPage, WIP

* Working on Weather Widget View

Working on Android, missing config and iOS resources

* Some adjustements to Weather view

* Refactor WeatherWidgetItem style

* Refactor existing pages style and organization

* Working on MainMenu

* MainPage -> HomePage, created LiftStatusPage

* Working on Lift Status page

Also, updated csproj of iOS project after update

* Working on Lift Status

* Weather Widget gets real data

* Fixed binding problem on WeatherWidgetItem

* Adding SplashScreens and Icons

* Added splash logo

* Added tinier splash image

* working on the documentdb integration

* Working on Lift Status List

* Fix loading in LiftStatus page in iOS

* Working on rentals

* modify the backend services to use DocumentDB

* Working on rentals page

* Working on Dining, also created some Solution Folders

* Integrate documentDB

* Fix issues

* Working on Dining, also created some Solution Folders

* More work on dining page

* Stars and dollars signs

* New default user geolocation, some config

* Apply some feedback

Add marker icon

* Image loading and listview optimizations

* Working on new NavigationService

* Dining and Lift detail

* Recover cachingstrategy in DiningPage

* Remove unused var

* DistanceFormattedText converter

* DistanceFormattedText converter

* Lift Detail map marker

* Rental tabs and created rental form view

* SkiApp data generator update

* Update database views

* AppSettings update, real keys have been replced by variables

* Changed Recommendations API from DataMarket to Cognitive Services

* Working on Dining View

* FIxed sorting

* Changed Anomaly Detection API from DataMarket to AzureML

* Updated deployment script

* Updated setup doc

* Navigation fixed

* tokenize the XamarinApp config

* Fix an issue with the store procedure

* Delete .suo

* Tabbed Page icons for iOS

* Working on rental form

* Working on rental form

* Working on the batch scoring

* working on the batch scoring feature

* Change the SA logic to start/stop the existing jobs

* Fix the query

* Working on forms

* automate powebi, cognetive services & azureml

* Form actually saves data

* Rental form saves and navigates back to the list

* Move data initializers to a new method in rental form

* Rental DTO for creation, fixed issue with missing JSON serializations

* Improve the doc

* add the sample app to import the powerbi report

* Update the app

* Change pickuphour to TimeSpan

* Added loading state

* fix deployments issues

* Fix date select and data initialization

* Sorting icon in dinner, optimize PNG

* Optimize PNG iOS resources

* Fix issues

* Fix issues

* update advanced app

* Better UI in Lifts page

* High demand

* Add scrollview

* Update image for better resolution

* Similar restaurants recommendations

* Better HTTP handling, working on Auth

* Working on Login

* User info fetching

* Login complete

* update docs
  • Loading branch information
ibonilm committed Feb 3, 2017
1 parent 18c7042 commit d5ad438
Show file tree
Hide file tree
Showing 295 changed files with 34,098 additions and 2,164 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -18,3 +18,4 @@ src/SkiResort.Web/src/ts/**/*.js
/src/SkiResort.Web/wwwroot/azureSearch/index.json
/src/SkiResort.Web/wwwroot/azureSearch/data.json
/src/**/*.lock.json
/src/SkiResort.DataGeneration/.vs/SkiResort.DataGeneration/v14/.suo
942 changes: 938 additions & 4 deletions AdventureWorks.SkiResort.sln

Large diffs are not rendered by default.

Binary file added UpgradeLog.htm
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/RentalDemandExperiments.r
@@ -1,6 +1,6 @@
library(rpart.plot)

serverData = RxSqlServerData(sqlQuery = "SELECT * FROM RentalFeatures ORDER BY Year, Month, Day", connectionString = "__RSQLCONNECTIONSTRING__")
serverData = RxSqlServerData(sqlQuery = "SELECT * FROM RentalFeatures ORDER BY Year, Month, Day", connectionString = "__RSQLCONNECTIONSTRING__")

rentals = rxImport(serverData)

Expand Down
47 changes: 31 additions & 16 deletions deploy/Scripts/Deploy-AzureResourceGroup.ps1
Expand Up @@ -22,6 +22,7 @@ try {

Set-StrictMode -Version 3


$OptionalParameters = New-Object -TypeName Hashtable
$TemplateFile = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $TemplateFile))
$TemplateParametersFile = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $TemplateParametersFile))
Expand Down Expand Up @@ -50,6 +51,11 @@ if ($results) {
$storagescript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'ConfigureStorage.ps1'))
& $storagescript $ResourceGroupName $StorageName

Write-Host 'Create documentDB collections'
$documentdbscript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'DocumentDB.ps1'))
& $documentdbscript $results.Outputs.documentDBAccount.value $results.Outputs.documentDBKey.value "skiresortliftlines" "liftlines"
& $documentdbscript $results.Outputs.documentDBAccount.value $results.Outputs.documentDBKey.value "skiresortliftlinesarchive" "liftlinesarchive"

Write-Host 'Deploy ASP.NET app (Basic)'
$webAppName = $results.Outputs.webSiteName.value
$publisScript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'PublishASPNET.ps1'))
Expand All @@ -60,18 +66,17 @@ if ($results) {
$publisScript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'PublishASPNET.ps1'))
& $publisScript $ResourceGroupName $webAppName "..\WebApp\SkiResortAdvanced.zip"

Write-Host 'Restart Stream Analytics Job'

$restartscript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'RestartStreamJob.ps1'))
& $restartscript $ResourceGroupName
Write-Host 'Start Stream Analytics Job'
$startscript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'StartStreamJob.ps1'))
& $startscript $ResourceGroupName

Write-Host 'Test WebApp (basic)'
$testwebapps = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'TestWebApps.ps1'))
& $testwebapps $results.Outputs.webSiteName.value

Write-Host 'Configure Basic WebApp'

$configRelativePath = "..\..\src\SkiResort.Web\appsettings.json"
$configRelativePath = "..\..\..\..\..\..\src\SkiResort.Web\appsettings.json"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
$replacescript = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, 'Replace-FileString.ps1'))

Expand All @@ -85,38 +90,48 @@ if ($results) {
& $replacescript -Pattern '__YOUR_INSTRUMENTATION_KEY__' -Replacement $results.Outputs.applicationInsightsKey.value -Overwrite -Path $configPath
& $replacescript -Pattern '__SEARCHSERVICENAME__' -Replacement $results.Outputs.searchServiceName.value -Overwrite -Path $configPath
& $replacescript -Pattern '__SEARCHKEY__' -Replacement $results.Outputs.searchServiceKey.value -Overwrite -Path $configPath
& $replacescript -Pattern '__ANOMALYDETECTIONKEY__' -Replacement $results.Outputs.dataMarketKey.value -Overwrite -Path $configPath
& $replacescript -Pattern '__DOCUMENTDBENDPOINT__' -Replacement $results.Outputs.documentDBEndpoint.value -Overwrite -Path $configPath
& $replacescript -Pattern '__DOCUMENTDBKEY__' -Replacement $results.Outputs.documentDBKey.value -Overwrite -Path $configPath

Write-Host 'Configure Data Generation apps'

$configRelativePath = "..\..\src\SkiResort.DataGeneration\gen-skirentals\App.config"
$configRelativePath = "..\..\..\..\..\..\src\SkiResort.DataGeneration\gen-skirentals\App.config"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__SQLCONNECTIONSTRING__' -Replacement $results.Outputs.defaultConnection.value -Overwrite -Path $configPath

$configRelativePath = "..\..\src\SkiResort.DataGeneration\gen-skilocations\App.config"
$configRelativePath = "..\..\..\..\..\..\src\SkiResort.DataGeneration\gen-skilocations\App.config"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__EVENTHUBCONNECTIONSTRING__' -Replacement $results.Outputs.eventHubConnectionString.value -Overwrite -Path $configPath
& $replacescript -Pattern '__EVENTHUBCONNECTIONPATH__' -Replacement $results.Outputs.evenHubName.value -Overwrite -Path $configPath

$configRelativePath = "..\..\src\SkiResort.DataGeneration\gen-restaurantssearch\App.config"
$configRelativePath = "..\..\..\..\..\..\src\SkiResort.DataGeneration\gen-restaurantssearch\App.config"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__SQLCONNECTIONSTRING__' -Replacement $results.Outputs.defaultConnection.value -Overwrite -Path $configPath
& $replacescript -Pattern '__SEARCHSERVICENAME__' -Replacement $results.Outputs.searchServiceName.value -Overwrite -Path $configPath
& $replacescript -Pattern '__SEARCHKEY__' -Replacement $results.Outputs.searchServiceKey.value -Overwrite -Path $configPath
& $replacescript -Pattern '__RECOUSER__' -Replacement $results.Outputs.dataMarketUser.value -Overwrite -Path $configPath
& $replacescript -Pattern '__RECOKEY__' -Replacement $results.Outputs.dataMarketKey.value -Overwrite -Path $configPath
& $replacescript -Pattern '__RECOKEY__' -Replacement $results.Outputs.recommendationsKey.value -Overwrite -Path $configPath

$configRelativePath = "..\..\src\SkiResort.DataGeneration\gen-recomodel\App.config"
$configRelativePath = "..\..\..\..\..\..\src\SkiResort.DataGeneration\gen-recomodel\App.config"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__SQLCONNECTIONSTRING__' -Replacement $results.Outputs.defaultConnection.value -Overwrite -Path $configPath
& $replacescript -Pattern '__RECOUSER__' -Replacement $results.Outputs.dataMarketUser.value -Overwrite -Path $configPath
& $replacescript -Pattern '__RECOKEY__' -Replacement $results.Outputs.dataMarketKey.value -Overwrite -Path $configPath
& $replacescript -Pattern '__RECOKEY__' -Replacement $results.Outputs.recommendationsKey.value -Overwrite -Path $configPath

$configRelativePath = "..\..\demo\RentalDemandExperiments.r"
$configRelativePath = "..\..\..\..\..\..\demo\RentalDemandExperiments.r"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__RSQLCONNECTIONSTRING__' -Replacement $results.Outputs.rConnection.value -Overwrite -Path $configPath

$configRelativePath = "..\..\..\..\..\..\reports\provision\ProvisionSample.exe.config"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__COLLECTIONNAME__' -Replacement $results.Outputs.powerbiname.value -Overwrite -Path $configPath
& $replacescript -Pattern '__ACCESSKEY__' -Replacement $results.Outputs.powerbikey.value -Overwrite -Path $configPath


$serverurl = "http://$($results.Outputs.webSiteName.value).azurewebsites.net"
$configRelativePath = "..\..\..\..\..\..\src\SkiResort.XamarinApp\SkiResort.XamarinApp\Config.cs"
$configPath = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $configRelativePath))
& $replacescript -Pattern '__SERVERURI__' -Replacement $serverurl -Overwrite -Path $configPath


Write-Host "WebSite basic: http://$($results.Outputs.webSiteName.value).azurewebsites.net"
Write-Host "WebSite basic: $serverurl"
Write-Host "SQL Server VM Connection String: $($results.Outputs.defaultConnection.value)"
}
88 changes: 88 additions & 0 deletions deploy/Scripts/DocumentDB.ps1
@@ -0,0 +1,88 @@

param(
[String] $accountName,
[String] $connectionKey,
[String] $databaseName,
[String] $collectionName
)

begin
{
Write-Host $accountName
Write-Host $databaseName
Write-Host $collectionName

function GetKey([System.String]$Verb = '',[System.String]$ResourceId = '',
[System.String]$ResourceType = '',[System.String]$Date = '',[System.String]$masterKey = '') {

$keyBytes = [System.Convert]::FromBase64String($masterKey)
$text = @($Verb.ToLowerInvariant() + "`n" + $ResourceType.ToLowerInvariant() + "`n" + $ResourceId + "`n" + $Date.ToLowerInvariant() + "`n" + "`n")
$body =[Text.Encoding]::UTF8.GetBytes($text)
$hmacsha = new-object -TypeName System.Security.Cryptography.HMACSHA256 -ArgumentList (,$keyBytes)
$hash = $hmacsha.ComputeHash($body)
$signature = [System.Convert]::ToBase64String($hash)

[System.Web.HttpUtility]::UrlEncode($('type=master&ver=1.0&sig=' + $signature))
}

function GetUTDate() {
$date = get-date
$date = $date.ToUniversalTime();
return $date.ToString("ddd, dd MMM yyyy HH:mm:ss \G\M\T")
}

function BuildHeaders([string]$action = "get",[string]$resType, [string]$resourceId){
$authz = GetKey -Verb $action -ResourceType $resType -ResourceId $resourceId -Date $apiDate -masterKey $connectionKey
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authz)
$headers.Add("x-ms-version", '2015-12-16')
$headers.Add("x-ms-date", $apiDate)
$headers
}

function GetDatabaseCount() {
$uri = $rootUri + "/dbs"
$hdr = BuildHeaders -resType dbs
$response = Invoke-RestMethod -Uri $uri -Method Get -Headers $hdr
$response.Databases.Count
Write-Host ("Found " + $Response.Databases.Count + " Database(s)")
}

function CreateDatabase(){
$uri = $rootUri + "/dbs"
$headers = BuildHeaders -action Post -resType dbs
$headers.Add("x-ms-documentdb-is-upsert", "true")
$content = @{id=$databaseName} | ConvertTo-Json
$response = Invoke-RestMethod $uri -Method Post -Body $content -ContentType 'application/json' -Headers $headers
}

function CreateCollection(){

$uri = $rootUri + "/dbs/" + $databaseName + "/colls"
$resourceId = "dbs/"+ $databaseName
$headers = BuildHeaders -action Post -resType colls -resourceId $resourceId
$headers.Add("x-ms-documentdb-is-upsert", "true")
$headers.Add("x-ms-offer-throughput", "1000")

$content = @{id=$collectionName} | ConvertTo-Json
$response = Invoke-RestMethod $uri -Method Post -Body $content -ContentType 'application/json' -Headers $headers
}

$rootUri = "https://" + $accountName + ".documents.azure.com"
write-host ("Root URI is " + $rootUri)
$apiDate = GetUTDate

$databasecount = GetDatabaseCount
if ($databasecount -gt 1) {
Write-Host "Database already exists"
return
}

CreateDatabase
CreateCollection

}




File renamed without changes.
1 change: 0 additions & 1 deletion deploy/Scripts/StopStreamJob.ps1
Expand Up @@ -10,7 +10,6 @@ $sasJobs = Find-AzureRmResource -ResourceGroupNameContains $resourceGroupName -R
foreach ($sasJob in $sasJobs)
{
if ($sasJob.ResourceGroupName -eq $resourceGroupName) {
Write-Host $sasJob.ResourceName
$null = Stop-AzureRmStreamAnalyticsJob -Name $sasJob.ResourceName -ResourceGroupName $resourceGroupName
}
}
Expand Down
5 changes: 3 additions & 2 deletions deploy/SkiResort.Deploy.deployproj
Expand Up @@ -27,7 +27,7 @@
<ItemGroup>
<Content Include="Scripts\TestWebApps.ps1" />
<Content Include="Scripts\StopStreamJob.ps1" />
<Content Include="Scripts\RestartStreamJob.ps1" />
<Content Include="Scripts\StartStreamJob.ps1" />
<Content Include="WebApp\SkiResort.zip">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
Expand All @@ -42,7 +42,8 @@
<Content Include="Scripts\ConfigureStorage.ps1" />
<Content Include="Scripts\PublishASPNET.ps1" />
<Content Include="Scripts\default-publish.ps1" />
<None Include="WebApp\SkiResortAdvanced.zip" />
<Content Include="WebApp\SkiResortAdvanced.zip" />
<Content Include="Scripts\DocumentDB.ps1" />
</ItemGroup>
<Target Name="GetReferenceAssemblyPaths" />
</Project>

0 comments on commit d5ad438

Please sign in to comment.