public void Init() { ViewHelper.DefaultViewProperties(this); this.IsOpaque = Me.IsOpaque; Device.OnPlatform( Android: () => { this.Aspect = OnPlatformAspect.GetAndroidValue(Me.Aspect); this.Source = OnPlatformString.GetAndroidValue(Me.Source); }, iOS: () => { this.Aspect = OnPlatformAspect.GetiOSValue(Me.Aspect); this.Source = OnPlatformString.GetiOSValue(Me.Source); }, WinPhone: () => { this.Aspect = OnPlatformAspect.GetWinPhoneValue(Me.Aspect); this.Source = OnPlatformString.GetWinPhoneValue(Me.Source); } ); }
public string GetRootScreen() { string rootScreen = null; Device.OnPlatform( Android: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(this.RootScreen))) { rootScreen = OnPlatformString.GetAndroidValue(this.RootScreen); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(this.RootScreen))) { rootScreen = OnPlatformString.GetiOSValue(this.RootScreen); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(this.RootScreen))) { rootScreen = OnPlatformString.GetWinPhoneValue(this.RootScreen); } } ); return(rootScreen); }
public void Init() { ViewHelper.DefaultViewProperties(this); Device.OnPlatform( Android: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Color))) { this.Color = Color.FromHex(OnPlatformString.GetAndroidValue(Me.Color)); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Color))) { this.Color = Color.FromHex(OnPlatformString.GetAndroidValue(Me.Color)); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Color))) { this.Color = Color.FromHex(OnPlatformString.GetAndroidValue(Me.Color)); } }); }
public void Init() { ViewHelper.DefaultViewProperties(this); this.Intent = Me.Intent; TableRoot root = null; string title = String.Empty; Device.OnPlatform( Android: () => { title = OnPlatformString.GetAndroidValue(Me.Title); }, iOS: () => { title = OnPlatformString.GetiOSValue(Me.Title); }, WinPhone: () => { title = OnPlatformString.GetWinPhoneValue(Me.Title); } ); if (String.IsNullOrEmpty(title)) { root = new TableRoot(); } else { root = new TableRoot(title); } if (Me.Sections.Count > 0) { foreach (BaseSection section in Me.Sections) { TableSection sectionControl = new TableSection(); ProcessSection(sectionControl, section); root.Add(sectionControl); } } this.Root = root; }
internal static void DefaultPageProperties(Page page, MobileScreen Me) { Device.OnPlatform( Android: () => { bool DisplayNav = OnPlatformBool.GetAndroidValue(Me.DisplayNavigationBar); NavigationPage.SetHasNavigationBar(page, DisplayNav); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Title))) { page.Title = OnPlatformString.GetAndroidValue(Me.Title); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.BackgroundColor))) { page.BackgroundColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.BackgroundColor)); } }, iOS: () => { NavigationPage.SetHasNavigationBar(page, OnPlatformBool.GetiOSValue(Me.DisplayNavigationBar)); if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Title))) { page.Title = OnPlatformString.GetiOSValue(Me.Title); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.BackgroundColor))) { page.BackgroundColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.BackgroundColor)); } }, WinPhone: () => { NavigationPage.SetHasNavigationBar(page, OnPlatformBool.GetWinPhoneValue(Me.DisplayNavigationBar)); if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Title))) { page.Title = OnPlatformString.GetWinPhoneValue(Me.Title); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.BackgroundColor))) { page.BackgroundColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.BackgroundColor)); } } ); }
private void InitializeScreen() { PageHelper.DefaultPageProperties(this, Screen); //set navigation screen properties Device.OnPlatform( Android: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.BarBackgroundColor))) { this.BarBackgroundColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.BarBackgroundColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.BarTextColor))) { this.BarTextColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.BarTextColor)); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.BarBackgroundColor))) { this.BarBackgroundColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.BarBackgroundColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.BarTextColor))) { this.BarTextColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.BarTextColor)); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.BarBackgroundColor))) { this.BarBackgroundColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.BarBackgroundColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.BarTextColor))) { this.BarTextColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.BarTextColor)); } } ); }
public void Init() { ViewHelper.DefaultViewProperties(this); Device.OnPlatform( Android: () => { this.Text = OnPlatformString.GetAndroidValue(Me.Text); }, iOS: () => { this.Text = OnPlatformString.GetiOSValue(Me.Text); }, WinPhone: () => { this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); } ); }
public void Init() { ViewHelper.DefaultViewProperties(this); this.IsPassword = Me.IsPassword; Device.OnPlatform( Android: () => { this.Text = OnPlatformString.GetAndroidValue(Me.Text); this.Placeholder = OnPlatformString.GetAndroidValue(Me.Placeholder); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.TextColor)); } }, iOS: () => { this.Text = OnPlatformString.GetiOSValue(Me.Text); this.Placeholder = OnPlatformString.GetiOSValue(Me.Placeholder); if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.TextColor)); } }, WinPhone: () => { this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); this.Placeholder = OnPlatformString.GetWinPhoneValue(Me.Placeholder); if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.TextColor)); } } ); }
private void ProcessSection(TableSection sectionControl, BaseSection section) { if (section is TableSectionControl) { TableSectionControl tableSection = section as TableSectionControl; string sectionTitle = String.Empty; Device.OnPlatform( Android: () => { sectionTitle = OnPlatformString.GetAndroidValue(tableSection.Title); }, iOS: () => { sectionTitle = OnPlatformString.GetiOSValue(tableSection.Title); }, WinPhone: () => { sectionTitle = OnPlatformString.GetWinPhoneValue(tableSection.Title); } ); if (!String.IsNullOrEmpty(sectionTitle)) { sectionControl.Title = sectionTitle; } if (tableSection.Cells.Count > 0) { foreach (BaseCell cell in tableSection.Cells) { ProcessCell(sectionControl, tableSection, cell); } } } }
public void Init() { CellHelper.DefaultViewProperties(this); Device.OnPlatform( Android: () => { this.On = OnPlatformBool.GetAndroidValue(Me.On); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Text))) { this.Text = OnPlatformString.GetAndroidValue(Me.Text); } }, iOS: () => { this.On = OnPlatformBool.GetiOSValue(Me.On); if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Text))) { this.Text = OnPlatformString.GetiOSValue(Me.Text); } }, WinPhone: () => { this.On = OnPlatformBool.GetWinPhoneValue(Me.On); if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Text))) { this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); } } ); this.OnChanged += SwitchCell_OnChanged; }
public void Init() { CellHelper.DefaultViewProperties(this); Device.OnPlatform( Android: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Text))) { this.Text = OnPlatformString.GetAndroidValue(Me.Text); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.TextColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Detail))) { this.Detail = OnPlatformString.GetAndroidValue(Me.Detail); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.DetailColor))) { this.DetailColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.DetailColor)); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Text))) { this.Text = OnPlatformString.GetiOSValue(Me.Text); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.TextColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Detail))) { this.Detail = OnPlatformString.GetiOSValue(Me.Detail); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.DetailColor))) { this.DetailColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.DetailColor)); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Text))) { this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.TextColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Detail))) { this.Detail = OnPlatformString.GetWinPhoneValue(Me.Detail); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.DetailColor))) { this.DetailColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.DetailColor)); } } ); }
internal static void DefaultViewProperties(IView view) { View formView = view.GetView(); BaseControl me = view.BaseControl; Device.OnPlatform( Android: () => { if (OnPlatformDouble.GetAndroidValue(me.HeightRequest) != 0) { formView.HeightRequest = OnPlatformDouble.GetAndroidValue(me.HeightRequest); } if (OnPlatformDouble.GetAndroidValue(me.WidthRequest) != 0) { formView.WidthRequest = OnPlatformDouble.GetAndroidValue(me.WidthRequest); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(me.BackgroundColor))) { formView.BackgroundColor = Color.FromHex(OnPlatformString.GetAndroidValue(me.BackgroundColor)); } if (OnPlatformLayoutOptions.GetAndroidValue(me.HorizontalOptions) != FormLayoutOptions.NotSet) { formView.HorizontalOptions = GetLayoutOptions(me.HorizontalOptions); } if (OnPlatformLayoutOptions.GetAndroidValue(me.VerticalOptions) != FormLayoutOptions.NotSet) { formView.VerticalOptions = GetLayoutOptions(me.VerticalOptions); } }, iOS: () => { if (OnPlatformDouble.GetiOSValue(me.HeightRequest) != 0) { formView.HeightRequest = OnPlatformDouble.GetiOSValue(me.HeightRequest); } if (OnPlatformDouble.GetiOSValue(me.WidthRequest) != 0) { formView.WidthRequest = OnPlatformDouble.GetiOSValue(me.WidthRequest); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(me.BackgroundColor))) { formView.BackgroundColor = Color.FromHex(OnPlatformString.GetiOSValue(me.BackgroundColor)); } if (OnPlatformLayoutOptions.GetiOSValue(me.HorizontalOptions) != FormLayoutOptions.NotSet) { formView.HorizontalOptions = GetLayoutOptions(me.HorizontalOptions); } if (OnPlatformLayoutOptions.GetiOSValue(me.VerticalOptions) != FormLayoutOptions.NotSet) { formView.VerticalOptions = GetLayoutOptions(me.VerticalOptions); } }, WinPhone: () => { if (OnPlatformDouble.GetWinPhoneValue(me.HeightRequest) != 0) { formView.HeightRequest = OnPlatformDouble.GetWinPhoneValue(me.HeightRequest); } if (OnPlatformDouble.GetWinPhoneValue(me.WidthRequest) != 0) { formView.WidthRequest = OnPlatformDouble.GetWinPhoneValue(me.WidthRequest); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(me.BackgroundColor))) { formView.BackgroundColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(me.BackgroundColor)); } if (OnPlatformLayoutOptions.GetWinPhoneValue(me.HorizontalOptions) != FormLayoutOptions.NotSet) { formView.HorizontalOptions = GetLayoutOptions(me.HorizontalOptions); } if (OnPlatformLayoutOptions.GetWinPhoneValue(me.VerticalOptions) != FormLayoutOptions.NotSet) { formView.VerticalOptions = GetLayoutOptions(me.VerticalOptions); } } ); }
internal static void DefaultViewProperties(ICell icell) { Cell cell = icell.GetCell(); BaseCell Me = icell.Cell; cell.IsEnabled = Me.Enabled; Device.OnPlatform( Android: () => { if (OnPlatformDouble.GetAndroidValue(Me.Height) != 0) { cell.Height = OnPlatformDouble.GetAndroidValue(Me.Height); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.ClassID))) { cell.ClassId = OnPlatformString.GetAndroidValue(Me.ClassID); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.StyleID))) { cell.StyleId = OnPlatformString.GetAndroidValue(Me.StyleID); } }, iOS: () => { if (OnPlatformDouble.GetiOSValue(Me.Height) != 0) { cell.Height = OnPlatformDouble.GetiOSValue(Me.Height); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.ClassID))) { cell.ClassId = OnPlatformString.GetiOSValue(Me.ClassID); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.StyleID))) { cell.StyleId = OnPlatformString.GetiOSValue(Me.StyleID); } }, WinPhone: () => { if (OnPlatformDouble.GetWinPhoneValue(Me.Height) != 0) { cell.Height = OnPlatformDouble.GetWinPhoneValue(Me.Height); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.ClassID))) { cell.ClassId = OnPlatformString.GetWinPhoneValue(Me.ClassID); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.StyleID))) { cell.StyleId = OnPlatformString.GetWinPhoneValue(Me.StyleID); } } ); }
public void Init() { ViewHelper.DefaultViewProperties(this); Device.OnPlatform( Android: () => { //this.BorderWidth = OnPlatformInt.GetAndroidValue(Me.BorderWidth); //this.BorderRadius = OnPlatformInt.GetAndroidValue(Me.BorderRadius); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.BorderColor))) { this.BorderColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.BorderColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Image))) { try { this.Image = ImageSource.FromFile(OnPlatformString.GetAndroidValue(Me.Image)) as FileImageSource; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error while trying to load button image {1}: {0} ", ex.Message, Me.Image); } } this.Text = OnPlatformString.GetAndroidValue(Me.Text); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.TextColor)); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.BorderColor))) { this.BorderColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.BorderColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Image))) { try { this.Image = ImageSource.FromFile(OnPlatformString.GetiOSValue(Me.Image)) as FileImageSource; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error while trying to load button image {1}: {0} ", ex.Message, Me.Image); } } this.Text = OnPlatformString.GetiOSValue(Me.Text); if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.TextColor)); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.BorderColor))) { this.BorderColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.BorderColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Image))) { try { this.Image = ImageSource.FromFile(OnPlatformString.GetWinPhoneValue(Me.Image)) as FileImageSource; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error while trying to load button image {1}: {0} ", ex.Message, Me.Image); } } this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.TextColor)); } } ); this.Clicked += Button_Clicked; }
public void Init() { CellHelper.DefaultViewProperties(this); this.Keyboard = CellHelper.GetKeyboard(Me.Keyboard); this.XAlign = CellHelper.GetTextAlignment(Me.XAlign); Device.OnPlatform( Android: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Label))) { this.Label = OnPlatformString.GetAndroidValue(Me.Label); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.LabelColor))) { this.LabelColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.LabelColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Text))) { this.Text = OnPlatformString.GetAndroidValue(Me.Text); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Placeholder))) { this.Placeholder = OnPlatformString.GetAndroidValue(Me.Placeholder); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Label))) { this.Label = OnPlatformString.GetiOSValue(Me.Label); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.LabelColor))) { this.LabelColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.LabelColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Text))) { this.Text = OnPlatformString.GetiOSValue(Me.Text); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Placeholder))) { this.Placeholder = OnPlatformString.GetiOSValue(Me.Placeholder); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Label))) { this.Label = OnPlatformString.GetWinPhoneValue(Me.Label); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.LabelColor))) { this.LabelColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.LabelColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Text))) { this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Placeholder))) { this.Placeholder = OnPlatformString.GetWinPhoneValue(Me.Placeholder); } } ); this.Completed += EntryCell_Completed; }