public iOSEntryPageCS() { var entry = new Xamarin.Forms.Entry { Placeholder = "Enter text here to see the font size change", FontSize = 22 }; entry.On <iOS>().EnableAdjustsFontSizeToFitWidth(); entry.On <iOS>().SetCursorColor(Color.LimeGreen); var button = new Button { Text = "Toggle AdjustsFontSizeToFitWidth" }; button.Clicked += (sender, e) => { entry.On <iOS>().SetAdjustsFontSizeToFitWidth(!entry.On <iOS>().AdjustsFontSizeToFitWidth()); }; Title = "Entry FontSize and CursorColor"; Content = new StackLayout { Margin = new Thickness(20), Children = { entry, button } }; }
public SettingsPage() { InitializeComponent(); Label groupsLabel = new Label() { Text = "Группы:", FontSize = 20, HorizontalTextAlignment = TextAlignment.Start, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 5.0) }; Label urlLabel = new Label() { Text = "Ссылка:", FontSize = 20, HorizontalTextAlignment = TextAlignment.Start, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 5.0) }; urlEntry = new Entry(); picker = new Picker(); refreshSettings.Command = new Command(async() => { /*await Downloader.GetSchedule(); * groupL = Downloader.GetGroups(Downloader.dataSet.Tables["Речная"]); * picker.ItemsSource = groupL;*/ refreshSettings.IsRefreshing = false; }); picker.Title = "Выберите группу"; urlEntry.Placeholder = "Введите ссылку на расписание"; accept.Margin = new Thickness(0, 0, 10, 0); stackSettings.Children.Add(groupsLabel); stackSettings.Children.Add(picker); stackSettings.Children.Add(urlLabel); stackSettings.Children.Add(urlEntry); }
private void PopulateList() { var stack = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.FillAndExpand }; _listView.HasUnevenRows = true; var filter = new Xamarin.Forms.Entry { HorizontalOptions = LayoutOptions.Center, Placeholder = "filtre por tipo de evento e,g Matutino...", BackgroundColor = Color.FromRgb(60, 171, 223), PlaceholderColor = Color.White }; filter.Completed += this.Entry_Completed; stack.Children.Add(filter); DataTemplate template = new DataTemplate(typeof(CustomCell)); _listView.ItemTemplate = template; _listView.ItemsSource = _feeds; stack.Children.Add(_listView); Content = stack; }
public SettingsPage() { ViewModel.SaveCompleted += HandleSaveCompleted; ViewModel.SaveFailed += HandleSaveFailed; var usernameLabel = new MediumBlueLabel(_gitHubUserName); var usernameEntry = new SettingsEntry(_gitHubUserName) { ReturnType = ReturnType.Next, ReturnCommand = new Command(() => _tokenEntry.Focus()) }; usernameEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(ViewModel.UsernameEntryText)); var tokenLabel = new MediumBlueLabel(_gitHubApiToken); _tokenEntry = new SettingsEntry(_gitHubApiToken) { IsPassword = true, ReturnType = ReturnType.Go }; _tokenEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(ViewModel.TokenEntryText)); _tokenEntry.SetBinding(Xamarin.Forms.Entry.ReturnCommandProperty, nameof(ViewModel.SaveCommand)); var saveButton = new BlueButton { Text = "Save" }; saveButton.SetBinding(Button.CommandProperty, nameof(ViewModel.SaveCommand)); var cancelButton = new BlueButton { Text = "Cancel" }; cancelButton.Clicked += HandleCancelButtonClicked; On <iOS>().SetUseSafeArea(true); BackgroundColor = ColorConstants.LightBlue; Title = "Settings"; Content = new StackLayout { Padding = new Thickness(20), Spacing = 1, Children = { usernameLabel, usernameEntry, tokenLabel, _tokenEntry, saveButton, cancelButton } }; }
public maakonnad() { gr = new Grid { RowDefinitions = { new RowDefinition{Height=new GridLength(1,GridUnitType.Star)}, new RowDefinition{Height=new GridLength(1,GridUnitType.Star)}, }, ColumnDefinitions = { new ColumnDefinition{Width=new GridLength(1,GridUnitType.Star)}, new ColumnDefinition{Width=new GridLength(1,GridUnitType.Star)} } }; ent = new Entry { Text = " " }; pic1 = new Picker { Title = "Уезды" }; pic2 = new Picker { Title = "Столицы уездов" }; pic1.Items.Add("ИДАВИРУМАА"); pic1.Items.Add("ЙЫГЕВАМАА"); pic1.Items.Add("ЛЯЭНЕМАА"); pic1.Items.Add("ЛЯЭНЕ-ВИРУМАА"); pic1.Items.Add("ПЫЛВАМАА"); pic1.Items.Add("ПЯРНУМАА"); pic1.Items.Add("РАПЛАМАА"); pic1.Items.Add("СААРЕМАА"); pic1.Items.Add("ТАРТУМАА"); pic1.Items.Add("ХАРЬЮМАА"); pic1.Items.Add("ХИЙУМАА"); pic1.Items.Add("ЯРВАМАА"); pic1.Items.Add("ВЫРУМАА"); pic1.Items.Add("ВИЛЬЯНДИМАА"); pic1.Items.Add("ВАЛГАМАА"); pic1.SelectedIndexChanged += Pic1_SelectedIndexChanged; pic2.SelectedIndexChanged += Pic2_SelectedIndexChanged; pic2.Items.Add("Йыхви"); pic2.Items.Add("Йыгева"); pic2.Items.Add("Хаапсалу"); pic2.Items.Add("Раквере"); pic2.Items.Add("Пылва"); pic2.Items.Add("Пярну"); pic2.Items.Add("Рапла"); pic2.Items.Add("Курессааре"); pic2.Items.Add("Тарту"); pic2.Items.Add("Таллинн"); pic2.Items.Add("Кярдла"); pic2.Items.Add("Пайде"); pic2.Items.Add("Выру"); pic2.Items.Add("Выру"); pic2.Items.Add("Валга"); gr.Children.Add(pic1, 0, 0); gr.Children.Add(pic2, 1, 0); gr.Children.Add(ent, 1, 1); Content = gr; }
async void NameChanged(object sender, EventArgs e) { Entry entry = (Entry)sender; Team equipe = KTContext.Db.Teams.Find(equipeId); equipe.Name = entry.Text; KTContext.Db.Entry(equipe).State = EntityState.Modified; await KTContext.Db.SaveChangesAsync(); }
async void NameChanged(object sender, EventArgs e) { Entry entry = (Entry)sender; Member membre = KTContext.Db.Members.Find(membreId); membre.Name = entry.Text; KTContext.Db.Entry(membre).State = EntityState.Modified; await KTContext.Db.SaveChangesAsync(); }
private static void AttachEffect(FormsElement element) { IElementController controller = element; if (controller == null || controller.EffectIsAttached(EffectName)) { return; } element.Effects.Add(Effect.Resolve(EffectName)); }
public void ShowDatePicker(Xamarin.Forms.Entry edtDatePicker) { var context = Forms.Context; entAux = edtDatePicker; System.DateTime dteToday = System.DateTime.Today; DatePickerDialog dialog = new DatePickerDialog(context, EventHandler_DatePicker, dteToday.Year, dteToday.Month - 1, dteToday.Day); dialog.DatePicker.MinDate = dteToday.Millisecond; dialog.Show(); }
async void ExperienceChanged(object sender, EventArgs e) { Entry entry = (Entry)sender; Member membre = KTContext.Db.Members.Find(membreId); int x = 0; Int32.TryParse(entry.Text, out x); membre.Xp = x; KTContext.Db.Entry(membre).State = EntityState.Modified; await KTContext.Db.SaveChangesAsync(); }
public RenamePage() { var entry = new Xamarin.Forms.Entry { Text = renameModelInfo.title }; var buttonCancel = new Button { Text = "Cancel" }; buttonCancel.Clicked += async(object sender, EventArgs e) => { await MainTabbedPage.theModelListPageNavigation.PopAsync(); }; var buttonDone = new Button { Text = "Done" }; buttonDone.Clicked += async(object sender, EventArgs e) => { renameModelInfo.title = entry.Text; MainTabbedPage.theModelEntryPage.modelInfo = renameModelInfo; MainTabbedPage.theModelEntryPage.Overwrite(); MainTabbedPage.theModelListPage.RegenerateList(); await MainTabbedPage.theModelListPageNavigation.PopAsync(); }; var layout = new StackLayout { Padding = 10, BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Children = { new Label { Text = "Rename to" }, entry, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { buttonCancel, buttonDone, } } } }; Content = layout; }
internal static bool HasDefaultFont(this Xamarin.Forms.Entry button) { if (button.FontFamily != null || button.FontAttributes != FontAttributes.None) { return(false); } var getNamedSize = typeof(Device).GetRuntimeMethod("GetNamedSize", new Type[] { typeof(NamedSize), typeof(Type), typeof(bool) }); if (getNamedSize != null) { var result = (double)getNamedSize.Invoke(null, new object[] { NamedSize.Default, typeof(Label), true }); return(result == button.FontSize); } return(false); }
private static void DetachEffect(FormsElement element) { IElementController controller = element; if (controller == null || !controller.EffectIsAttached(EffectName)) { return; } var toRemove = element.Effects.FirstOrDefault(e => e.ResolveId == Effect.Resolve(EffectName).ResolveId); if (toRemove != null) { element.Effects.Remove(toRemove); } }
public EmbeddedResourceFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; //label.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(label); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; editor.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; entry.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; button.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); Content = new StackLayout { Children = { label, editor, entry, button } }; }
public CustomFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; label.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; editor.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; entry.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; button.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); Content = new StackLayout { Children = { label, editor, entry, button } }; }
public EntryHandler(NativeComponentRenderer renderer, XF.Entry entryControl) : base(renderer, entryControl) { EntryControl = entryControl ?? throw new ArgumentNullException(nameof(entryControl)); EntryControl.Completed += (s, e) => { if (CompletedEventHandlerId != default) { renderer.Dispatcher.InvokeAsync(() => renderer.DispatchEventAsync(CompletedEventHandlerId, null, e)); } }; EntryControl.TextChanged += (s, e) => { if (TextChangedEventHandlerId != default) { renderer.Dispatcher.InvokeAsync(() => renderer.DispatchEventAsync(TextChangedEventHandlerId, null, new ChangeEventArgs { Value = EntryControl.Text })); } }; }
protected override void OnAttached() { if(this.Element is Xamarin.Forms.Label) { _formsLabel = (Xamarin.Forms.Label)this.Element; UpdateLabelFont(); } if(this.Element is Xamarin.Forms.Entry) { _formsEntry = (Xamarin.Forms.Entry)this.Element; UpdateEntryFont(); } if(this.Element is Xamarin.Forms.Editor) { _formsEditor = (Xamarin.Forms.Editor)this.Element; UpdateEditorFont(); } }
public iOSFirstResponderPageCS() { Xamarin.Forms.Entry firstEntry = new Xamarin.Forms.Entry { Placeholder = "First Entry" }; Button firstButton = new Button { Text = "OK" }; Xamarin.Forms.Entry secondEntry = new Xamarin.Forms.Entry { Placeholder = "Second Entry" }; Button secondButton = new Button { Text = "OK" }; secondButton.On <iOS>().SetCanBecomeFirstResponder(true); Title = "VisualElement first responder"; Content = new StackLayout { Margin = new Thickness(10), Children = { new Label { Text = "Click in the first Entry to make the keyboard appear. Then click OK and the keyboard should disappear." }, firstEntry, firstButton, new Label { Text = "Click in the second Entry to make the keyboard appear. Then click OK and the keyboard shouldn't disappear." }, secondEntry, secondButton } }; }
public AndroidEntryPageCS() { var items = new List <string>(); items.Add(ImeFlags.Default.ToString()); items.Add(ImeFlags.None.ToString()); items.Add(ImeFlags.Go.ToString()); items.Add(ImeFlags.Search.ToString()); items.Add(ImeFlags.Send.ToString()); items.Add(ImeFlags.Next.ToString()); items.Add(ImeFlags.Done.ToString()); items.Add(ImeFlags.Previous.ToString()); items.Add(ImeFlags.NoPersonalizedLearning.ToString()); items.Add(ImeFlags.NoFullscreen.ToString()); items.Add(ImeFlags.NoExtractUi.ToString()); items.Add(ImeFlags.NoAccessoryAction.ToString()); _entry = new Xamarin.Forms.Entry { Placeholder = "User the Picker to set ImeOptions", FontSize = 22 }; _label = new Label { Text = "ImeOptions: ", FontSize = 20 }; _picker = new Picker { Title = "Select ImeOptions" }; _picker.ItemsSource = items; _picker.SelectedIndexChanged += OnSelectedIndexChanged; Title = "Entry ImeOptions"; Content = new StackLayout { Margin = new Thickness(20), VerticalOptions = LayoutOptions.StartAndExpand, Children = { _entry, _label, _picker } }; }
private void Quantity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { //quantity has changed in the ObservableCollection - update the actual backing store - what needs to happen is the consolidation of all the different DTO types //at the very least, a common base class of WorkOrderViewModel Xamarin.Forms.Entry entry = sender as Xamarin.Forms.Entry; if (entry != null) { string strQty = entry.Text; if (!String.IsNullOrEmpty(strQty)) { int qty = Convert.ToInt32(strQty); } foreach (WorkOrderInventoryItemDTO dto in workOrderInventoryList) { WorkOrderViewModel wovm = null; if (((ObservableCollection <WorkOrderViewModel>)InventoryItemsListView.ItemsSource).Where(a => a.InventoryId == dto.InventoryId).Any()) { wovm = ((ObservableCollection <WorkOrderViewModel>)InventoryItemsListView.ItemsSource).Where(a => a.InventoryId == dto.InventoryId).First(); dto.Quantity = wovm.Quantity; } } foreach (NotInInventoryDTO dto in notInInventory) { WorkOrderViewModel wovm = null; if (((ObservableCollection <WorkOrderViewModel>)InventoryItemsListView.ItemsSource).Where(a => a.InventoryId == dto.NotInInventoryId).Any()) { wovm = ((ObservableCollection <WorkOrderViewModel>)InventoryItemsListView.ItemsSource).Where(a => a.NotInInventoryId == dto.NotInInventoryId).First(); dto.NotInInventoryQuantity = wovm.Quantity; } } } }
private void searchBar_TextChanged_Destination(object sender, TextChangedEventArgs e) { Xamarin.Forms.Entry bar = (Xamarin.Forms.Entry)sender; if (bar.Text.Length <= 2) { if (bar.Text.Length == 0) { viewModel._destinationLatitude = null; viewModel._destinationLongitude = null; } searchResultsDestination.IsVisible = false; viewModel.DestinationLocation = bar.Text; } else { if (j % 2 != 0) { searchResultsDestination.IsVisible = true; viewModel.GetAutoCompleteSuggestionsDestination.Execute(bar.Text); viewModel.DestinationLocation = bar.Text; } j++; } }
public dataPicker() { Grid gr = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, } }; pick = new Xamarin.Forms.Picker { Title = "keeld" }; pick.Items.Add("C#"); pick.Items.Add("python"); pick.Items.Add("C++"); pick.Items.Add("VisualBasic"); pick.Items.Add("Java"); gr.Children.Add(pick, 0, 0); pick.SelectedIndexChanged += Pick_SelectedIndexChanged; editor = new Editor { Placeholder = "vali keel" }; editor = new Editor { Placeholder = "vali keel nimekirjas" }; gr.Children.Add(editor, 1, 0); dpicker = new DatePicker { Format = "D", MinimumDate = DateTime.Now.AddDays(-10), MaximumDate = DateTime.Now.AddDays(10), }; dpicker.DateSelected += Dpicker_DateSelected; gr.Children.Add(dpicker, 1, 1); entry = new Entry { Text = "vali kuupäev" }; timepicker = new TimePicker() { Time = new TimeSpan(DateTime.Now.Hour + 2, DateTime.Now.Minute, DateTime.Now.Second) }; Content = gr; frame = new Frame() { BorderColor = Color.Purple, HasShadow = true, BackgroundColor = Color.LightBlue, Content = new Label { Text = "хаю-хай" } }; }
public CollectionView ParameterView() { CollectionView collectionView = new CollectionView() { ItemsLayout = new GridItemsLayout(1, ItemsLayoutOrientation.Vertical), SelectionMode = SelectionMode.None }; collectionView.ItemsSource = new ObservableCollection <ParameterBinding>(); // CollectionView contains ParameterBindings with bindings set in ItemTemplate, ugh! collectionView.ItemTemplate = new DataTemplate(() => { // CollectionView contains ParameterBindings with bindings set in ItemTemplate, ugh! Grid grid = new Grid { Padding = 2 }; grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(ParameterItemHeight) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = 75 }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); Xamarin.Forms.Entry slider = new Xamarin.Forms.Entry { FontSize = 10, FontAttributes = FontAttributes.Bold, VerticalTextAlignment = TextAlignment.Center }; slider.SetBinding(Xamarin.Forms.Entry.TextProperty, "Value"); // property of ParameterBinding, ugh! slider.TextChanged += (object source, TextChangedEventArgs e) => { if (slider.BindingContext == null) { return; } ParameterBinding parameterBinding = (ParameterBinding)slider.BindingContext; // the implicit binding context, ugh! lock (KControls.parameterLock) { if ((!KControls.parameterStateDict.ContainsKey(parameterBinding.Parameter)) || (!KControls.parameterInfoDict.ContainsKey(parameterBinding.Parameter))) { return; } ParameterInfo info = KControls.parameterInfoDict[parameterBinding.Parameter]; KControls.ParameterState state = KControls.parameterStateDict[parameterBinding.Parameter]; try { state.value = double.Parse((source as Xamarin.Forms.Entry).Text); } catch { } info.drawn = state.value; parameterBinding.Format = info.ParameterLabel(); //RefreshParameters(); // No longer needed, and it now seems to mess up the rows. OLD: otherwise formatLabel does not update even though it has a data binding, ugh! } }; Switch switcher = new Switch(); switcher.SetBinding(Switch.IsToggledProperty, "Locked"); // property of ParameterBinding, ugh! switcher.Toggled += (object source, ToggledEventArgs e) => { if (switcher.BindingContext == null) { return; // ugh! } ParameterBinding parameterBinding = (ParameterBinding)switcher.BindingContext; // the implicit binding context, ugh! lock (KControls.parameterLock) { if (!KControls.parameterInfoDict.ContainsKey(parameterBinding.Parameter)) { return; } ParameterInfo parameterInfo = KControls.parameterInfoDict[parameterBinding.Parameter]; parameterInfo.locked = (source as Switch).IsToggled; } }; Label formatLabel = new Label { FontSize = 12, FontAttributes = FontAttributes.Bold, VerticalTextAlignment = TextAlignment.Center }; formatLabel.SetBinding(Label.TextProperty, "Format"); // property of ParameterBinding, ugh! grid.Children.Add(switcher, 0, 0); grid.Children.Add(slider, 1, 0); grid.Children.Add(formatLabel, 2, 0); return(grid); }); return(collectionView); }
//METHODS /********************************************************************** *********************************************************************/ void CreateContent() { var scrollView = new Xamarin.Forms.ScrollView { Margin = new Thickness(10) }; var stackLayout = new StackLayout(); var stackLayout2 = new StackLayout { Orientation = StackOrientation.Horizontal }; var stackLayout3 = new StackLayout { Orientation = StackOrientation.Horizontal }; this.Content = scrollView; scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content //add elements to stackLayout2 var l_Zero = new Label { Text = "0", VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = App._textFontSize }; e_Sequence = new Xamarin.Forms.Entry { Keyboard = Keyboard.Numeric, Text = "12340156012356", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalTextAlignment = TextAlignment.Center, FontSize = App._textFontSize }; stackLayout2.Children.Add(l_Zero); stackLayout2.Children.Add(e_Sequence); //add elements to stackLayout3 var l_RAM = new Label { Text = "RAM:", FontSize = App._textFontSize, VerticalOptions = LayoutOptions.Center }; p_RAM = new Xamarin.Forms.Picker() { FontSize = App._textFontSize }; p_RAM.Items.Add("1"); p_RAM.Items.Add("2"); p_RAM.Items.Add("3"); p_RAM.Items.Add("4"); p_RAM.Items.Add("5"); p_RAM.Items.Add("6"); p_RAM.Items.Add("7"); p_RAM.SelectedIndex = 2; //"3" var l_Space3 = new Label { Text = " " }; string dtext = App._disk + ":"; var l_DISC = new Label { Text = dtext, FontSize = App._textFontSize, VerticalOptions = LayoutOptions.Center }; p_disk = new Xamarin.Forms.Picker() { FontSize = App._textFontSize }; p_disk.Items.Add("1"); p_disk.Items.Add("2"); p_disk.Items.Add("3"); p_disk.Items.Add("4"); p_disk.Items.Add("5"); p_disk.Items.Add("6"); p_disk.Items.Add("7"); p_disk.SelectedIndex = 3; //"4" stackLayout3.Children.Add(l_RAM); stackLayout3.Children.Add(p_RAM); stackLayout3.Children.Add(l_Space3); stackLayout3.Children.Add(l_DISC); stackLayout3.Children.Add(p_disk); //add elements to StackLayout var l_Strategy = new Label { Text = "Strategy", FontSize = App._h3FontSize, }; p_Strategy = new Xamarin.Forms.Picker { Title = "Select a Strategy", FontSize = App._textFontSize }; p_Strategy.Items.Add("Optimal Strategy"); p_Strategy.Items.Add("FIFO"); p_Strategy.Items.Add("FIFO Second Chance"); p_Strategy.Items.Add("RNU FIFO"); p_Strategy.Items.Add("RNU FIFO Second Chance"); p_Strategy.SelectedIndex = 0; //"Optimal Strategy" var l_Space = new Label { Text = " " }; var l_Sequence = new Label { Text = "Reference Sequence", FontSize = App._h3FontSize }; var b_DefaultValue = new Button { Text = "Default", HorizontalOptions = LayoutOptions.Start, BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._smallButtonFontSize }; b_DefaultValue.Clicked += B_DefaultValue_Clicked; var l_Space2 = new Label { Text = " " }; var l_MemorySize = new Label { Text = "Memory Size", FontSize = App._h3FontSize }; var l_MaxSize = new Label { FontSize = App._smallTextFontSize, Text = "Maximal size of RAM and " + App._disk + " together: 8" }; var l_Space4 = new Label { Text = " " }; var b_Start = new Button { Text = "Start", BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Start.Clicked += B_Start_Clicked; //add Click Event(Method) stackLayout.Children.Add(l_Strategy); stackLayout.Children.Add(p_Strategy); stackLayout.Children.Add(l_Space); stackLayout.Children.Add(l_Sequence); stackLayout.Children.Add(stackLayout2); //Stacklayout2 is nested stackLayout.Children.Add(b_DefaultValue); stackLayout.Children.Add(l_Space2); stackLayout.Children.Add(l_MemorySize); stackLayout.Children.Add(stackLayout3);//Stacklayout3 is nested stackLayout.Children.Add(l_MaxSize); stackLayout.Children.Add(l_Space4); stackLayout.Children.Add(b_Start); //note : a space label element can somehow only be added once, therefore I needed to define 4 of them }
/********************************************************************** ***********************************************************************/ void CreateBottomHalf(Grid grid) { var controlsGrid = new Grid() { RowDefinitions = { new RowDefinition() }, ColumnDefinitions = { new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) } }, VerticalOptions = LayoutOptions.Center, }; var stackLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Margin = new Thickness(5), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; // restart button b_Restart = new Button { Text = "Restart", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Restart.Clicked += B_Restart_Clicked; b_Restart.IsEnabled = false; controlsGrid.Children.Add(b_Restart, 0, 0); // entry for entering memory request var l_MemoryRequest = new Label { Text = "Memory request: ", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.End, FontSize = App._labelFontSize }; e_MemoryRequest = new Xamarin.Forms.Entry { Keyboard = Keyboard.Numeric, //only numbers are allowed VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Fill, //BackgroundColor = Color.WhiteSmoke, FontSize = App._entryFontSize, TextColor = Color.Black, MaxLength = 3 }; e_MemoryRequest.WidthRequest = 50; stackLayout.Children.Add(l_MemoryRequest); stackLayout.Children.Add(e_MemoryRequest); controlsGrid.Children.Add(stackLayout, 1, 0); // next button b_Next = new Button { Text = "Confirm", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Next.Clicked += B_Next_Clicked; controlsGrid.Children.Add(b_Next, 2, 0); // add content to bottom half of grid grid.Children.Add(controlsGrid, 0, 1); }
public ChrisEmbeddedResourceFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; label.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; editor.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; entry.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; button.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var F9Plabel1 = new Forms9Patch.Label { Text = "Forms9Patch.Label - luximb", FontFamily = "Forms9PatchDemo.Resources.Fonts.luximb.ttf" }; var F9Plabel2 = new Forms9Patch.Label { Text = "Forms9Patch.Label - CPMono", FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07_Bold.otf" }; var F9Plabel3 = new Forms9Patch.Label { Text = "Forms9Patch.Label - default FontFamily", // FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07 Bold.otf" }; Content = new StackLayout { Children = { label, editor, entry, button, F9Plabel1, F9Plabel2, F9Plabel3 } }; }
public EntryHandler(NativeComponentRenderer renderer, XF.Entry entryControl) : base(renderer, entryControl) { EntryControl = entryControl ?? throw new ArgumentNullException(nameof(entryControl)); Initialize(renderer); }
public Osnova() { InitializeComponent(); Grid grd = new Grid(); Picker pick; //------------------------------------------------------------ //Колонны ColumnDefinition colDef1 = new ColumnDefinition(); ColumnDefinition colDef2 = new ColumnDefinition(); grd.ColumnDefinitions.Add(colDef1); grd.ColumnDefinitions.Add(colDef2); //Ряды RowDefinition rowDef1 = new RowDefinition(); RowDefinition rowDef2 = new RowDefinition(); RowDefinition rowDef3 = new RowDefinition(); grd.RowDefinitions.Add(rowDef1); grd.RowDefinitions.Add(rowDef2); grd.RowDefinitions.Add(rowDef3); //------------------------------------------------------------- //Datepicker date = new DatePicker { Format = "D", MinimumDate = DateTime.Now.AddDays(-10), MaximumDate = DateTime.Now.AddDays(+10), }; date.DateSelected += Date_DateSelected; grd.Children.Add(date, 0, 1); //Picker pick = new Picker { Title = "Choose language" }; pick.Items.Add("C#"); pick.Items.Add("Python"); pick.Items.Add("C++"); pick.Items.Add("BisualBasic"); pick.Items.Add("Java"); pick.SelectedIndexChanged += Pick_SelectedIndexChanged; grd.Children.Add(pick, 0, 0); //Editor edit = new Editor { Placeholder = "Choose language \nIn left column" }; grd.Children.Add(edit, 1, 0); //Entry entr = new Entry { Text = "Choose date", }; grd.Children.Add(entr, 1, 1); //Frame frm = new Frame { BackgroundColor = Color.LightGray }; { }; grd.Children.Add(frm, 0, 2); Grid.SetColumnSpan(frm, 2); //Timepicker СИНХРОНИЗИРОВАННОЕ ВРЕМЯ!!! ------------------------------------------------------------------------------------------------- /* time = new TimePicker * { * Time = new TimeSpan(18, 0, 0), * Time = new TimeSpan (DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) * }; * grd.Children.Add(time, 1, 1); */ Content = grd; }
public ChrisEmbeddedResourceFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(label); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(editor); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(entry); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(button); var F9Plabel1 = new Forms9Patch.Label { Text = "Forms9Patch.Label - luximb", FontFamily = "Forms9PatchDemo.Resources.Fonts.luximb.ttf", //TextColor = Color.Black }; var F9Plabel2 = new Forms9Patch.Label { Text = "Forms9Patch.Label - CPMono", FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07_Bold.otf", //TextColor = Color.Black }; var F9Plabel3 = new Forms9Patch.Label { Text = "Forms9Patch.Label - default FontFamily", // FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07 Bold.otf" //TextColor = Color.Black }; Content = new StackLayout { Children = { label, editor, entry, button, F9Plabel1, F9Plabel2, F9Plabel3 } }; }
//METHODS /********************************************************************** *********************************************************************/ void CreateContent() { // View var scrollView = new Xamarin.Forms.ScrollView { Margin = new Thickness(10) }; var stackLayout = new StackLayout(); this.Content = scrollView; scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content // Algorithm selection var l_Algorithm = new Label { Text = "Algorithm", FontSize = App._h3FontSize }; p_Algorithm = new Xamarin.Forms.Picker { Title = "Select a Strategy", FontSize = App._textFontSize }; p_Algorithm.Items.Add("First Fit"); p_Algorithm.Items.Add("Next Fit"); p_Algorithm.Items.Add("Best Fit"); p_Algorithm.Items.Add("Worst Fit"); p_Algorithm.Items.Add("Combined Fit"); p_Algorithm.SelectedIndex = 0; //pre selects First Fit var l_Space = new Label { Text = " " }; stackLayout.Children.Add(l_Algorithm); stackLayout.Children.Add(p_Algorithm); stackLayout.Children.Add(l_Space); // Fragmentation input var l_Fragmentation = new Label { Text = "Fragmentation", FontSize = App._h3FontSize }; e_Fragmentation = new Xamarin.Forms.Entry { Keyboard = Keyboard.Telephone, Text = "10,4,20,18,7,9,12,15", FontSize = App._textFontSize }; var b_Default = new Button { Text = "Default", HorizontalOptions = LayoutOptions.Start, BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._smallButtonFontSize }; b_Default.Clicked += (sender, e) => e_Fragmentation.Text = "10,4,20,18,7,9,12,15"; var l_Space2 = new Label { Text = " " }; stackLayout.Children.Add(l_Fragmentation); stackLayout.Children.Add(e_Fragmentation); stackLayout.Children.Add(b_Default); stackLayout.Children.Add(l_Space2); // Application Start var b_Start = new Button { Text = "Start", BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Start.Clicked += B_Start_Clicked; stackLayout.Children.Add(b_Start); }
public LoginPage() { ViewModel = new BaseViewModel{}; BindingContext = ViewModel; DeviceDetail.UserKey = ""; _database = new TokenDatabase(); var layout = new StackLayout { Padding = 10}; _message = new Label { Text = "", FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)), VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, TextColor = Color.Red }; var imgLogoImage = new Image {Source = "ecs.png"}; layout.Children.Add(imgLogoImage); var spacer = new Label { Text = "", FontSize = 15, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, }; var version = new Label { Text = "Version (0.0.0.2)", FontFamily = "HelveticaNeue-Medium", FontSize = 15, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, }; layout.Children.Add (spacer); layout.Children.Add(version); _username = new Entry { Placeholder = "Username"}; layout.Children.Add(_username); _password = new Entry { Placeholder = "Password", IsPassword = true }; layout.Children.Add(_password); loginButton = new Button { Text = "Sign In" }; loginButton.Clicked += async (sender, args) => await ValidateUser(_username.Text, _password.Text); layout.Children.Add(loginButton); layout.Children.Add(_message); // here's your activity indicator, it's bound to the IsBusy property of the BaseViewModel // those bindings are on both the visibility property as well as the IsRunning property var activityIndicator = new ActivityIndicator { Color = Color.Black }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); layout.Children.Add(activityIndicator); var placeHolder = new Label { Text = "This software is proprietary and confidential to ECS and by using this software you agree that no part of the document that you would view may be disclosed in any manner to a third party without the prior written consent.", FontSize = Device.GetNamedSize(NamedSize.Default, typeof (Label)), VerticalOptions = LayoutOptions.Center, TextColor = Color.Black }; layout.Children.Add(placeHolder); Content = new ScrollView() { Padding = 10, VerticalOptions = LayoutOptions.Start, Content = layout }; }
public GraphsPage() { Title = "BP Readings"; List <BPMRecords> Allrecord = new List <BPMRecords>(); List <BPMRecords> record = new List <BPMRecords>(); //BPMRecords recode = new BPMRecords(3, 1, 2018, 138.02, 92.02, 105); //records(recode); #if __IOS__ var resourcePrefix = "MoniHealth.iOS.Resources."; #endif #if __ANDROID__ var resourcePrefix = "MoniHealth.Android.Resources."; #else var resourcePrefix = "MoniHealth.Pages."; #endif var editor = new Label { Text = "loading...", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; #region How to load a text file embedded resource var assembly = IntrospectionExtensions.GetTypeInfo(typeof(GraphsPage)).Assembly; Stream stream = assembly.GetManifestResourceStream(resourcePrefix + "tempdata.txt"); string text = ""; string alltext = ""; int count = 0; using (var reader = new StreamReader(stream)) { while ((text = reader.ReadLine()) != null) { alltext = alltext + "\n" + text; Allrecord.Add(new BPMRecords(text)); count = count + 1; } //text = reader.ReadLine(); } #endregion editor.Text = alltext; //record.Add(new BPMRecords(text)); //record.Add(new BPMRecords("1-Mar-18", 138.12, 85.12, 105)); var Lastest = new Label { Text = " ", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; var specificDates = new Label { Text = "", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; Button Submit = new Button { Text = " Submit ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; Entry StartDate = new Entry { Keyboard = Keyboard.Text, FontSize = 10, Placeholder = "Enter Start Date", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; Entry EndDate = new Entry { Keyboard = Keyboard.Text, FontSize = 10, Placeholder = "Enter End Date", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; Button ViewGraph = new Button { Text = " ViewGraph ", Font = Font.SystemFontOfSize(NamedSize.Small), BorderWidth = 1, BorderColor = Color.Silver, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start }; ViewGraph.Clicked += ViewGraphButton; Lastest.Text = Allrecord[count - 1].readingToString(); Last = Allrecord[count - 1]; record = Allrecord.Where(x => x.Month == 6 && x.Year == 2018).ToList(); foreach (var reading in record) { specificDates.Text = specificDates.Text + reading.readingToString() + "\n"; } /*Button createButton = new Button * { * * Text = "Create Account", * Font = Font.SystemFontOfSize(NamedSize.Small), * BorderWidth = 1, * HorizontalOptions = LayoutOptions.Center, * VerticalOptions = LayoutOptions.CenterAndExpand * }; * createButton.Clicked += OnButtonClicked;*/ /*StackLayout stackLayout = new StackLayout { }; * * stackLayout.Children.Add(editor); * Content = new ScrollView * { * Content = stackLayout * };*/ /*List<Entry> entries = new List<Entry> * {new Entry((float)record[count-2].Systolic) * { * Color = SKColor.Parse("#FF1493"), * Label = record[count-2].Date, * ValueLabel = record[count - 2].Systolic.ToString() * }, * * new Entry((float)record[count-1].Systolic) * { * Color = SKColor.Parse("#AA1493"), * Label = record[count-1].Date, * ValueLabel = record[count - 1].Systolic.ToString() * } * * };*/ /*List<Entry> entries = new List<Entry> { }; * double findmin = 300; * for (int i = 0; i <= 7; i++) * { * entries.Add(new Entry((float)record[i].Systolic)); * entries[i].Label = record[i].Date; * entries[i].ValueLabel = record[i].Systolic.ToString(); * entries[i].Color = SKColor.Parse("#FF1493"); * * * if (findmin >= record[i].Systolic) * { * findmin = record[i].Systolic; * } * } * * * * ChartView chart1 = new ChartView * { * Chart = new LineChart { Entries = entries, MinValue = (int)findmin, }, * HeightRequest = 160, * //Chart.DrawCaptionElements() * * };*/ /*try * { * Content = chart1; * } * catch (Exception e) * { * if (e.InnerException != null) * { * string err = e.InnerException.Message; * } * }*/ StackLayout stackLayout = new StackLayout { Margin = new Thickness(20), VerticalOptions = LayoutOptions.StartAndExpand, Children = { /*new Label { Text = (recode[0].ToStringArray()), * FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)), * FontAttributes = FontAttributes.Bold}*/ /*chart1,*/ Lastest, StartDate, EndDate, Submit, ViewGraph, specificDates, editor } }; Content = new ScrollView { Content = stackLayout, }; }