├── .gitignore ├── Inventory.Android ├── Assets │ └── AboutAssets.txt ├── DataWedgeReceiver.cs ├── FileAccessHelper.cs ├── Inventory.Android.csproj ├── MainActivity.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── layout │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ ├── mipmap-anydpi-v26 │ │ ├── icon.xml │ │ └── icon_round.xml │ ├── mipmap-hdpi │ │ ├── Icon.png │ │ └── launcher_foreground.png │ ├── mipmap-mdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xhdpi │ │ ├── Icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxhdpi │ │ ├── Icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxxhdpi │ │ ├── Icon.png │ │ └── launcher_foreground.png │ └── values │ │ ├── colors.xml │ │ └── styles.xml └── Scanner_Android.cs ├── Inventory.iOS ├── AppDelegate.cs ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ └── Icon87.png ├── Entitlements.plist ├── FileAccessHelper.cs ├── Info.plist ├── Inventory.iOS.csproj ├── Main.cs ├── Properties │ └── AssemblyInfo.cs └── Resources │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ ├── Default.png │ ├── Default@2x.png │ └── LaunchScreen.storyboard ├── Inventory.sln ├── Inventory ├── App.xaml ├── App.xaml.cs ├── Interfaces │ ├── IScanner.cs │ └── IScannerConfig.cs ├── Inventory.csproj ├── Models │ ├── Barcode.cs │ ├── Item.cs │ ├── StatusEventArgs.cs │ └── ZebraScannerConfig.cs ├── PageModel │ ├── ItemListPageModel.cs │ └── ItemPageModel.cs ├── Pages │ ├── ItemListPage.xaml │ ├── ItemListPage.xaml.cs │ ├── ItemPage.xaml │ └── ItemPage.xaml.cs └── Repository.cs ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Autosave files 2 | *~ 3 | 4 | # build 5 | [Oo]bj/ 6 | [Bb]in/ 7 | packages/ 8 | TestResults/ 9 | 10 | # globs 11 | Makefile.in 12 | *.DS_Store 13 | *.sln.cache 14 | *.suo 15 | *.cache 16 | *.pidb 17 | *.userprefs 18 | *.usertasks 19 | config.log 20 | config.make 21 | config.status 22 | aclocal.m4 23 | install-sh 24 | autom4te.cache/ 25 | *.user 26 | *.tar.gz 27 | tarballs/ 28 | test-results/ 29 | Thumbs.db 30 | .vs/ 31 | 32 | # Mac bundle stuff 33 | *.dmg 34 | *.app 35 | 36 | # resharper 37 | *_Resharper.* 38 | *.Resharper 39 | 40 | # dotCover 41 | *.dotCover 42 | -------------------------------------------------------------------------------- /Inventory.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 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"); 20 | -------------------------------------------------------------------------------- /Inventory.Android/DataWedgeReceiver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Content; 3 | 4 | namespace Inventory.Droid 5 | { 6 | [BroadcastReceiver] 7 | public class DataWedgeReceiver : BroadcastReceiver 8 | { 9 | // This intent string contains the source of the data as a string 10 | private static string SOURCE_TAG = "com.motorolasolutions.emdk.datawedge.source"; 11 | // This intent string contains the barcode symbology as a string 12 | private static string LABEL_TYPE_TAG = "com.motorolasolutions.emdk.datawedge.label_type"; 13 | // This intent string contains the captured data as a string 14 | // (in the case of MSR this data string contains a concatenation of the track data) 15 | private static string DATA_STRING_TAG = "com.motorolasolutions.emdk.datawedge.data_string"; 16 | // Intent Action for our operation 17 | public static string IntentAction = "barcodescanner.RECVR"; 18 | public static string IntentCategory = "android.intent.category.DEFAULT"; 19 | 20 | public event EventHandler scanDataReceived; 21 | 22 | public override void OnReceive(Context context, Intent i) 23 | { 24 | // check the intent action is for us 25 | if (i.Action.Equals(IntentAction)) 26 | { 27 | // define a string that will hold our output 28 | String Out = ""; 29 | String sLabelType = ""; 30 | // get the source of the data 31 | String source = i.GetStringExtra(SOURCE_TAG); 32 | // save it to use later 33 | if (source == null) 34 | source = "scanner"; 35 | // get the data from the intent 36 | String data = i.GetStringExtra(DATA_STRING_TAG); 37 | // let's define a variable for the data length 38 | int data_len = 0; 39 | // and set it to the length of the data 40 | if (data != null) 41 | data_len = data.Length; 42 | // check if the data has come from the barcode scanner 43 | if (source.Equals("scanner")) 44 | { 45 | // check if there is anything in the data 46 | if (data != null && data.Length > 0) 47 | { 48 | // we have some data, so let's get it's symbology 49 | sLabelType = i.GetStringExtra(LABEL_TYPE_TAG); 50 | // check if the string is empty 51 | if (sLabelType != null && sLabelType.Length > 0) 52 | { 53 | // format of the label type string is LABEL-TYPE-SYMBOLOGY 54 | // so let's skip the LABEL-TYPE- portion to get just the symbology 55 | sLabelType = sLabelType.Substring(11); 56 | } 57 | else 58 | { 59 | // the string was empty so let's set it to "Unknown" 60 | sLabelType = "Unknown"; 61 | } 62 | 63 | // let's construct the beginning of our output string 64 | Out = data.ToString() + "\r\n"; 65 | } 66 | } 67 | 68 | if (scanDataReceived != null) 69 | { 70 | scanDataReceived(this, new StatusEventArgs(Out, sLabelType)); 71 | } 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Inventory.Android/FileAccessHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Inventory.Droid 3 | { 4 | public class FileAccessHelper 5 | { 6 | public static string GetLocalFilePath(string filename) 7 | { 8 | // Use the SpecialFolder enum to get the Personal folder on the Android file system. 9 | // Storing the database here is a best practice. 10 | string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); 11 | return System.IO.Path.Combine(path, filename); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Inventory.Android/Inventory.Android.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {400CF03D-7717-486E-A4E3-34975F4D11DF} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df} 9 | Library 10 | Inventory.Droid 11 | Inventory.Android 12 | True 13 | Resources\Resource.designer.cs 14 | Resource 15 | Properties\AndroidManifest.xml 16 | Resources 17 | Assets 18 | false 19 | v8.1 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\Debug 28 | DEBUG; 29 | prompt 30 | 4 31 | None 32 | 33 | 34 | true 35 | pdbonly 36 | true 37 | bin\Release 38 | prompt 39 | 4 40 | true 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | {6DFACD23-1447-4638-AADA-379640FC6FFA} 99 | Inventory 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /Inventory.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content.PM; 5 | using Android.OS; 6 | using FreshMvvm; 7 | 8 | namespace Inventory.Droid 9 | { 10 | [Activity(Label = "Inventory", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 11 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 12 | { 13 | private IScanner _scanner = null; 14 | 15 | protected override void OnCreate(Bundle bundle) 16 | { 17 | TabLayoutResource = Resource.Layout.Tabbar; 18 | ToolbarResource = Resource.Layout.Toolbar; 19 | 20 | base.OnCreate(bundle); 21 | 22 | global::Xamarin.Forms.Forms.Init(this, bundle); 23 | 24 | var repository = new Repository(FileAccessHelper.GetLocalFilePath("items.db3")); 25 | FreshIOC.Container.Register(repository); 26 | 27 | _scanner = new Scanner_Android(); 28 | FreshIOC.Container.Register(_scanner); 29 | 30 | LoadApplication(new App()); 31 | } 32 | 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Inventory.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Inventory.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 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("Inventory.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Inventory.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 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")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 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.xml), 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-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-hdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-hdpi/Icon.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-xhdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-xhdpi/Icon.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-xxhdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-xxhdpi/Icon.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-xxxhdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-xxxhdpi/Icon.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Inventory.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | -------------------------------------------------------------------------------- /Inventory.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 24 | 27 | -------------------------------------------------------------------------------- /Inventory.Android/Scanner_Android.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.App; 3 | using Android.Content; 4 | using Android.OS; 5 | 6 | namespace Inventory.Droid 7 | { 8 | public class Scanner_Android : IScanner 9 | { 10 | private Context _context = null; 11 | private bool _bRegistered = false; 12 | private DataWedgeReceiver _broadcastReceiver = null; 13 | private static string ACTION_DATAWEDGE_FROM_6_2 = "com.symbol.datawedge.api.ACTION"; 14 | private static string EXTRA_CREATE_PROFILE = "com.symbol.datawedge.api.CREATE_PROFILE"; 15 | private static string EXTRA_SET_CONFIG = "com.symbol.datawedge.api.SET_CONFIG"; 16 | private static string EXTRA_PROFILE_NAME = "Inventory DEMO"; 17 | 18 | public Scanner_Android() 19 | { 20 | _context = Application.Context; 21 | 22 | _broadcastReceiver = new DataWedgeReceiver(); 23 | 24 | _broadcastReceiver.scanDataReceived += (s, scanData) => 25 | { 26 | OnScanDataCollected?.Invoke(this, scanData); 27 | }; 28 | 29 | CreateProfile(); 30 | } 31 | 32 | public event EventHandler OnScanDataCollected; 33 | public event EventHandler OnStatusChanged; 34 | 35 | 36 | public void Disable() 37 | { 38 | if ((null != _broadcastReceiver) && (null != _context) && _bRegistered) 39 | { 40 | // Unregister the broadcast receiver 41 | _context.UnregisterReceiver(_broadcastReceiver); 42 | _bRegistered = false; 43 | } 44 | 45 | DisableProfile(); 46 | } 47 | 48 | public void Enable() 49 | { 50 | _context = Application.Context; 51 | 52 | if ((null != _broadcastReceiver) && (null != _context)) 53 | { 54 | // Register the broadcast receiver 55 | IntentFilter filter = new IntentFilter(DataWedgeReceiver.IntentAction); 56 | filter.AddCategory(DataWedgeReceiver.IntentCategory); 57 | _context.RegisterReceiver(_broadcastReceiver, filter); 58 | _bRegistered = true; 59 | } 60 | 61 | EnableProfile(); 62 | } 63 | 64 | public void Read() 65 | { 66 | // We can use this to activate a Soft triggered barcode scanning decoding 67 | throw new NotImplementedException(); 68 | } 69 | 70 | public void SetConfig(IScannerConfig a_config) 71 | { 72 | 73 | ZebraScannerConfig config = (ZebraScannerConfig)a_config; 74 | 75 | Bundle profileConfig = new Bundle(); 76 | profileConfig.PutString("PROFILE_NAME", EXTRA_PROFILE_NAME); 77 | profileConfig.PutString("PROFILE_ENABLED", _bRegistered ? "true" : "false"); // Seems these are all strings 78 | profileConfig.PutString("CONFIG_MODE", "UPDATE"); 79 | Bundle barcodeConfig = new Bundle(); 80 | barcodeConfig.PutString("PLUGIN_NAME", "BARCODE"); 81 | barcodeConfig.PutString("RESET_CONFIG", "false"); // This is the default but never hurts to specify 82 | Bundle barcodeProps = new Bundle(); 83 | barcodeProps.PutString("scanner_input_enabled", "true"); 84 | barcodeProps.PutString("scanner_selection", "auto"); // Could also specify a number here, the id returned from ENUMERATE_SCANNERS. 85 | // Do NOT use "Auto" here (with a capital 'A'), it must be lower case. 86 | barcodeProps.PutString("decoder_ean8", config.IsEAN8 ? "true" : "false"); 87 | barcodeProps.PutString("decoder_ean13", config.IsEAN13 ? "true" : "false"); 88 | barcodeProps.PutString("decoder_code39", config.IsCode39 ? "true" : "false"); 89 | barcodeProps.PutString("decoder_code128", config.IsCode128 ? "true" : "false"); 90 | barcodeProps.PutString("decoder_upca", config.IsUPCA ? "true" : "false"); 91 | barcodeProps.PutString("decoder_upce0", config.IsUPCE0 ? "true" : "false"); 92 | barcodeProps.PutString("decoder_upce1", config.IsUPCE1 ? "true" : "false"); 93 | barcodeProps.PutString("decoder_d2of5", config.IsD2of5 ? "true" : "false"); 94 | barcodeProps.PutString("decoder_i2of5", config.IsI2of5 ? "true" : "false"); 95 | barcodeProps.PutString("decoder_aztec", config.IsAztec ? "true" : "false"); 96 | barcodeProps.PutString("decoder_pdf417", config.IsPDF417 ? "true" : "false"); 97 | barcodeProps.PutString("decoder_qrcode", config.IsQRCode ? "true" : "false"); 98 | 99 | barcodeConfig.PutBundle("PARAM_LIST", barcodeProps); 100 | profileConfig.PutBundle("PLUGIN_CONFIG", barcodeConfig); 101 | Bundle appConfig = new Bundle(); 102 | appConfig.PutString("PACKAGE_NAME", Android.App.Application.Context.PackageName); // Associate the profile with this app 103 | appConfig.PutStringArray("ACTIVITY_LIST", new String[] { "*" }); 104 | profileConfig.PutParcelableArray("APP_LIST", new Bundle[] { appConfig }); 105 | SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_SET_CONFIG, profileConfig); 106 | 107 | } 108 | 109 | private void EnableProfile() 110 | { 111 | // Now configure that created profile to apply to our application 112 | Bundle profileConfig = new Bundle(); 113 | profileConfig.PutString("PROFILE_NAME", EXTRA_PROFILE_NAME); 114 | profileConfig.PutString("PROFILE_ENABLED", "true"); // Seems these are all strings 115 | profileConfig.PutString("CONFIG_MODE", "UPDATE"); 116 | SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_SET_CONFIG, profileConfig); 117 | } 118 | 119 | private void DisableProfile() 120 | { 121 | // Now configure that created profile to apply to our application 122 | Bundle profileConfig = new Bundle(); 123 | profileConfig.PutString("PROFILE_NAME", EXTRA_PROFILE_NAME); 124 | profileConfig.PutString("PROFILE_ENABLED", "false"); // Seems these are all strings 125 | profileConfig.PutString("CONFIG_MODE", "UPDATE"); 126 | SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_SET_CONFIG, profileConfig); 127 | } 128 | 129 | private void CreateProfile() 130 | { 131 | String profileName = EXTRA_PROFILE_NAME; 132 | SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_CREATE_PROFILE, profileName); 133 | 134 | // Now configure that created profile to apply to our application 135 | Bundle profileConfig = new Bundle(); 136 | profileConfig.PutString("PROFILE_NAME", EXTRA_PROFILE_NAME); 137 | profileConfig.PutString("PROFILE_ENABLED", "true"); // Seems these are all strings 138 | profileConfig.PutString("CONFIG_MODE", "UPDATE"); 139 | Bundle barcodeConfig = new Bundle(); 140 | barcodeConfig.PutString("PLUGIN_NAME", "BARCODE"); 141 | barcodeConfig.PutString("RESET_CONFIG", "true"); // This is the default but never hurts to specify 142 | Bundle barcodeProps = new Bundle(); 143 | barcodeConfig.PutBundle("PARAM_LIST", barcodeProps); 144 | profileConfig.PutBundle("PLUGIN_CONFIG", barcodeConfig); 145 | Bundle appConfig = new Bundle(); 146 | appConfig.PutString("PACKAGE_NAME", Android.App.Application.Context.PackageName); // Associate the profile with this app 147 | appConfig.PutStringArray("ACTIVITY_LIST", new String[] { "*" }); 148 | profileConfig.PutParcelableArray("APP_LIST", new Bundle[] { appConfig }); 149 | SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_SET_CONFIG, profileConfig); 150 | // You can only configure one plugin at a time, we have done the barcode input, now do the intent output 151 | profileConfig.Remove("PLUGIN_CONFIG"); 152 | Bundle intentConfig = new Bundle(); 153 | intentConfig.PutString("PLUGIN_NAME", "INTENT"); 154 | intentConfig.PutString("RESET_CONFIG", "true"); 155 | Bundle intentProps = new Bundle(); 156 | intentProps.PutString("intent_output_enabled", "true"); 157 | intentProps.PutString("intent_action", DataWedgeReceiver.IntentAction); 158 | intentProps.PutString("intent_delivery", "2"); 159 | intentConfig.PutBundle("PARAM_LIST", intentProps); 160 | profileConfig.PutBundle("PLUGIN_CONFIG", intentConfig); 161 | SendDataWedgeIntentWithExtra(ACTION_DATAWEDGE_FROM_6_2, EXTRA_SET_CONFIG, profileConfig); 162 | } 163 | 164 | private void SendDataWedgeIntentWithExtra(String action, String extraKey, Bundle extras) 165 | { 166 | Intent dwIntent = new Intent(); 167 | dwIntent.SetAction(action); 168 | dwIntent.PutExtra(extraKey, extras); 169 | _context.SendBroadcast(dwIntent); 170 | } 171 | 172 | private void SendDataWedgeIntentWithExtra(String action, String extraKey, String extraValue) 173 | { 174 | Intent dwIntent = new Intent(); 175 | dwIntent.SetAction(action); 176 | dwIntent.PutExtra(extraKey, extraValue); 177 | _context.SendBroadcast(dwIntent); 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /Inventory.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using FreshMvvm; 7 | using UIKit; 8 | 9 | namespace Inventory.iOS 10 | { 11 | // The UIApplicationDelegate for the application. This class is responsible for launching the 12 | // User Interface of the application, as well as listening (and optionally responding) to 13 | // application events from iOS. 14 | [Register("AppDelegate")] 15 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 16 | { 17 | // 18 | // This method is invoked when the application has loaded and is ready to run. In this 19 | // method you should instantiate the window, load the UI into it and then make the window 20 | // visible. 21 | // 22 | // You have 17 seconds to return from this method, or iOS will terminate your application. 23 | // 24 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 25 | { 26 | global::Xamarin.Forms.Forms.Init(); 27 | 28 | var repository = new Repository(FileAccessHelper.GetLocalFilePath("items.db3")); 29 | FreshIOC.Container.Register(repository); 30 | 31 | LoadApplication(new App()); 32 | 33 | return base.FinishedLaunching(app, options); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /Inventory.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Inventory.iOS/FileAccessHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Inventory.iOS 3 | { 4 | public class FileAccessHelper 5 | { 6 | public static string GetLocalFilePath(string filename) 7 | { 8 | // Use the SpecialFolder enum to get the Personal folder on the iOS file system. 9 | // Then get or create the Library folder within this personal folder. 10 | // Storing the database here is a best practice. 11 | var docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 12 | var libFolder = System.IO.Path.Combine(docFolder, "..", "Library"); 13 | 14 | if (!System.IO.Directory.Exists(libFolder)) 15 | { 16 | System.IO.Directory.CreateDirectory(libFolder); 17 | } 18 | 19 | return System.IO.Path.Combine(libFolder, filename); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Inventory.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | Inventory 27 | CFBundleIdentifier 28 | com.pietromaggi.sample.Inventory 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | Inventory 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | 38 | 39 | -------------------------------------------------------------------------------- /Inventory.iOS/Inventory.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {53ABBD9E-A487-4130-9B42-F073470B5D5C} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {6143fdea-f3c2-4a09-aafa-6e230626515e} 11 | Exe 12 | Inventory.iOS 13 | Resources 14 | Inventory.iOS 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\iPhoneSimulator\Debug 23 | DEBUG 24 | prompt 25 | 4 26 | false 27 | x86_64 28 | None 29 | true 30 | 31 | 32 | none 33 | true 34 | bin\iPhoneSimulator\Release 35 | prompt 36 | 4 37 | None 38 | x86_64 39 | false 40 | 41 | 42 | true 43 | full 44 | false 45 | bin\iPhone\Debug 46 | DEBUG 47 | prompt 48 | 4 49 | false 50 | ARM64 51 | iPhone Developer 52 | true 53 | Entitlements.plist 54 | 55 | 56 | none 57 | true 58 | bin\iPhone\Release 59 | prompt 60 | 4 61 | ARM64 62 | false 63 | iPhone Developer 64 | Entitlements.plist 65 | 66 | 67 | none 68 | True 69 | bin\iPhone\Ad-Hoc 70 | prompt 71 | 4 72 | False 73 | ARM64 74 | True 75 | Automatic:AdHoc 76 | iPhone Distribution 77 | Entitlements.plist 78 | 79 | 80 | none 81 | True 82 | bin\iPhone\AppStore 83 | prompt 84 | 4 85 | False 86 | ARM64 87 | Automatic:AppStore 88 | iPhone Distribution 89 | Entitlements.plist 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | false 103 | 104 | 105 | false 106 | 107 | 108 | false 109 | 110 | 111 | false 112 | 113 | 114 | false 115 | 116 | 117 | false 118 | 119 | 120 | false 121 | 122 | 123 | false 124 | 125 | 126 | false 127 | 128 | 129 | false 130 | 131 | 132 | false 133 | 134 | 135 | false 136 | 137 | 138 | false 139 | 140 | 141 | false 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | {6DFACD23-1447-4638-AADA-379640FC6FFA} 157 | Inventory 158 | 159 | 160 | -------------------------------------------------------------------------------- /Inventory.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace Inventory.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Inventory.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Inventory.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Inventory.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Inventory.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /Inventory.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /Inventory.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /Inventory.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Resources/Default.png -------------------------------------------------------------------------------- /Inventory.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZebraDevs/Inventory/0ab832b48e6f6dba7daf8b7b8fd03be3ac8b96f5/Inventory.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /Inventory.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Inventory.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inventory.Android", "Inventory.Android\Inventory.Android.csproj", "{400CF03D-7717-486E-A4E3-34975F4D11DF}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inventory.iOS", "Inventory.iOS\Inventory.iOS.csproj", "{53ABBD9E-A487-4130-9B42-F073470B5D5C}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inventory", "Inventory\Inventory.csproj", "{6DFACD23-1447-4638-AADA-379640FC6FFA}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 15 | Release|iPhoneSimulator = Release|iPhoneSimulator 16 | Debug|iPhone = Debug|iPhone 17 | Release|iPhone = Release|iPhone 18 | Ad-Hoc|iPhone = Ad-Hoc|iPhone 19 | AppStore|iPhone = AppStore|iPhone 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 27 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 28 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 29 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 30 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Debug|iPhone.ActiveCfg = Debug|Any CPU 31 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Debug|iPhone.Build.0 = Debug|Any CPU 32 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Release|iPhone.ActiveCfg = Release|Any CPU 33 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Release|iPhone.Build.0 = Release|Any CPU 34 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU 35 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU 36 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU 37 | {400CF03D-7717-486E-A4E3-34975F4D11DF}.AppStore|iPhone.Build.0 = Debug|Any CPU 38 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator 39 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator 40 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator 41 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Release|Any CPU.Build.0 = Release|iPhoneSimulator 42 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 43 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 44 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 45 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 46 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Debug|iPhone.ActiveCfg = Debug|iPhone 47 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Debug|iPhone.Build.0 = Debug|iPhone 48 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Release|iPhone.ActiveCfg = Release|iPhone 49 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Release|iPhone.Build.0 = Release|iPhone 50 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone 51 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone 52 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.AppStore|iPhone.ActiveCfg = AppStore|iPhone 53 | {53ABBD9E-A487-4130-9B42-F073470B5D5C}.AppStore|iPhone.Build.0 = AppStore|iPhone 54 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Release|Any CPU.Build.0 = Release|Any CPU 58 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 59 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 60 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 61 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 62 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Debug|iPhone.ActiveCfg = Debug|Any CPU 63 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Debug|iPhone.Build.0 = Debug|Any CPU 64 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Release|iPhone.ActiveCfg = Release|Any CPU 65 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Release|iPhone.Build.0 = Release|Any CPU 66 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU 67 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU 68 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.AppStore|iPhone.ActiveCfg = Debug|Any CPU 69 | {6DFACD23-1447-4638-AADA-379640FC6FFA}.AppStore|iPhone.Build.0 = Debug|Any CPU 70 | EndGlobalSection 71 | EndGlobal 72 | -------------------------------------------------------------------------------- /Inventory/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Inventory/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FreshMvvm; 3 | using Xamarin.Forms; 4 | using Xamarin.Forms.Xaml; 5 | 6 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] 7 | namespace Inventory 8 | { 9 | public partial class App : Application 10 | { 11 | public App() 12 | { 13 | InitializeComponent(); 14 | 15 | var page = FreshPageModelResolver.ResolvePageModel(); 16 | var navContainer = new FreshNavigationContainer(page); 17 | MainPage = navContainer; 18 | } 19 | 20 | protected override void OnStart() 21 | { 22 | // Handle when your app starts 23 | } 24 | 25 | protected override void OnSleep() 26 | { 27 | // Handle when your app sleeps 28 | } 29 | 30 | protected override void OnResume() 31 | { 32 | // Handle when your app resumes 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Inventory/Interfaces/IScanner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Inventory 3 | { 4 | /// 5 | /// This is the interface for the Scanner code. This is only implemented natively on an 6 | /// Android device so we have to use Xamarin Forms Dependency Service to implement this. 7 | /// This interface defines how we use the Scanner, a matching class needs to be implemented 8 | /// on each platform as well. The link here incldues a fulld escription of the structure. 9 | /// https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/ 10 | /// 11 | public interface IScanner 12 | { 13 | event EventHandler OnScanDataCollected; 14 | event EventHandler OnStatusChanged; 15 | 16 | void Read(); 17 | 18 | void Enable(); 19 | 20 | void Disable(); 21 | 22 | void SetConfig(IScannerConfig a_config); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Inventory/Interfaces/IScannerConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inventory 4 | { 5 | public interface IScannerConfig 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Inventory/Inventory.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Inventory/Models/Barcode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Inventory 3 | { 4 | public class Barcode 5 | { 6 | private string data; 7 | public string Data 8 | { 9 | get { return data; } 10 | set { data = value; } 11 | } 12 | 13 | private string type; 14 | public string Type 15 | { 16 | get { return type; } 17 | set { type = value; } 18 | } 19 | 20 | private string info; 21 | public string Info 22 | { 23 | get { return $"{data} / {type}"; } 24 | } 25 | 26 | public Barcode() { } 27 | 28 | public Barcode(string a_data, string a_type) 29 | { 30 | data = a_data; 31 | type = a_type; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Inventory/Models/Item.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SQLite; 3 | 4 | namespace Inventory 5 | { 6 | /// 7 | /// This class uses attributes that SQLite.Net can recognize 8 | /// and use to create the table schema. 9 | /// 10 | [Table(nameof(Item))] 11 | public class Item 12 | { 13 | [PrimaryKey, AutoIncrement] 14 | public int? Id { get; set; } 15 | 16 | [NotNull, MaxLength(250)] 17 | public string Name { get; set; } 18 | 19 | [NotNull, Indexed, MaxLength(15)] 20 | public string Barcode { get; set; } 21 | 22 | public int Quantity { get; set; } 23 | 24 | public bool IsValid() 25 | { 26 | return (!String.IsNullOrWhiteSpace(Name)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Inventory/Models/StatusEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Inventory 3 | { 4 | /// 5 | /// Custom event args for use by the scanner 6 | /// 7 | public class StatusEventArgs : EventArgs 8 | { 9 | private string barcodeData; 10 | 11 | public StatusEventArgs(string dataIn, string barcodeTypeIn) 12 | { 13 | barcodeData = dataIn; 14 | barcodeType = barcodeTypeIn; 15 | } 16 | 17 | public string Data { get { return barcodeData; } } 18 | 19 | private string barcodeType; 20 | public string BarcodeType { get { return barcodeType; } } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Inventory/Models/ZebraScannerConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inventory 4 | { 5 | public class ZebraScannerConfig : IScannerConfig 6 | { 7 | public TriggerType TriggerType { get; set; } 8 | 9 | public bool IsEAN8 { get; set; } 10 | public bool IsEAN13 { get; set; } 11 | public bool IsCode39 { get; set; } 12 | public bool IsCode128 { get; set; } 13 | public bool IsContinuous { get; set; } 14 | public bool IsUPCA { get; set; } 15 | public bool IsUPCE0 { get; set; } 16 | public bool IsUPCE1 { get; set; } 17 | public bool IsD2of5 { get; set; } 18 | public bool IsI2of5 { get; set; } 19 | public bool IsAztec { get; set; } 20 | public bool IsPDF417 { get; set; } 21 | public bool IsQRCode { get; set; } 22 | 23 | public ZebraScannerConfig() 24 | { 25 | IsEAN8 = true; 26 | IsEAN13 = true; 27 | IsCode39 = true; 28 | IsCode128 = true; 29 | IsUPCA = true; 30 | IsUPCE0 = true; 31 | IsUPCE1 = true; 32 | IsD2of5 = false; 33 | IsI2of5 = true; 34 | IsAztec = false; 35 | IsPDF417 = true; 36 | IsQRCode = true; 37 | 38 | IsContinuous = true; 39 | TriggerType = TriggerType.HARD; 40 | } 41 | } 42 | 43 | public enum TriggerType 44 | { 45 | HARD, 46 | SOFT 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Inventory/PageModel/ItemListPageModel.cs: -------------------------------------------------------------------------------- 1 | using FreshMvvm; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | using Xamarin.Forms; 9 | 10 | namespace Inventory 11 | { 12 | public class ItemListPageModel : FreshBasePageModel 13 | { 14 | private Repository _repository = FreshIOC.Container.Resolve(); 15 | private Item _selectedItem = null; 16 | 17 | /// 18 | /// Collection used for binding to the Page's item list view. 19 | /// 20 | public ObservableCollection Items { get; private set; } 21 | 22 | /// 23 | /// Used to bind with the list view's SelectedItem property. 24 | /// Calls the EditItemCommand to start the editing. 25 | /// 26 | public Item SelectedItem 27 | { 28 | get { return _selectedItem; } 29 | set 30 | { 31 | _selectedItem = value; 32 | if (value != null) EditItemCommand.Execute(value); 33 | } 34 | } 35 | 36 | public ItemListPageModel() 37 | { 38 | Items = new ObservableCollection(); 39 | } 40 | 41 | /// 42 | /// Called whenever the page is navigated to. 43 | /// Here we are ignoring the init data and just loading the items. 44 | /// 45 | public override void Init(object initData) 46 | { 47 | LoadItems(); 48 | if (Items.Count() < 1) 49 | { 50 | CreateSampleData(); 51 | } 52 | 53 | } 54 | 55 | protected override void ViewIsAppearing(object sender, EventArgs e) 56 | { 57 | base.ViewIsAppearing(sender, e); 58 | var scanner = FreshIOC.Container.Resolve(); 59 | 60 | scanner.Enable(); 61 | scanner.OnScanDataCollected += ScannedDataCollected; 62 | scanner.OnStatusChanged += ScannedStatusChanged; 63 | 64 | var config = new ZebraScannerConfig(); 65 | config.IsUPCE0 = false; 66 | config.IsUPCE1 = false; 67 | 68 | scanner.SetConfig(config); 69 | } 70 | 71 | protected override void ViewIsDisappearing(object sender, EventArgs e) 72 | { 73 | var scanner = FreshIOC.Container.Resolve(); 74 | 75 | if (null != scanner) 76 | { 77 | scanner.Disable(); 78 | scanner.OnScanDataCollected -= ScannedDataCollected; 79 | scanner.OnStatusChanged -= ScannedStatusChanged; 80 | } 81 | base.ViewIsDisappearing(sender, e); 82 | } 83 | 84 | /// 85 | /// Called whenever the page is navigated to, but from a pop action. 86 | /// Here we are just updating the item list with most recent data. 87 | /// 88 | /// 89 | public override void ReverseInit(object returnedData) 90 | { 91 | LoadItems(); 92 | base.ReverseInit(returnedData); 93 | } 94 | 95 | /// 96 | /// Command associated with the add item action. 97 | /// Navigates to the ItemPageModel with no Init object. 98 | /// 99 | public ICommand AddItemCommand 100 | { 101 | get 102 | { 103 | return new Command(async () => { 104 | await CoreMethods.PushPageModel(); 105 | }); 106 | } 107 | } 108 | 109 | /// 110 | /// Command associated with the edit item action. 111 | /// Navigates to the ItemPageModel with the selected item as the Init object. 112 | /// 113 | public ICommand EditItemCommand 114 | { 115 | get 116 | { 117 | return new Command(async (item) => { 118 | await CoreMethods.PushPageModel(item); 119 | }); 120 | } 121 | } 122 | 123 | /// 124 | /// Repopulate the collection with updated items data. 125 | /// Note: For simplicity, we wait for the async db call to complete, 126 | /// recommend making better use of the async potential. 127 | /// 128 | private void LoadItems() 129 | { 130 | Items.Clear(); 131 | Task> getItemTask = _repository.GetAllItems(); 132 | getItemTask.Wait(); 133 | foreach (var item in getItemTask.Result) 134 | { 135 | Items.Add(item); 136 | } 137 | } 138 | 139 | /// 140 | /// Uses the SQLite Async capability to insert sample data on multiple threads. 141 | /// 142 | private void CreateSampleData() 143 | { 144 | var item1 = new Item 145 | { 146 | Name = "Milk", 147 | Barcode = "8001234567890", 148 | Quantity = 10 149 | }; 150 | 151 | var item2 = new Item 152 | { 153 | Name = "Soup", 154 | Barcode = "8002345678901", 155 | Quantity = 5 156 | }; 157 | 158 | var item3 = new Item 159 | { 160 | Name = "Water", 161 | Barcode = "8003456789012", 162 | Quantity = 20 163 | }; 164 | 165 | var task1 = _repository.CreateItem(item1); 166 | var task2 = _repository.CreateItem(item2); 167 | var task3 = _repository.CreateItem(item3); 168 | 169 | // Don't proceed until all the async inserts are complete. 170 | var allTasks = Task.WhenAll(task1, task2, task3); 171 | allTasks.Wait(); 172 | 173 | LoadItems(); 174 | } 175 | 176 | private void ScannedDataCollected(object sender, StatusEventArgs a_status) 177 | { 178 | Barcode barcode = new Barcode(); 179 | barcode.Data = a_status.Data; 180 | barcode.Type = a_status.BarcodeType; 181 | 182 | Item item; 183 | 184 | Task> getItemTask = _repository.GetItem(barcode.Data); 185 | getItemTask.Wait(); 186 | if (getItemTask.Result.Count() < 1) 187 | { 188 | item = new Item { Name = "", Barcode = barcode.Data }; 189 | } 190 | else 191 | { 192 | item = getItemTask.Result.First(); 193 | } 194 | 195 | 196 | CoreMethods.PushPageModel(item); 197 | 198 | } 199 | 200 | private void ScannedStatusChanged(object sender, string a_message) 201 | { 202 | string status = a_message; 203 | } 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /Inventory/PageModel/ItemPageModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | using FreshMvvm; 4 | using Xamarin.Forms; 5 | 6 | namespace Inventory 7 | { 8 | public class ItemPageModel : FreshBasePageModel 9 | { 10 | // Use IoC to get our repository. 11 | private Repository _repository = FreshIOC.Container.Resolve(); 12 | 13 | // Backing data model. 14 | private Item _item; 15 | 16 | /// 17 | /// Public property exposing the item's name for Page binding. 18 | /// 19 | public string ItemName 20 | { 21 | get { return _item.Name; } 22 | set { _item.Name = value; RaisePropertyChanged(); } 23 | } 24 | 25 | /// 26 | /// Public property exposing the item's barcode for Page binding. 27 | /// 28 | public string ItemBarcode 29 | { 30 | get { return _item.Barcode; } 31 | set { _item.Barcode = value; RaisePropertyChanged(); } 32 | } 33 | 34 | /// 35 | /// Public property exposing the item's quantity for Page binding. 36 | /// 37 | public int ItemQuantity 38 | { 39 | get { return _item.Quantity; } 40 | set { _item.Quantity = value; RaisePropertyChanged(); } 41 | } 42 | 43 | /// 44 | /// Called whenever the page is navigated to. 45 | /// Either use a supplied Intem, or create a new one if not supplied. 46 | /// FreshMVVM does not provide a RaiseAllPropertyChanged, 47 | /// so we do this for each bound property, room for improvement. 48 | /// 49 | public override void Init(object initData) 50 | { 51 | _item = initData as Item; 52 | if (_item == null) _item = new Item(); 53 | base.Init(initData); 54 | RaisePropertyChanged(nameof(ItemName)); 55 | RaisePropertyChanged(nameof(ItemBarcode)); 56 | } 57 | 58 | /// 59 | /// Command associated with the save action. 60 | /// Persists the item to the database if the item is valid. 61 | /// 62 | public ICommand SaveCommand 63 | { 64 | get 65 | { 66 | return new Command(async () => { 67 | if (_item.IsValid()) 68 | { 69 | await _repository.CreateItem(_item); 70 | await CoreMethods.PopPageModel(_item); 71 | } 72 | }); 73 | } 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Inventory/Pages/ItemListPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Inventory/Pages/ItemListPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using FreshMvvm; 4 | using Xamarin.Forms; 5 | 6 | namespace Inventory 7 | { 8 | public partial class ItemListPage : FreshBaseContentPage 9 | { 10 | public ItemListPage() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Inventory/Pages/ItemPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |