@ -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"); |
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.xamarinmssql"> |
||||||
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" /> |
||||||
|
<application android:label="XamarinMSSQL.Android" android:theme="@style/MainTheme"></application> |
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
||||||
|
</manifest> |
@ -0,0 +1,50 @@ |
|||||||
|
Images, layout descriptions, binary blobs and string dictionaries can be included |
||||||
|
in your application as resource files. Various Android APIs are designed to |
||||||
|
operate on the resource IDs instead of dealing with images, strings or binary blobs |
||||||
|
directly. |
||||||
|
|
||||||
|
For example, a sample Android app that contains a user interface layout (main.xml), |
||||||
|
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) |
||||||
|
would keep its resources in the "Resources" directory of the application: |
||||||
|
|
||||||
|
Resources/ |
||||||
|
drawable-hdpi/ |
||||||
|
icon.png |
||||||
|
|
||||||
|
drawable-ldpi/ |
||||||
|
icon.png |
||||||
|
|
||||||
|
drawable-mdpi/ |
||||||
|
icon.png |
||||||
|
|
||||||
|
layout/ |
||||||
|
main.xml |
||||||
|
|
||||||
|
values/ |
||||||
|
strings.xml |
||||||
|
|
||||||
|
In order to get the build system to recognize Android resources, set the build action to |
||||||
|
"AndroidResource". The native Android APIs do not operate directly with filenames, but |
||||||
|
instead operate on resource IDs. When you compile an Android application that uses resources, |
||||||
|
the build system will package the resources for distribution and generate a class called |
||||||
|
"Resource" that contains the tokens for each one of the resources included. For example, |
||||||
|
for the above Resources layout, this is what the Resource class would expose: |
||||||
|
|
||||||
|
public class Resource { |
||||||
|
public class drawable { |
||||||
|
public const int icon = 0x123; |
||||||
|
} |
||||||
|
|
||||||
|
public class layout { |
||||||
|
public const int main = 0x456; |
||||||
|
} |
||||||
|
|
||||||
|
public class strings { |
||||||
|
public const int first_string = 0xabc; |
||||||
|
public const int second_string = 0xbcd; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main |
||||||
|
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first |
||||||
|
string in the dictionary file values/strings.xml. |
After Width: | Height: | Size: 518 B |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 21 KiB |
@ -0,0 +1,5 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<background android:drawable="@color/launcher_background" /> |
||||||
|
<foreground android:drawable="@mipmap/launcher_foreground" /> |
||||||
|
</adaptive-icon> |
@ -0,0 +1,5 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<background android:drawable="@color/launcher_background" /> |
||||||
|
<foreground android:drawable="@mipmap/launcher_foreground" /> |
||||||
|
</adaptive-icon> |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 51 KiB |
@ -0,0 +1,7 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<color name="launcher_background">#FFFFFF</color> |
||||||
|
<color name="colorPrimary">#3F51B5</color> |
||||||
|
<color name="colorPrimaryDark">#303F9F</color> |
||||||
|
<color name="colorAccent">#FF4081</color> |
||||||
|
</resources> |
@ -0,0 +1,28 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||||
|
<resources> |
||||||
|
|
||||||
|
<style name="MainTheme" parent="MainTheme.Base"> |
||||||
|
<!-- As of Xamarin.Forms 4.6 the theme has moved into the Forms binary --> |
||||||
|
<!-- If you want to override anything you can do that here. --> |
||||||
|
<!-- Underneath are a couple of entries to get you started. --> |
||||||
|
|
||||||
|
<!-- Set theme colors from https://aka.ms/material-colors --> |
||||||
|
<!-- colorPrimary is used for the default action bar background --> |
||||||
|
<!--<item name="colorPrimary">#2196F3</item>--> |
||||||
|
<!-- colorPrimaryDark is used for the status bar --> |
||||||
|
<!--<item name="colorPrimaryDark">#1976D2</item>--> |
||||||
|
<!-- colorAccent is used as the default value for colorControlActivated |
||||||
|
which is used to tint widgets --> |
||||||
|
<!--<item name="colorAccent">#FF4081</item>--> |
||||||
|
</style> |
||||||
|
|
||||||
|
<style name="MyTheme" parent="android:style/Theme.Material.Light.DarkActionBar"> |
||||||
|
<item name="android:colorPressedHighlight">@color/ListViewSelected</item> |
||||||
|
<item name="android:colorLongPressedHighlight">@color/ListViewHighlighted</item> |
||||||
|
<item name="android:colorFocusedHighlight">@color/ListViewSelected</item> |
||||||
|
<item name="android:colorActivatedHighlight">@color/ListViewSelected</item> |
||||||
|
<item name="android:activatedBackgroundIndicator">@color/ListViewSelected</item> |
||||||
|
</style> |
||||||
|
<color name="ListViewSelected">@android:color/darker_gray</color> |
||||||
|
<color name="ListViewHighlighted">#E39696</color> |
||||||
|
</resources> |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 392 B |
After Width: | Height: | Size: 836 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,31 @@ |
|||||||
|
<!-- |
||||||
|
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most |
||||||
|
developers. However, you can modify these parameters to modify the behavior of the .NET Native |
||||||
|
optimizer. |
||||||
|
|
||||||
|
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919 |
||||||
|
|
||||||
|
To fully enable reflection for App1.MyClass and all of its public/private members |
||||||
|
<Type Name="App1.MyClass" Dynamic="Required All"/> |
||||||
|
|
||||||
|
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32 |
||||||
|
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" /> |
||||||
|
|
||||||
|
Using the Namespace directive to apply reflection policy to all the types in a particular namespace |
||||||
|
<Namespace Name="DataClasses.ViewModels" Seralize="All" /> |
||||||
|
--> |
||||||
|
|
||||||
|
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> |
||||||
|
<Application> |
||||||
|
<!-- |
||||||
|
An Assembly element with Name="*Application*" applies to all assemblies in |
||||||
|
the application package. The asterisks are not wildcards. |
||||||
|
--> |
||||||
|
<Assembly Name="*Application*" Dynamic="Required All" /> |
||||||
|
|
||||||
|
|
||||||
|
<!-- Add your application specific runtime directives here. --> |
||||||
|
|
||||||
|
|
||||||
|
</Application> |
||||||
|
</Directives> |
After Width: | Height: | Size: 518 B |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 21 KiB |
@ -0,0 +1,48 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Shell xmlns="http://xamarin.com/schemas/2014/forms" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
||||||
|
xmlns:local="clr-namespace:XamarinMSSQL.Views" |
||||||
|
Title="XamarinMSSQL" |
||||||
|
x:Class="XamarinMSSQL.AppShell"> |
||||||
|
|
||||||
|
<!-- |
||||||
|
The overall app visual hierarchy is defined here, along with navigation. |
||||||
|
|
||||||
|
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/ |
||||||
|
--> |
||||||
|
|
||||||
|
<Shell.Resources> |
||||||
|
<ResourceDictionary> |
||||||
|
<Style x:Key="BaseStyle" TargetType="Element"> |
||||||
|
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" /> |
||||||
|
<Setter Property="Shell.ForegroundColor" Value="White" /> |
||||||
|
<Setter Property="Shell.TitleColor" Value="White" /> |
||||||
|
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" /> |
||||||
|
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" /> |
||||||
|
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource Primary}" /> |
||||||
|
<Setter Property="Shell.TabBarForegroundColor" Value="White"/> |
||||||
|
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/> |
||||||
|
<Setter Property="Shell.TabBarTitleColor" Value="White"/> |
||||||
|
</Style> |
||||||
|
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" /> |
||||||
|
<Style TargetType="FlyoutItem" BasedOn="{StaticResource BaseStyle}" /> |
||||||
|
</ResourceDictionary> |
||||||
|
</Shell.Resources> |
||||||
|
|
||||||
|
<TabBar> |
||||||
|
<!--<ShellContent Title="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" />--> |
||||||
|
<ShellContent Title="MSSQL" Icon="icon_monster.png" ContentTemplate="{DataTemplate local:MonsterPage}"/> |
||||||
|
<ShellContent Title="MSSQL" Icon="icon_sql.png" ContentTemplate="{DataTemplate local:SqlPage}"/> |
||||||
|
<!--<ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />--> |
||||||
|
</TabBar> |
||||||
|
|
||||||
|
<!-- |
||||||
|
If you would like to navigate to this content you can do so by calling |
||||||
|
await Shell.Current.GoToAsync("//LoginPage"); |
||||||
|
--> |
||||||
|
<TabBar> |
||||||
|
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate local:LoginPage}" /> |
||||||
|
</TabBar> |
||||||
|
|
||||||
|
|
||||||
|
</Shell> |
@ -0,0 +1,3 @@ |
|||||||
|
using Xamarin.Forms.Xaml; |
||||||
|
|
||||||
|
[assembly: XamlCompilation(XamlCompilationOptions.Compile)] |
@ -0,0 +1,34 @@ |
|||||||
|
Welcome to Xamarin.Forms! Here are some tips to get started building your app. |
||||||
|
|
||||||
|
Building Your App UI |
||||||
|
-------------------- |
||||||
|
|
||||||
|
XAML Hot Reload quickly applies UI changes as you make them to your running app. |
||||||
|
This is the most productive way to preview and iteratively create your UI. |
||||||
|
|
||||||
|
Try it out: |
||||||
|
|
||||||
|
1. Run the app by clicking the Start Debugging (play) button in the above toolbar. |
||||||
|
2. Open <MainProject>\Views\AboutPage.xaml. |
||||||
|
Don't stop the app - keep it running while making changes. |
||||||
|
3. Change something! Hint: change the Accent color on line 14 from "#96d1ff" to "Pink". |
||||||
|
4. Watch the About screen update on the device or emulator, with the logo background now pink. |
||||||
|
|
||||||
|
Keep going and try more changes! |
||||||
|
|
||||||
|
QuickStart Guide |
||||||
|
---------------- |
||||||
|
|
||||||
|
Learn more of the fundamentals for building apps with Xamarin here: https://aka.ms/xamarin-quickstart |
||||||
|
|
||||||
|
Your App Shell |
||||||
|
-------------- |
||||||
|
|
||||||
|
This template uses Shell, an app container that reduces the complexity of your apps by providing fundamental features including: |
||||||
|
|
||||||
|
- A single place to describe the app's visual hierarchy. |
||||||
|
- Common navigation such as a flyout menu and tabs. |
||||||
|
- A URI-based navigation scheme that permits navigation to any page in the application. |
||||||
|
- An integrated search handler. |
||||||
|
|
||||||
|
Open AppShell.xaml to begin exploring. To learn more about Shell visit: https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/introduction |