public LoginView() { InitializeComponent (); grd.Padding = Device.OnPlatform (10, 8, 10); grd.WidthRequest = Device.OnPlatform (300, 400, 300); grd.RowSpacing = Device.OnPlatform (10, 8, 10); lblName.FontSize = Device.OnPlatform (13, 14, 0); lblPassword.FontSize = Device.OnPlatform (13, 14, 0); if (Device.OS == TargetPlatform.Android) { var chk = new CheckBox (){ DefaultText = "Запомнить пароль" }; chk.SetBinding (CheckBox.CheckedProperty, new Binding ("RememberPassword")); stkRemember.Children.Add (chk); } else { var grd = new Grid (); grd.ColumnDefinitions.Add (new ColumnDefinition ()); grd.ColumnDefinitions.Add (new ColumnDefinition (){ Width = GridLength.Auto }); { var lbl = new Label (){ Text = "Запомнить пароль?", VerticalOptions = LayoutOptions.Center, FontSize = 13 }; Grid.SetColumn (lbl, 0); grd.Children.Add (lbl); var swt = new ExtendedSwitch (){ HorizontalOptions = LayoutOptions.End, TintColor = Color.FromHex ("#6f80a4") }; swt.SetBinding (Switch.IsToggledProperty, new Binding ("RememberPassword")); Grid.SetColumn (swt, 1); grd.Children.Add (swt); } stkRemember.Children.Add (grd); } btnLogin.WidthRequest = Device.OnPlatform (-1, 150, 150); Device.StartTimer (TimeSpan.FromSeconds (1), OnTimerTick); }
public void InitControls(TreeMapPrItem navigationObjects) { { var navTree = GetNavMenuTree (navigationObjects); navControl.InitControl (navTree); navControl.SetBinding (ContentView.IsEnabledProperty, new Binding ("ShowLoadingAnimationInverted")); } if (Device.OS == TargetPlatform.Android) { { var goalGroup = new BindableRadioGroup () { Orientation = StackOrientation.Horizontal }; goalGroup.ItemsSource = new List<string> () { "нефть", "обводненность" }; goalGroup.SelectedIndex = 1; goalGroup.SelectedIndex = 0; goalGroup.CheckedChanged += ViewModel.OnSelectedGoalChanged; cnvGoal.Content = goalGroup; } { var rowCountGroup = new BindableRadioGroup () { Orientation = StackOrientation.Horizontal }; rowCountGroup.ItemsSource = new List<string> () { "50", "100", "300" }; rowCountGroup.SelectedIndex = 1; rowCountGroup.SelectedIndex = 0; rowCountGroup.CheckedChanged += ViewModel.OnSelectedCountChanged; cnvRowCount.Content = rowCountGroup; } } else { { var goalSegmentView = new SegmentedControlView (); goalSegmentView.SegmentsItens = "нефть;обводненность"; goalSegmentView.TintColor = Color.FromHex ("#4487CA"); goalSegmentView.PropertyChanged += OnGoalChanged; cnvGoal.Content = goalSegmentView; } { var rowCountSegmentView = new SegmentedControlView (); rowCountSegmentView.SegmentsItens = "50;100;300"; rowCountSegmentView.TintColor = Color.FromHex ("#4487CA"); rowCountSegmentView.PropertyChanged += OnRowCountChanged; cnvRowCount.Content = rowCountSegmentView; } } { Switch swt; if (Device.OS == TargetPlatform.Android) { swt = new Switch (){ HorizontalOptions = LayoutOptions.End }; } else { swt = new ExtendedSwitch (){ HorizontalOptions = LayoutOptions.End, TintColor = Color.FromHex ("#D64B30") }; } swt.SetBinding (Switch.IsToggledProperty, new Binding ("IsRedColor")); swt.SetBinding (View.IsEnabledProperty, new Binding ("ShowLoadingAnimationInverted")); Grid.SetColumn (swt, 2); grdRed.Children.Add (swt); } { Switch swt; if (Device.OS == TargetPlatform.Android) { swt = new Switch (){ HorizontalOptions = LayoutOptions.End }; } else { swt = new ExtendedSwitch (){ HorizontalOptions = LayoutOptions.End, TintColor = Color.FromHex ("#189A55") }; } swt.SetBinding (Switch.IsToggledProperty, new Binding ("IsGreenColor")); swt.SetBinding (View.IsEnabledProperty, new Binding ("ShowLoadingAnimationInverted")); Grid.SetColumn (swt, 2); grdGreen.Children.Add (swt); } { Switch swt; if (Device.OS == TargetPlatform.Android) { swt = new Switch (){ HorizontalOptions = LayoutOptions.End }; } else { swt = new ExtendedSwitch (){ HorizontalOptions = LayoutOptions.End, TintColor = Color.FromHex ("#D1AA12") }; } swt.SetBinding (Switch.IsToggledProperty, new Binding ("IsYellowColor")); swt.SetBinding (View.IsEnabledProperty, new Binding ("ShowLoadingAnimationInverted")); Grid.SetColumn (swt, 2); grdYellow.Children.Add (swt); } }
public ChartSettingsPage() { Title = "настройки"; BackgroundColor = Color.FromHex ("#DCDCDC"); var grd = new Grid () { Padding = Device.OnPlatform (10, 8, 10) }; grd.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); grd.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); grd.RowDefinitions.Add (new RowDefinition ()); { var lbl = new Label () { Text = "ФИЛЬТРЫ", FontSize = 14, HorizontalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold, TextColor = Color.FromHex ("#4487CA") }; Grid.SetRow (lbl, 0); grd.Children.Add (lbl); } { var downGrid = new Grid () { RowSpacing = 10 }; downGrid.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); downGrid.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); downGrid.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); downGrid.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); { var lbl = new Label () { Text = "Скрытие/отображение серий", FontSize = 13 }; Grid.SetRow (lbl, 0); downGrid.Children.Add (lbl); } { var grdSwt = new Grid (); grdSwt.ColumnDefinitions.Add (new ColumnDefinition () { Width = GridLength.Auto }); grdSwt.ColumnDefinitions.Add (new ColumnDefinition ()); var bx = new BoxView () { HeightRequest = Device.OnPlatform (8, 10, 0), WidthRequest = 40, VerticalOptions = LayoutOptions.Center }; bx.SetBinding (BoxView.ColorProperty, new Binding ("WColor")); grdSwt.Children.Add (bx); Switch swt; if (Device.OS == TargetPlatform.Android) { swt = new Switch () { VerticalOptions = LayoutOptions.Center, HeightRequest = 35, HorizontalOptions = LayoutOptions.End }; } else { swt = new ExtendedSwitch () { VerticalOptions = LayoutOptions.Center, HeightRequest = 35, HorizontalOptions = LayoutOptions.End }; swt.SetBinding (ExtendedSwitch.TintColorProperty, new Binding ("WColor")); } swt.SetBinding (Switch.IsToggledProperty, new Binding ("IsWvisible")); Grid.SetColumn (swt, 1); grdSwt.Children.Add (swt); Grid.SetRow (grdSwt, 1); downGrid.Children.Add (grdSwt); } { var grdSwt = new Grid (); grdSwt.ColumnDefinitions.Add (new ColumnDefinition () { Width = GridLength.Auto }); grdSwt.ColumnDefinitions.Add (new ColumnDefinition ()); var bx = new BoxView () { HeightRequest = Device.OnPlatform (8, 10, 0), WidthRequest = 40, VerticalOptions = LayoutOptions.Center }; bx.SetBinding (BoxView.ColorProperty, new Binding ("QnColor")); grdSwt.Children.Add (bx); Switch swt; if (Device.OS == TargetPlatform.Android) { swt = new Switch () { VerticalOptions = LayoutOptions.Center, HeightRequest = 35, HorizontalOptions = LayoutOptions.End }; } else { swt = new ExtendedSwitch () { VerticalOptions = LayoutOptions.Center, HeightRequest = 35, HorizontalOptions = LayoutOptions.End }; swt.SetBinding (ExtendedSwitch.TintColorProperty, new Binding ("QnColor")); } swt.SetBinding (Switch.IsToggledProperty, new Binding ("IsQnVisible")); Grid.SetColumn (swt, 1); grdSwt.Children.Add (swt); Grid.SetRow (grdSwt, 2); downGrid.Children.Add (grdSwt); } { var grdSwt = new Grid (); grdSwt.ColumnDefinitions.Add (new ColumnDefinition () { Width = GridLength.Auto }); grdSwt.ColumnDefinitions.Add (new ColumnDefinition ()); var bx = new BoxView () { HeightRequest = Device.OnPlatform (8, 10, 0), WidthRequest = 40, VerticalOptions = LayoutOptions.Center }; bx.SetBinding (BoxView.ColorProperty, new Binding ("QjColor")); grdSwt.Children.Add (bx); Switch swt; if (Device.OS == TargetPlatform.Android) { swt = new Switch () { VerticalOptions = LayoutOptions.Center, HeightRequest = 35, HorizontalOptions = LayoutOptions.End }; } else { swt = new ExtendedSwitch () { VerticalOptions = LayoutOptions.Center, HeightRequest = 35, HorizontalOptions = LayoutOptions.End }; swt.SetBinding (ExtendedSwitch.TintColorProperty, new Binding ("QjColor")); } swt.SetBinding (Switch.IsToggledProperty, new Binding ("IsQjVisible")); Grid.SetColumn (swt, 1); grdSwt.Children.Add (swt); Grid.SetRow (grdSwt, 3); downGrid.Children.Add (grdSwt); } Grid.SetRow (downGrid, 1); grd.Children.Add (downGrid); } Content = grd; }