Mobil alkalmazsok Universal Windows Platform bevezet Irodalom s
Mobil alkalmazások Universal Windows Platform bevezető
• Irodalom és elérhető példaprogramok • Universal Windows Platform • Visual Studio 2015 és a Blend • Programok futtatása
Irodalom és elérhető példaprogramok
https: //channel 9. msdn. com/Series/Windows-10 -development-for-absolutebeginners
https: //mva. microsoft. com/en-US/training-courses/adevelopers-guide-to-windows-1012618? l=IV 8 HDBp. RB_9005095281 https: //mva. microsoft. com/en-US/training-courses/adeveloper-s-guide-to-windows-10 -11341
https: //github. com/Microsoft/Windows-universalsamples
https: //msdn. microsoft. com/huhu/library/windows/apps/dn 894631. aspx
Universal Windows Platform
Visual Studio 2015 & Blend
Első alkalmazás
Programok futtatása
Egyéb
XAML vezérlők
Layout vezérők Border Canvas Grid Relative. Panel Scroll. Viewer Split. View Stack. Panel Variable. Sized. Wrap. Grid View. Box
Button Hyperlink. Button Repeat. Button Toggle. Button
Text. Box Password. Box Text. Block Rich. Edit. Box Rich. Text. Block Bitmap. Icon Font. Icon Symbol. Icon Path. Icon
Calendar. View Date. Picker Time. Picker Toggle. Switch Check. Box Radio. Button Combo. Box List. Box Slider
Items. Control <Data. Template /> Flip. View <Items. Panel. Template /> Grid. View <Control. Template /> List. View <Content. Presenter /> Sematic. Zoom <Items. Presenter /> Hub <Content. Control /> Content. Control
App. Bar Command. Bar App. Bar. Button App. Bar. Toggle. Button App. Bar. Separator
Blend
SQLite browser
SQLite PCL
var db = new SQLite. Async. Connection(App. DBPath); var _customer = await (from c in db. Table<Customer>() where c. Id == customer. Id select c). First. Or. Default. Async(); using (var conn = new SQLite. Connection("demo. db")) { Customer customer = null; using (var statement = conn. Prepare( "SELECT Id, Name FROM Customer WHERE Id = ? ")) { statement. Bind(1, customer. Id); if (customer != null) { var Id = _customer. Id; var Name = _customer. Name; } if (SQLite. Result. DONE == statement. Step()) { customer = new Customer() { Id = (long)statement[0], Name = (string)statement[1] }; } } }
private void Load. Database() { // Get a reference to the SQLite database conn = new SQLite. Connection("sqlitepcldemo. db"); string sql = @"CREATE TABLE IF NOT EXISTS Customer (Id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, Name VARCHAR( 140 ), City VARCHAR( 140 ), Contact VARCHAR( 140 ) ); "; using (var statement = conn. Prepare(sql)) { statement. Step(); } }
// Sql. Connection was opened in App. xaml. cs and exposed through property conn var db = App. conn; try { using (var custstmt = db. Prepare("INSERT INTO Customer (Name, City, Contact) VALUES (? , ? )")) { custstmt. Bind(1, customer. Name); custstmt. Bind(2, customer. City); custstmt. Bind(3, customer. Contact); custstmt. Step(); } } catch (Exception ex) { // TODO: Handle error }
public Customer Get. Customer(int customer. Id) { Customer customer = null; using (var statement = dbconn. Prepare("SELECT Id, Name, City, Contact FROM Customer WHERE Id = ? ")) { statement. Bind(1, customer. Id); if (SQLite. Result. DONE == statement. Step()) { customer = new Customer() { Id = (long)statement[0], Name = (string)statement[1], City = (string)statement[2], Contact = (string)statement[3] }; } } return customer; }
// See if the customer already exists var existing. Customer = Get. Customer(customer. Id); if (existing. Customer != null) { using (var custstmt = dbconn. Prepare("UPDATE Customer SET Name = ? , City = ? , Contact = ? WHERE Id=? ")) { // NOTE when using anonymous parameters the first has an index of 1, not 0. custstmt. Bind(1, customer. Name); custstmt. Bind(2, customer. City); custstmt. Bind(3, customer. Contact); custstmt. Bind(4, customer. Id); custstmt. Step(); } }
public void Delete. Customer(int customer. Id) { using (var statement = dbconn. Prepare("DELETE FROM Customer WHERE Id = ? ")) { statement. Bind(1, customer. Id); statement. Step(); } }
using (var statement = dbconn. Prepare("BEGIN TRANSACTION")) { statement. Step(); } // Execute one or more statements… using (var custstmt = dbconn. Prepare( "INSERT INTO Customer (Name, City, Contact) VALUES (? , ? )")) {. . . } using (var projstmt = dbconn. Prepare( "INSERT INTO Project (Name, Title, Due. Date, Customer. Id) VALUES (? , ? , ? )")) {. . . } // COMMIT to accept all changes or ROLLBACK TRANSACTION to discard pending changes using (var statement = dbconn. Prepare("COMMIT TRANSACTION")) { statement. Step(); }
CREATE TABLE IF NOT EXISTS Project (Id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, Customer. Id INTEGER, Name VARCHAR( 140 ), Description VARCHAR( 140 ), Due. Date DATETIME, FOREIGN KEY(Customer. Id) REFERENCES Customer(Id) );
// Turn on Foreign Key constraints sql = @"PRAGMA foreign_keys = ON"; using (var statement = dbconn. Prepare(sql)) { statement. Step(); }
Type Description SQLite-NET PRIMARY KEY Defines the column(s) of the primary key - 1 per table max Declare by using [Primary. Key] attribute UNIQUE Column constraint enforces unique values in that column Declare by using [Unique] attribute NOT NULL Column constraint prevents null values No way of declaring with SQLite. NET CHECK Column or Table constraint: constraint expression is evaluated on every insert or update, and if ‘ 0’ returned, constraint fails No way of declaring with SQLite. NET
// Create index on Foreign Key column sql = @"CREATE INDEX IF NOT EXISTS fk_customer_project_idx ON project (customer. Id) ASC"; using (var statement = dbconn. Prepare(sql)) { statement. Step(); }
SQLite. NET
public bool Create. Database() { try { using (var db = new SQLite. Connection(_database. Path)) { // tábla létrehozása var t = db. Create. Table<Todo>(); var tableinfo = db. Get. Mapping(typeof(Todo)); Debug. Write. Line("tableinfo" + tableinfo); return true; } } catch (SQLite. Exception exception) { Debug. Write. Line("SQLite. Exception exception: " + exception. Message); return false; } }
public IEnumerable<Todo> Get. All. Todo() { using (var db = new SQLite. Connection(_database. Path)) { return (from t in db. Table<Todo>() select t). To. List(); } }
public IEnumerable<Todo> Low. Level. Query() { using (var db = new SQLite. Connection(_database. Path)) { return db. Query<Todo>("SELECT * FROM Todo"); // List<Todo>-t ad vissza } }
public bool Insert. Todo(Todo todo) { try { using (var db = new SQLite. Connection(_database. Path)) { var insertinfo = db. Insert(todo); Debug. Write. Line("insertinfo" + insertinfo); return true; } } catch (SQLite. Exception exception) { Debug. Write. Line("SQLite. Exception exception: " + exception. Message); return false; } }
public bool Update. Todo(Todo todo) { try { using (var db = new SQLite. Connection(_database. Path)) { var updateinfo = db. Update(todo); Debug. Write. Line("updateinfo" + updateinfo); return true; } } catch (SQLite. Exception exception) { Debug. Write. Line("SQLite. Exception exception: " + exception. Message); return false; } }
public bool Delete. Todo(Todo todo) { try { using (var db = new SQLite. Connection(_database. Path)) { var updateinfo = db. Delete(todo); Debug. Write. Line("updateinfo" + updateinfo); return true; } } catch (SQLite. Exception exception) { Debug. Write. Line("SQLite. Exception exception: " + exception. Message); return false; } }
Azure App Service Mobile Apps 01010 00100 10110 00100
https: //mva. microsoft. com/en-US/training-courses/a-developer-s-guide-towindows-10 -11341
- Slides: 112