Skip to content

Commit 7264999

Browse files
author
AjitAk
committed
Added Android and iOS GenerateDataFormItemsForDataObject projects
1 parent 6527796 commit 7264999

29 files changed

+5381
-473
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2009
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateDataFormItemsForDataObject", "GenerateDataFormItemsForDataObject\GenerateDataFormItemsForDataObject.csproj", "{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {6ADE5182-CA68-47C9-8CF7-FE158E1E32C4}
26+
EndGlobalSection
27+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with you package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{59CA0F22-ACA2-4E46-BDE6-7D1DED807B05}</ProjectGuid>
9+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<OutputType>Library</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<RootNamespace>GenerateDataFormItemsForDataObject</RootNamespace>
13+
<AssemblyName>GenerateDataFormItemsForDataObject</AssemblyName>
14+
<FileAlignment>512</FileAlignment>
15+
<AndroidApplication>True</AndroidApplication>
16+
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
17+
<AndroidResgenClass>Resource</AndroidResgenClass>
18+
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
19+
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
20+
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
21+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
22+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
23+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
26+
<DebugSymbols>True</DebugSymbols>
27+
<DebugType>Full</DebugType>
28+
<Optimize>False</Optimize>
29+
<OutputPath>bin\Debug\</OutputPath>
30+
<DefineConstants>DEBUG;TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
34+
<AndroidLinkMode>None</AndroidLinkMode>
35+
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
36+
</PropertyGroup>
37+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
38+
<DebugSymbols>True</DebugSymbols>
39+
<DebugType>PdbOnly</DebugType>
40+
<Optimize>True</Optimize>
41+
<OutputPath>bin\Release\</OutputPath>
42+
<DefineConstants>TRACE</DefineConstants>
43+
<ErrorReport>prompt</ErrorReport>
44+
<WarningLevel>4</WarningLevel>
45+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
46+
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
47+
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
48+
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
49+
</PropertyGroup>
50+
<ItemGroup>
51+
<Reference Include="Syncfusion.Licensing, Version=16.4.0.44, Culture=neutral, processorArchitecture=MSIL">
52+
<HintPath>..\packages\Syncfusion.Licensing.16.4.0.44\lib\MonoAndroid10\Syncfusion.Licensing.dll</HintPath>
53+
</Reference>
54+
<Reference Include="Syncfusion.SfDataForm.Android, Version=16.4451.0.44, Culture=neutral, processorArchitecture=MSIL">
55+
<HintPath>..\packages\Syncfusion.Xamarin.SfDataForm.Android.16.4.0.44\lib\MonoAndroid10\Syncfusion.SfDataForm.Android.dll</HintPath>
56+
</Reference>
57+
<Reference Include="Syncfusion.SfNumericTextBox.Android, Version=16.4451.0.44, Culture=neutral, processorArchitecture=MSIL">
58+
<HintPath>..\packages\Syncfusion.Xamarin.SfNumericTextBox.Android.16.4.0.44\lib\MonoAndroid10\Syncfusion.SfNumericTextBox.Android.dll</HintPath>
59+
</Reference>
60+
<Reference Include="Syncfusion.SfNumericUpDown.Android, Version=16.4451.0.44, Culture=neutral, processorArchitecture=MSIL">
61+
<HintPath>..\packages\Syncfusion.Xamarin.SfNumericUpDown.Android.16.4.0.44\lib\MonoAndroid10\Syncfusion.SfNumericUpDown.Android.dll</HintPath>
62+
</Reference>
63+
<Reference Include="System" />
64+
<Reference Include="System.Xml" />
65+
<Reference Include="System.Core" />
66+
<Reference Include="Mono.Android" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<Compile Include="MainActivity.cs" />
70+
<Compile Include="Resources\Resource.Designer.cs" />
71+
<Compile Include="Properties\AssemblyInfo.cs" />
72+
</ItemGroup>
73+
<ItemGroup>
74+
<None Include="GettingStarted.Xamarin" />
75+
<None Include="packages.config" />
76+
<None Include="Resources\AboutResources.txt" />
77+
<None Include="Properties\AndroidManifest.xml" />
78+
<None Include="Assets\AboutAssets.txt" />
79+
</ItemGroup>
80+
<ItemGroup>
81+
<AndroidResource Include="Resources\layout\Main.axml">
82+
<SubType>Designer</SubType>
83+
</AndroidResource>
84+
<AndroidResource Include="Resources\values\Strings.xml" />
85+
</ItemGroup>
86+
<ItemGroup>
87+
<Folder Include="Resources\drawable\" />
88+
<Folder Include="Resources\mipmap-hdpi\" />
89+
<Folder Include="Resources\mipmap-mdpi\" />
90+
<Folder Include="Resources\mipmap-xhdpi\" />
91+
<Folder Include="Resources\mipmap-xxhdpi\" />
92+
<Folder Include="Resources\mipmap-xxxhdpi\" />
93+
</ItemGroup>
94+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
95+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
96+
Other similar extension points exist, see Microsoft.Common.targets.
97+
<Target Name="BeforeBuild">
98+
</Target>
99+
<Target Name="AfterBuild">
100+
</Target>
101+
-->
102+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<GettingStarted>
2+
<LocalContent>GS\Android\CS\AndroidApp\GettingStarted.html</LocalContent>
3+
<EmbeddedNavigation>false</EmbeddedNavigation>
4+
</GettingStarted>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
using Android.App;
2+
using Android.Widget;
3+
using Android.OS;
4+
using Syncfusion.Android.DataForm;
5+
using System.Collections.Generic;
6+
using System.ComponentModel;
7+
using System;
8+
using System.Reflection;
9+
using Android.Content;
10+
11+
namespace GenerateDataFormItemsForDataObject
12+
{
13+
[Activity(Label = "GenerateDataFormItemsForDataObject", MainLauncher = true)]
14+
public class MainActivity : Activity
15+
{
16+
17+
//public static Context context;
18+
public static SfDataForm dataForm;
19+
20+
protected override void OnCreate(Bundle savedInstanceState)
21+
{
22+
base.OnCreate(savedInstanceState);
23+
dataForm = new SfDataForm(this);
24+
var a = new ContactsInfo();
25+
dataForm.DataObject = a;// new ContactsInfo();
26+
dataForm.ItemManager = new DataFormItemManagerExt(dataForm);
27+
// Set our view from the "main" layout resource
28+
SetContentView(dataForm);
29+
}
30+
}
31+
32+
public class DataFormItemManagerExt : DataFormItemManager
33+
{
34+
public DataFormItemManagerExt(SfDataForm dataForm) : base(dataForm)
35+
{
36+
37+
}
38+
protected override List<DataFormItemBase> GenerateDataFormItems(PropertyDescriptorCollection itemProperties, List<DataFormItemBase> dataFormItems)
39+
{
40+
var items = new List<DataFormItemBase>();
41+
foreach (PropertyDescriptor propertyInfo in itemProperties)
42+
{
43+
DataFormItem dataFormItem;
44+
if (propertyInfo.Name == "ContactNumber")
45+
dataFormItem = new DataFormTextItem() { Name = propertyInfo.Name, Editor = "Text", InputType = Android.Text.InputTypes.ClassNumber };
46+
else if (propertyInfo.Name == "FirstName")
47+
dataFormItem = new DataFormTextItem() { Name = propertyInfo.Name, Editor = "Text" };
48+
else
49+
dataFormItem = new DataFormTextItem() { Name = propertyInfo.Name, Editor = "Text" };
50+
items.Add(dataFormItem);
51+
}
52+
53+
return items;
54+
}
55+
56+
public override object GetValue(DataFormItem dataFormItem)
57+
{
58+
var value = MainActivity.dataForm.DataObject.GetType().GetRuntimeProperty(dataFormItem.Name).GetValue(MainActivity.dataForm.DataObject);
59+
return value;
60+
}
61+
62+
public override void SetValue(DataFormItem dataFormItem, object value)
63+
{
64+
MainActivity.dataForm.DataObject.GetType().GetRuntimeProperty(dataFormItem.Name).SetValue(MainActivity.dataForm.DataObject, value);
65+
}
66+
}
67+
public class ContactsInfo
68+
{
69+
70+
private string contactNumber = "20";
71+
private string _name = "Kyle";
72+
public string ContactNumber
73+
{
74+
get { return contactNumber; }
75+
set
76+
{
77+
contactNumber = value;
78+
this.RaisePropertyChanged("ContactNumber");
79+
}
80+
}
81+
public string Name
82+
{
83+
get { return _name; }
84+
set
85+
{
86+
_name = value;
87+
this.RaisePropertyChanged("Name");
88+
}
89+
}
90+
91+
public event PropertyChangedEventHandler PropertyChanged;
92+
93+
private void RaisePropertyChanged(String Name)
94+
{
95+
if (PropertyChanged != null)
96+
this.PropertyChanged(this, new PropertyChangedEventArgs(Name));
97+
}
98+
}
99+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="GenerateDataFormItemsForDataObject.GenerateDataFormItemsForDataObject"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<uses-sdk android:minSdkVersion="21" />
7+
<application android:allowBackup="true" android:label="@string/app_name">
8+
</application>
9+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("GenerateDataFormItemsForDataObject")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("GenerateDataFormItemsForDataObject")]
14+
[assembly: AssemblyCopyright("Copyright © 2018")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
//
26+
// You can specify all the values or you can default the Build and Revision Numbers
27+
// by using the '*' as shown below:
28+
// [assembly: AssemblyVersion("1.0.*")]
29+
[assembly: AssemblyVersion("1.0.0.0")]
30+
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Images, layout descriptions, binary blobs and string dictionaries can be included
2+
in your application as resource files. Various Android APIs are designed to
3+
operate on the resource IDs instead of dealing with images, strings or binary blobs
4+
directly.
5+
6+
For example, a sample Android app that contains a user interface layout (main.axml),
7+
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8+
would keep its resources in the "Resources" directory of the application:
9+
10+
Resources/
11+
drawable/
12+
icon.png
13+
14+
layout/
15+
main.axml
16+
17+
values/
18+
strings.xml
19+
20+
In order to get the build system to recognize Android resources, set the build action to
21+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
22+
instead operate on resource IDs. When you compile an Android application that uses resources,
23+
the build system will package the resources for distribution and generate a class called "R"
24+
(this is an Android convention) that contains the tokens for each one of the resources
25+
included. For example, for the above Resources layout, this is what the R class would expose:
26+
27+
public class R {
28+
public class drawable {
29+
public const int icon = 0x123;
30+
}
31+
32+
public class layout {
33+
public const int main = 0x456;
34+
}
35+
36+
public class strings {
37+
public const int first_string = 0xabc;
38+
public const int second_string = 0xbcd;
39+
}
40+
}
41+
42+
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43+
to reference the layout/main.axml file, or R.strings.first_string to reference the first
44+
string in the dictionary file values/strings.xml.

0 commit comments

Comments
 (0)