Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
[WeatherApp] from VS 2017 with .NET Std lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Petzold committed Mar 23, 2018
1 parent a9c0d5d commit b971084
Show file tree
Hide file tree
Showing 108 changed files with 3,487 additions and 1,675 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
185 changes: 0 additions & 185 deletions Weather/WeatherApp/WeatherApp.iOS/ViewController.designer.cs

This file was deleted.

19 changes: 19 additions & 0 deletions WeatherApp/WeatherApp.Android/Assets/AboutAssets.txt
Original file line number Diff line number Diff line change
@@ -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 you 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");
4 changes: 4 additions & 0 deletions WeatherApp/WeatherApp.Android/GettingStarted.Xamarin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<GettingStarted>
<LocalContent>GS\Android\CS\AndroidApp\GettingStarted.html</LocalContent>
<EmbeddedNavigation>false</EmbeddedNavigation>
</GettingStarted>
43 changes: 43 additions & 0 deletions WeatherApp/WeatherApp.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using Android.App;
using Android.Widget;
using Android.OS;

namespace WeatherApp.Android
{
[Activity(Label = "WeatherApp.Android", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);

Button button = FindViewById<Button>(Resource.Id.weatherBtn);

button.Click += Button_Click;
}

private async void Button_Click(object sender, EventArgs e)
{
EditText zipCodeEntry = FindViewById<EditText>(Resource.Id.zipCodeEntry);

if (!String.IsNullOrEmpty(zipCodeEntry.Text))
{
Weather weather = await Core.GetWeather(zipCodeEntry.Text);
if (weather != null)
{
FindViewById<TextView>(Resource.Id.locationText).Text = weather.Title;
FindViewById<TextView>(Resource.Id.tempText).Text = weather.Temperature;
FindViewById<TextView>(Resource.Id.windText).Text = weather.Wind;
FindViewById<TextView>(Resource.Id.visibilityText).Text = weather.Visibility;
FindViewById<TextView>(Resource.Id.humidityText).Text = weather.Humidity;
FindViewById<TextView>(Resource.Id.sunriseText).Text = weather.Sunrise;
FindViewById<TextView>(Resource.Id.sunsetText).Text = weather.Sunset;
}
}
}
}
}
9 changes: 9 additions & 0 deletions WeatherApp/WeatherApp.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="WeatherApp.Android.WeatherApp.Android"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="21" />
<application android:allowBackup="true" android:label="@string/app_name">
</application>
</manifest>
30 changes: 30 additions & 0 deletions WeatherApp/WeatherApp.Android/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;

// 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("WeatherApp.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WeatherApp.Android")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

// 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")]
Loading

0 comments on commit b971084

Please sign in to comment.