精华内容
下载资源
问答
  • C#移动开发,之前还没有接触过。今天就写C# smobiler第一步。 1,首先,去官网下载smobiler安装客户端。 网址是https://www.smobiler.com/download.html 2,下载完成,安装客户端。 3,在VS中,创建Smobiler...

    C#移动开发,之前还没有接触过。今天就写C# smobiler第一步。

    1,首先,去官网下载smobiler安装客户端。

    网址是https://www.smobiler.com/download.html

     

    2,下载完成,安装客户端。

    3,在VS中,创建Smobiler程序。

     

    注意,我用的是最新的VS2019,不同的VS可能界面不同。

    4,在界面上添加一个button。

    在button代码段中添加代码

     MessageBox.Show("I Love C# and .Net!");

    5,运行查看结果

    6,用Smobiler客户端扫描二维码,运行程序!

    这就完成了我们的第一步,Smobiler移动开发!

    展开全文
  • 由于公司的需要,需要我们用c#语言开发android app 安装的过程一步步来就好,没什么难度,就是在安装android的相关插件的过程中花费了很长时间,而且最后没能完成相关的下载安装 由于公司没用过vs2015,所以就硬着...

    由于vs2019都出了,这个网盘的分享链接就取消了。

    由于公司的需要,需要我们用c#语言开发android  app

    安装的过程一步步来就好,没什么难度,就是在安装android的相关插件的过程中花费了很长时间,而且最后没能完成相关的下载安装

    由于公司没用过vs2015,所以就硬着头皮上了

    有幸遇到HuTiger这位大神的帖子,让我少走了好多弯路,附上链接:

    http://www.cnblogs.com/huguodong/p/5811896.html(侵删)

    开始我并未搭建jdk的环境,在运行的过程中报错,显示sdk manager需要更新,进去之后由于更新链接需要翻墙

     

    幸好找到了相关代理,顺利的链接成功,完成更新http://www.cnblogs.com/sunzn/p/4242131.html(侵删)

    可是再次运行还是报错Connection to the layout renderer failed. this may be caused by a misconfiguration of java. 

    又在网上找了好多方法最后是java版本问题,下载了jdk1.8

    然后配置了一下环境变量http://jingyan.baidu.com/article/6dad5075d1dc40a123e36ea3.html

    最后终于成功了

     

    附上vs2015,jdk1.8,Xamarin.VisualStudio_4.0.3.214和android环境集合 

    其中集合中的jdk1.7可以删除,安装1.8即可

    链接:http://pan.baidu.com/s/1nuOz6Wh 密码:hi28

     

    展开全文
  • 相当于用 C# 开发安卓程序访问 Sqlite 可以使用 EF 了, 还支持CodeFirst,再加上 linq,简直不要太帅啊。 亲测通过,转载原文,懒得翻译,备忘。 有兴趣的见官方:https://developer.xamarin.com/g...

    开发环境:VS2015 Xamarin

    Sqlite.NET ORM 不就相当于 Entiry Framework For Xamarin 吗? 相当于用 C# 开发安卓程序访问 Sqlite 可以使用 EF 了, 还支持CodeFirst ,再加上 linq,简直不要太帅啊。

    亲测通过,转载原文,懒得翻译,备忘。 有兴趣的见官方:https://developer.xamarin.com/guides/android/application_fundamentals/data/part_3_using_sqlite_orm/

    Using SQLite.NET

    The SQLite.NET library that Xamarin recommends is a very basic ORM that lets you easily store and retrieve objects in the local SQLite database on an Android device. ORM stands for Object Relational Mapping – an API that lets you save and retrieve "objects" from a database without writing SQL statements.

    There are two ways to include SQLite.NET in your Xamarin project:

    • NuGet – The code is available as a SQLite.net PCL NuGet package,  which supports a variety of platforms including iOS, Android, and Windows.

         PM> Install-Package sqlite-net-pcl

    • Component StoreSQLite.NET is available for iOS and Android from the Xamarin Component Store.

    Regardless of which method you use to include SQLite.NET in your application, the code to use it the same. Once you have the SQLite.NET library available, follow these three steps to use it to access a database:

    1. Add a using statement – Add the following statement to the C#  files where data access is required:

      using SQLite;

       

    2. Create a Blank Database – A database reference can be created by passing the file path the SQLiteConnection class constructor. You do not need to check if the file already exists – it will automatically be created if required, otherwise the existing database file will be opened.

      var db = new SQLiteConnection (dbPath);

       

      The dbPath variable should be determined according the rules discussed earlier in this document.

    3. Save Data – Once you have created a SQLiteConnection object, database commands are executed by calling its methods, such as CreateTable and Insert like this:

      db.CreateTable<Stock> ();
      db.Insert (newStock); // after creating the newStock object

       

    4. Retrieve Data – To retrieve an object (or a list of objects) use the following syntax:

      var stock = db.Get<Stock>(5); // primary key id of 5
      var stockList = db.Table<Stock>();

       

    Basic Data Access Sample

    The following code sample shows an entire database interaction using the SQLite.NET library to encapsulate the underlying database access. It shows:

    1. Creating the database file

    2. Inserting some data by creating objects and then saving them

    3. Querying the data

    You'll need to include these namespaces:

    using SQLite; // from the github SQLite.cs class

    The last one requires that you have added SQLite to your project. Note that the SQLite database table is defined by adding attributes to a class (the Stock class) rather than a CREATE TABLE command.

    [Table("Items")]
    public class Stock {
        [PrimaryKey, AutoIncrement, Column("_id")]
        public int Id { get; set; }
        [MaxLength(8)]
        public string Symbol { get; set; }
    }
    public static void DoSomeDataAccess () {
           Console.WriteLine ("Creating database, if it doesn't already exist");
       string dbPath = Path.Combine (
            Environment.GetFolderPath (Environment.SpecialFolder.Personal),
            "ormdemo.db3");
       var db = new SQLiteConnection (dbPath);
       db.CreateTable<Stock> ();
       if (db.Table<Stock> ().Count() == 0) {
            // only insert the data if it doesn't already exist
            var newStock = new Stock ();
            newStock.Symbol = "AAPL";
            db.Insert (newStock);
            newStock = new Stock ();
            newStock.Symbol = "GOOG";
            db.Insert (newStock);
            newStock = new Stock ();
            newStock.Symbol = "MSFT";
            db.Insert (newStock);
        }
        Console.WriteLine("Reading data");
        var table = db.Table<Stock> ();
        foreach (var s in table) {
            Console.WriteLine (s.Id + " " + s.Symbol);
        }
    }

     

    Using the [Table] attribute without specifying a table name parameter will cause the underlying database table to have the same name as the class (in this case, "Stock"). The actual table name is important if you write SQL queries directly against the database rather than use the ORM data access methods. Similarly the [Column("_id")] attribute is optional, and if absent a column will be added to the table with the same name as the property in the class.

    SQLite Attributes

    Common attributes that you can apply to your classes to control how they are stored in the underlying database include:

    • [PrimaryKey] – This attribute can be applied to an integer property to force it to be the underlying table's primary key. Composite primary keys are not supported.

    • [AutoIncrement] – This attribute will cause an integer property's value to be auto-increment for each new object inserted into the database

    • [Column(name)] – Supplying the optional name parameter will override the default value of the underlying database column's name (which is the same as the property).

    • [Table(name)] – Marks the class as being able to be stored in an underlying SQLite table. Specifying the optional name parameter will override the default value of the underlying database table's name (which is the same as the class name).

    • [MaxLength(value)] – Restrict the length of a text property, when a database insert is attempted. Consuming code should validate this prior to inserting the object as this attribute is only 'checked' when a database insert or update operation is attempted.

    • [Ignore] – Causes SQLite.NET to ignore this property. This is particularly useful for properties that have a type that cannot be stored in the database, or properties that model collections that cannot be resolved automatically be SQLite.

    • [Unique] – Ensures that the values in the underlying database column are unique.

    Most of these attributes are optional, SQLite will use default values for table and column names. You should always specify an integer primary key so that selection and deletion queries can be performed efficiently on your data.

    More Complex Queries

    The following methods on SQLiteConnection can be used to perform other data operations:

    • Insert – Adds a new object to the database.

    • Get<T> – Attempts to retrieve an object using the primary key.

    • Table<T> – Returns all the objects in the table.

    • Delete – Deletes an object using its primary key.

    • Query<T> – Perform an SQL query that returns a number of rows (as objects).

    • Execute – Use this method (and not Query) when you don't expect rows back from the SQL (such as INSERT, UPDATE and DELETE instructions).

    Getting an object by the primary key

    SQLite.Net provides the Get method to retrieve a single object based on its primary key.

    var existingItem = db.Get<Stock>(3);

    Selecting an object using Linq

    Methods that return collections support IEnumerable<T> so you can use Linq to query or sort the contents of a table. The entire table is loaded into a collection prior to the Linq query executing, so performance of these queries could be slow for large amounts of data.

    The following code shows an example using Linq to filter out all entries that begin with the letter "A":

    var apple = from s in db.Table<Stock>()
        where s.Symbol.StartsWith ("A")
        select s;
    Console.WriteLine ("-> " + apple.FirstOrDefault ().Symbol);

     

    Selecting an object using SQL

    Even though SQLite.Net can provide object-based access to your data, sometimes you might need to do a more complex query than Linq allows (or you may need faster performance). You can use SQL commands with the Query method, as shown here:

    var stocksStartingWithA = db.Query<Stock>("SELECT * FROM Items WHERE Symbol = ?", "A");
    foreach (var s in stocksStartingWithA) {
        Console.WriteLine ("a " + s.Symbol);
    }

     

    ℹ️

    Note: When writing SQL statements directly you create a  dependency on the names of tables and columns in your database, which  have been generated from your classes and their attributes. If you  change those names in your code you must remember to update any  manually written SQL statements.

    Deleting an object

    The primary key is used to delete the row, as shown here:

    var rowcount = db.Delete<Stock>(someStock.Id); // Id is the primary key

    You can check the rowcount to confirm how many rows were affected (deleted in this case).

    Using SQLite.NET with Multiple Threads

    SQLite supports three different threading modes: Single-thread, Multi-thread, and Serialized. If you want to access the database from multiple threads without any restrictions, you can configure SQLite to use the Serialized threading mode. It's important to set this mode early in your application (for example, at the beginning of the OnCreate method).

    To change the threading mode, call SqliteConnection.SetConfig. For  example, this line of code configures SQLite for Serialized mode:

    SqliteConnection.SetConfig(SQLiteConfig.Serialized);

    The Android version of SQLite has a limitation that requires a few more  steps. If the call to SqliteConnection.SetConfig produces a SQLite  exception such as library used incorrectly, then you must use the  following workaround:

    1. Link to the native libsqlite.so library so that the sqlite3_shutdown and sqlite3_initialize APIs are made  available to the app:

      [DllImport("libsqlite.so")]
      internal static extern int sqlite3_shutdown();
      
      [DllImport("libsqlite.so")]
      internal static extern int sqlite3_initialize();
    2. At the very beginning of the OnCreate method, add this code to shutdown SQLite, configure it for Serialized mode, and reinitialize SQLite:

      sqlite3_shutdown();
      SqliteConnection.SetConfig(SQLiteConfig.Serialized);
      sqlite3_initialize();

    This workaround also works for the Mono.Data.Sqlite library. For more  information about SQLite and multi-threading, see  SQLite and Multiple Threads.

    转载于:https://www.cnblogs.com/nanfei/p/7250688.html

    展开全文
  • c#开发Android应用实战

    千次下载 热门讨论 2012-12-25 17:29:29
    C#开发Android应用实战——使用Mono for Android和.NET/C# 全面透彻地讲解Android应用编程知识,分析如何结合使用C#和Mono来编写在Android设备系列上运行的应用程序。在这本由多位专家联袂撰写的必备精品书籍的...
  • C# AndroidC#开发Android应用实战 使用Mono for Android和.NET C#
  • 利用C#Android 开发的打牌计数器 有简单的增加 返回 清楚 本地存储 数据统计 功能 前台的源码在另一个资源下载
  • C#开发Android应用实战 使用Mono for Android和.NET C# PDF扫描版,希望对你有用处。 一般下载的都7.07MB的,那个只是一个样章,这个是书的全部。
  • C#针对Android开发

    千次阅读 2011-08-30 16:41:19
    刚刚在晚上看了一篇文章,是说C#可以针对Androd以及 Windows Phone 7平台进行开发,主要是通过Mono虚拟机来实现这个平台的实现,感觉不错留用,原文如下: MonoDroid将完整的Mono虚拟机带到了Android上,让.NET...

    刚刚在晚上看了一篇文章,是说C#可以针对Androd以及 Windows Phone 7平台进行开发,主要是通过Mono虚拟机来实现这个平台的实现,感觉不错留用,原文如下:

    MonoDroid将完整的Mono虚拟机带到了Android上,让.NET开发人员可以为Google的移动操作系统编写应用程序。开发人员现在可以同时面向iOS,Android和Windows Phone 7编写应用程序了。

    MonoDroid是一个类似MonoTouch的框架,让开发人员可以使用C#语言和Mono虚拟机为Android移动操作系统编写应用程序。MonoDroid API包含Silverlight所有的核心类库,但UI接口除外,取而代之的是一套针对原生Android Java API的绑定,用于访问设备相关的功能,例如各种感应器,摄像头,蓝牙等等。

    在Windows上进行Andorid开发最好使用Visual Studio专业版(或更高)配合SDK和开发用插件,而SDK会引用Android SDK以便使用Java SDK。在Mac OS X上使用MonoDevelop(基于Mono的跨平台IDE)进行开发要等到Preview 10。此外也有计划提供基于MonoDevelop的Linux开发环境。

    MonoDroid为.NET开发人员打开了Android世界。人们可以使用.NET和Mono同时开发Windows Phone 7,iPhone OS以及Android应用程序。不过事情也并非开发人员所希望那般直接:不同的平台有不同的设备及UI API,所以各个地方不可能同时运行相同的代码。开发人员需要清晰地分割业务逻辑以及UI逻辑,后者需要为不同的移动操作系统编写有针对性地代码。这 是.NET开发人员尽可能打开市场的重要一步。

    MonoDroid的路线图并没有提及正式版的发布时 间,不过Miguel de Icaza提到他们“正在尽可能快地完成Andorid上的Mono”。MonoDroid 1.0将会使用Mono 2.8,并支持C# 3.0,.NET 3.5,垃圾回收,多线程以及其他标准特性,如LINQ。OpenGL也会通过OpenTK API得到支持,这是个OpenGL的面向对象封装类库。OpenTK同样包含在MonoTouch中,因此OpenGL代码可以在Android和 iOS之间共享。

    据Icaza称DeltaEngine使用了MonoDroid,这是一个跨平台的游戏开发引擎,可以在iPhone,Android,Windows Phone 7和Xbox 360上运行游戏。此外,在CES 2011上NVidia演示了一个游戏Soul Craft,它运行在LG Optimus 2X,这是一个基于NVidia的Tegra 2双核芯片的Android手机。这个游戏运行在MonoDroid上。

    MonoDroid将会是个商业产品,定价还未发布。作为参考,MonoTouch的价格从99美元的学生版开始,到399美元的专业版,还有3999美元的5个企业授权套装。



    展开全文
  • C#语言 xamarin.android 开发的 蓝牙打印功能,用vs2017开发的源码,还包括引用java jar 包
  • C#开发Android应用程序的流程

    万次阅读 2019-03-20 10:09:53
    摘要:用C#开发RFID-android吗?C#真的能开发android程序吗?C#开发android程序的工具是什么?开发步骤、方法以及流程是怎样的?出学android开发者一定会提出这些疑问,本文一一解答这些疑问,为安卓初学者提供...
  • 手把手教你用C#开发Android应用程序的方法和流程摘要:用C#开发RFID-android吗?C#真的能开发android程序吗?C#开发android程序的工具是什么?开发步骤、方法以及流程是怎样的?出学android开发者一定会提出这些...
  • C#开发Android应用实战

    千次阅读 2014-11-27 14:48:12
    C#开发Android应用实战——使用Mono for Android和.NET/C#C#开发Android应用实战——使用Mono for Android和.NET/C#》基本信息 原书名:Professional AndroidTM Programming with Mono for Android and .NET/C# ...
  • 学习Android的好资料,大家不仅可以用java开发Android,还可以用这教程用c#开发Android应用程序哦!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • C#开发Android应用实战 使用Mono for Android和.NET C#(美)麦克卢尔 清华大学出版社出版
  • C#Android手机App开发

    2020-09-02 04:30:00
    主要为大家详细介绍了C#Android手机App开发,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
  • C#开发Android应用实战——使用Mono for Android和.NET/C#》基本信息原书名:Professional AndroidTM Programming with Mono for Android and .NET/C#作者: (美)Wallace B. McClure Nathan Blevins John J. Croft...
  • C#移动开发应用实战 使用Mono for Android和.NET C# 中文版
  • 毕业后,他在美国教育部、可口可乐、柏可德、Magnatron以及朗讯科技等公司从事顾问和开发工作。McClure撰写了多部关于体系结构、ADO.NET、SQLServer、Ajax以及带有Mono的移动设备方面的书籍,他还撰写了两本关于使用...
  • C#开发Android步骤

    2013-07-31 15:50:00
    C#是一种优秀的编程语言,...但是如何将C#程序部署到Linux,Android等平台,这当然是得依靠众所周知的Mono。 本文Demo程序比较简单,实现了通过HttpRequest查询天气,最终效果如下: 1.下载并安装Xamarin ...
  • 这4章主要介绍了Mono for Android产品、使用Mono for Android进行开发的基本知识、Visual Studio插件和MonoDevelop+通过屏幕和数据控件向用户显示数据的基本知识以及如何为Android开发用户界面。当你了解这些概念后...
  • 使用Mono for Android和.Net/C#开发Android 应用程序,环境搭建(开发环境配置和环境变量配置) 1、安装JDK 2、安装Android SDK 3、安装Visual Studio 2010及SP1补丁包(参见...
  • C#专业开发Android APP教程,全过程解析,配最智能IDE vs 编程截图,无基础入门
  • c#开发Android和iOS

    千次阅读 2013-12-27 17:40:43
    c#开发Android和iOS 很多初学者误以为Android、IOS开发只能使用Java、ObjectC等语言进行开发,其实借助于Mono技术我们可以使用C#/.Net编写Android、IOS程序。由于C#的高效开发和Mono的完美跨平台,...
  • C#程序员转android开发

    2011-07-01 16:20:00
    android软件开发必将掀起一股热潮。哥是名.net程序员,擅长的是C#语言,而android使用的是java。这咋一看两者矛盾,其实这两种语言之间有着惊人的相似。甚至忽略某些细节你可以把他们当成是同一种语言。虽然现在...
  • C#语言开发Android打牌计数器 简单的增加 返回 本地存储功能 数据统计 这个前台页面代码 具体功能代码在另一个资源下载

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,320
精华内容 928
关键字:

c#android开发

c# 订阅