Fundamental Training - 1
MEKevin R. OctavianMobile Developerkevin.r.octavian@gmail.com+62 857 2294 5257kevin.r.octavian@kevinroctavian
DAFTAR ISIWindows 8 Controls (Action Controls & Layout Controls)Data BindingAppBars and NavigationViewSQLite
Windows 8 Controls (Action Controls & LayoutControls)
Action Controlshttp://msdn.microsoft.com/library/windows/apps/hh465351.aspx<TextBlock Foreground="White" Text="Ini TextBlo...
Layout Controlshttp://msdn.microsoft.com/library/windows/apps/hh465351.aspx<Canvas Width="120" Height="120"> <RectangleFil...
Layout Controlshttp://msdn.microsoft.com/library/windows/apps/hh465351.aspx<FlipView x:Name="flipView1"SelectionChanged="F...
DemoWindows 8 Controls (Action Controls & LayoutControls)
Data Binding
public class Person : INotifyPropertyChanged{private string name;private string phone;private string photo;public string N...
Data BindingPersons persons = new Persons();Person p = new Person();p.Name = "Kevin R. Octavian";p.Phone = "085722945257";...
Data BindingDemo
AppBars and Navigation
AppBars<Page.BottomAppBar><AppBar x:Name="bottomAppBar" Padding="10,0,10,0"><Grid><StackPanel Orientation="Horizontal" Hor...
Navigationhttp://msdn.microsoft.com/library/windows/apps/hh771188.aspxpublic BasicPage1() {this.InitializeComponent();this...
DemoAppBars and Navigation
View
View
using System.Linq;using Windows.Foundation;using Windows.Foundation.Collections;using Windows.UI.Xaml;using Windows.UI.Xam...
<TextBlock x:Name="textSnap" Text="Kevin R. Octavian snap" Visibility="Collapsed" /><TextBlock x:Name="textOthers" Text="K...
DemoView
SQLite
http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Create Tabletry{var dbpath = Path.Combine(Wi...
http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Insert Datavar dbpath = Path.Combine(Windows...
http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Select Datavar dbpath = Path.Combine(Windows...
http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Delete Datavar dbpath = Path.Combine(Windows...
DemoSQLite
Upcoming SlideShare
Loading in …5
×

Windows 8 Training Fundamental - 1

1,862 views
1,812 views

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,862
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Windows 8 Training Fundamental - 1

  1. 1. Fundamental Training - 1
  2. 2. MEKevin R. OctavianMobile Developerkevin.r.octavian@gmail.com+62 857 2294 5257kevin.r.octavian@kevinroctavian
  3. 3. DAFTAR ISIWindows 8 Controls (Action Controls & Layout Controls)Data BindingAppBars and NavigationViewSQLite
  4. 4. Windows 8 Controls (Action Controls & LayoutControls)
  5. 5. Action Controlshttp://msdn.microsoft.com/library/windows/apps/hh465351.aspx<TextBlock Foreground="White" Text="Ini TextBlock" FontFamily="SegoeUI" FontSize="48" /><TextBox Text="The quick brown fox..." Width="500"FontFamily="Segoe UI" FontSize="30" /><Button Content="Save" FontFamily="Segoe UI" FontSize="48" /><RadioButton Content="Breakfast" GroupName="MealSelection"FontFamily="Segoe UI" FontSize="48" /><RadioButton Content="Lunch" GroupName="MealSelection"FontFamily="Segoe UI" FontSize="48" /><RadioButton Content="Dinner" GroupName="MealSelection"FontFamily="Segoe UI" FontSize="48" /><CheckBox Content="I agree to the terms I didnt read"FontFamily="Segoe UI" FontSize="15" /><ComboBox><ComboBoxItem Content="Breakfast" /><ComboBoxItem Content="Second Breakfast" /><ComboBoxItem Content="Elevenses" /><ComboBoxItem Content="Luncheon" /><ComboBoxItem Content="Afternoon Tea" /><ComboBoxItem Content="Dinner" /><ComboBoxItem Content="Supper" /></ComboBox><Image Source="Assets/Logo.png" Width="200" Height="200" />
  6. 6. Layout Controlshttp://msdn.microsoft.com/library/windows/apps/hh465351.aspx<Canvas Width="120" Height="120"> <RectangleFill="Red"/><Rectangle Fill="Blue" Canvas.Left="20"Canvas.Top="20"/><Rectangle Fill="Green"Canvas.Left="40" Canvas.Top="40"/><Rectangle Fill="Yellow"Canvas.Left="60" Canvas.Top="60"/></Canvas><Grid><Grid.RowDefinitions><RowDefinition Height="50"/><RowDefinition Height="50"/></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="50"/><ColumnDefinition Width="50"/></Grid.ColumnDefinitions><Rectangle Fill="Red"/><Rectangle Fill="Blue" Grid.Row="1"/><Rectangle Fill="Green" Grid.Column="1"/><Rectangle Fill="Yellow" Grid.Row="1"Grid.Column="1"/></Grid><StackPanel><Rectangle Fill="Red"/> <RectangleFill="Blue"/><Rectangle Fill="Green"/> <RectangleFill="Yellow"/></StackPanel>
  7. 7. Layout Controlshttp://msdn.microsoft.com/library/windows/apps/hh465351.aspx<FlipView x:Name="flipView1"SelectionChanged="FlipView_SelectionChanged"><Image Source="Assets/Logo.png"/><ImageSource="Assets/SplashScreen.png"/><ImageSource="Assets/SmallLogo.png" /></FlipView><GridView x:Name="gridView1"SelectionChanged="GridView_SelectionChanged"><x:String>Item 1</x:String><x:String>Item 2</x:String></GridView><ListView x:Name="listView1"SelectionChanged="ListView_SelectionChanged"><x:String>Item 1</x:String><x:String>Item 2</x:String></ListView>
  8. 8. DemoWindows 8 Controls (Action Controls & LayoutControls)
  9. 9. Data Binding
  10. 10. public class Person : INotifyPropertyChanged{private string name;private string phone;private string photo;public string Name {get { return this.name; }set { this.name = value; NotifyPropertyChanged("Name"); }}public string Photo{get { return this.photo; }set { this.photo = value; NotifyPropertyChanged("Photo"); }}public string Phone{get { return this.phone; }set { this.phone = value; NotifyPropertyChanged("Phone"); }}public event PropertyChangedEventHandler PropertyChanged;private void NotifyPropertyChanged(string propName) {if (PropertyChanged != null) {PropertyChanged(this, newPropertyChangedEventArgs(propName));}}}Data Bindingpublic class Persons : INotifyPropertyChanged{private ObservableCollection<Person> personList;private string groupName;public Persons() {this.personList = new ObservableCollection<Person>();}public ObservableCollection<Person> PersonList {get {return this.personList;}}public string GroupName {get { return this.groupName; }set { this.groupName = value; NotifyPropertyChanged("GroupName");}}public event PropertyChangedEventHandler PropertyChanged;private void NotifyPropertyChanged(string propName){if (PropertyChanged != null){PropertyChanged(this, newPropertyChangedEventArgs(propName));}}}
  11. 11. Data BindingPersons persons = new Persons();Person p = new Person();p.Name = "Kevin R. Octavian";p.Phone = "085722945257";p.Photo = "";Person p2 = new Person();p2.Name = "Dadang";p2.Phone = "085722945257";p2.Photo = "";persons.GroupName = "Kevin Lovers";persons.PersonList.Add(p);persons.PersonList.Add(p2);this.DataContext = persons;<ListView ItemsSource = "{Binding PersonList}"><ListView.ItemTemplate><DataTemplate><StackPanel Orientation = "Horizontal"><TextBlock Text = "{Binding Name}" Width = "100"/><TextBlock Text = "{Binding Phone}" Width = "200"/><TextBlock Text = "{Binding Photo}" Width = "300"/></StackPanel></DataTemplate></ListView.ItemTemplate></ListView>
  12. 12. Data BindingDemo
  13. 13. AppBars and Navigation
  14. 14. AppBars<Page.BottomAppBar><AppBar x:Name="bottomAppBar" Padding="10,0,10,0"><Grid><StackPanel Orientation="Horizontal" HorizontalAlignment="Left"><Button Style="{StaticResource EditAppBarButtonStyle}"Click="Button_Click"/><Button Style="{StaticResource RemoveAppBarButtonStyle}"Click="Button_Click"/><Button Style="{StaticResource AddAppBarButtonStyle}"Click="Button_Click"/></StackPanel><StackPanel Orientation="Horizontal" HorizontalAlignment="Right"><Button Style="{StaticResource RefreshAppBarButtonStyle}"Click="Button_Click"/><Button Style="{StaticResource HelpAppBarButtonStyle}"Click="Button_Click"/></StackPanel></Grid></AppBar></Page.BottomAppBar>this.BottomAppBar.IsOpen = true;
  15. 15. Navigationhttp://msdn.microsoft.com/library/windows/apps/hh771188.aspxpublic BasicPage1() {this.InitializeComponent();this.NavigationCacheMode =Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;}this.Frame.Navigate(typeof(BasicPage2), tb1.Text);this.Frame.Navigate(typeof(BasicPage2));
  16. 16. DemoAppBars and Navigation
  17. 17. View
  18. 18. View
  19. 19. using System.Linq;using Windows.Foundation;using Windows.Foundation.Collections;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;using Windows.UI.Xaml.Controls.Primitives;using Windows.UI.Xaml.Data;using Windows.UI.Xaml.Input;using Windows.UI.Xaml.Media;using Windows.UI.Xaml.Navigation;using Windows.UI.ViewManagement;namespace ViewsTile{public sealed partial class MainPage : Page{public MainPage(){this.InitializeComponent();SizeChanged += DetailPage_SizeChanged;}void DetailPage_SizeChanged(object sender, SizeChangedEventArgs e) {if (ApplicationView.Value == ApplicationViewState.Snapped) {GridLayout.ColumnDefinitions[0].Width = new GridLength(0);} else {GridLayout.ColumnDefinitions[0].Width = new GridLength(1,GridUnitType.Star);}}}}View
  20. 20. <TextBlock x:Name="textSnap" Text="Kevin R. Octavian snap" Visibility="Collapsed" /><TextBlock x:Name="textOthers" Text="Kevin R. Octavian others" /><VisualStateManager.VisualStateGroups><!-- Visual states reflect the applications view state --><VisualStateGroup x:Name="ApplicationViewStates"><VisualState x:Name="FullScreenLandscape"/><VisualState x:Name="Filled"/><VisualState x:Name="Others"><Storyboard><ObjectAnimationUsingKeyFrames Storyboard.TargetName="textSnap" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="textOthers" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState><!-- The back button and title have different styles when snapped --><VisualState x:Name="Snapped"><Storyboard><ObjectAnimationUsingKeyFrames Storyboard.TargetName="textSnap" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetName="textOthers" Storyboard.TargetProperty="Visibility"><DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup></VisualStateManager.VisualStateGroups>void DetailPage_SizeChanged(object sender, SizeChangedEventArgs e){string stateName = ApplicationView.Value == ApplicationViewState.Snapped ?"Snapped" : "Others"; VisualStateManager.GoToState(this, stateName, false);}View
  21. 21. DemoView
  22. 22. SQLite
  23. 23. http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Create Tabletry{var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data.db3");using (var db = new SQLite.SQLiteConnection(dbpath)){// Create the tables if they dont existdb.CreateTable<person>();db.Commit();db.Dispose();db.Close();}var line = new MessageDialog("Table Created");await line.ShowAsync();}catch{}public class person{[MaxLength(5), PrimaryKey]public String name { get; set; }[MaxLength(255)]public String address { get; set; }[MaxLength(11)]public Double phone { get; set; }}
  24. 24. http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Insert Datavar dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data.db3");using (var db = new SQLite.SQLiteConnection(dbpath)){// Create the tables if they dont existdb.Insert(new person(){name = txt1.Text.ToString(),address = txt2.Text.ToString(),phone = Convert.ToDouble(txt3.Text.ToString()),});db.Commit();db.Dispose();db.Close();var line = new MessageDialog("Records Inserted");await line.ShowAsync();}
  25. 25. http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Select Datavar dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data.db3");using (var db = new SQLite.SQLiteConnection(dbpath)){var d = from x in db.Table<person>() select x;list1.Items.Clear();foreach (var sd in d){list1.Items.Add(sd.name.ToString());//list1.Items.Add(sd.address.ToString());//list1.Items.Add(sd.phone.ToString());}db.Dispose();db.Close();}var line = new MessageDialog("All Records Listed");await line.ShowAsync();
  26. 26. http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882Delete Datavar dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data.db3");using (var db = new SQLite.SQLiteConnection(dbpath)){db.Delete<person>(list1.SelectedItem.ToString());var d = from x in db.Table<person>() select x;list1.Items.Clear();foreach (var sd in d){list1.Items.Add(sd.name.ToString());//list1.Items.Add(sd.address.ToString());//list1.Items.Add(sd.phone.ToString());}db.Dispose();db.Close();}var line = new MessageDialog("Selected Item Deleted");await line.ShowAsync();
  27. 27. DemoSQLite

×