private void RebuildDetails() { CustomDetailRoot.Clear(); DefaultLabel.Clear(); var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations"); var count = bifurcationsProp.GetProperty().arraySize; for (int i = 0; i < count; i++) { var bifurcationBox = new VisualElement(); var item = bifurcationsProp.GetArrayElementAt(i); var labelProp = item.GetChildProperty("label").GetProperty(); var a = new Foldout(); a.text = $"「{labelProp.stringValue}」"; // new Label($"「{labelProp.stringValue}」"); var toggle = a.Q <Toggle>(); toggle.style.marginBottom = 0f; a.style.marginTop = 10f; toggle.style.backgroundColor = new Color(0, 0, 0, 0.5f); bifurcationBox.Add(a); DefaultLabel.Add(a); var l = new CommandListView(CommandItem.ParentList, item.GetChildProperty("commandList.commands")); a.Add(l); CustomDetailRoot.Add(bifurcationBox); } }
private void AddNewXYFields(int index) { TableLayoutPanel[] tableColl = new TableLayoutPanel[2] { this.InputTableLayout, this.OutputTableLayout }; string type = "Input"; foreach (TableLayoutPanel table in tableColl) { Label label = new DefaultLabel(type + index, index + ":"); TextBox xTextBox = new DefaultInput("X" + type + index, this.ImaginaryMessage); //xTextBox.Text = xTextBox.Name; TextBox yTextBox = new DefaultInput("Y" + type + index, this.ImaginaryMessage); //yTextBox.Text = yTextBox.Name; table.Controls.Add(label, 0, index - 1); if (type.Equals("Input")) { listXInput.Add(xTextBox); listYInput.Add(yTextBox); table.Controls.Add(xTextBox, 1, index - 1); table.Controls.Add(yTextBox, 2, index - 1); } else { listXResult.Add(xTextBox); listYResult.Add(yTextBox); table.Controls.Add(xTextBox, 2, index - 1); //поменял 1 и 2 местами table.Controls.Add(yTextBox, 1, index - 1); // } table.RowStyles.Add(new RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); table.RowCount++; type = "Result"; } }
private void RemoveBifurcation(int index) { //データの更新 var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations"); bifurcationsProp.DeleteArrayElementAt(index); bifurcationsProp.SerializedObject.ApplyModifiedProperties(); //UIの更新 //リストの追加 CustomDetailRoot.RemoveAt(index); DefaultLabel.RemoveAt(index); //CommandEditorの更新 RebuildCommandEditor(); }
public TopPanelItem(string title, View contentView = null, bool isSelected = false) { HorizontalOptions = LayoutOptions.FillAndExpand; Padding = 8; titleLabel = new DefaultLabel { Text = title, HorizontalOptions = LayoutOptions.CenterAndExpand, FontAttributes = FontAttributes.Bold, CustomFontSize = NamedSize.Small }; IsSelected = isSelected; ContentView = contentView; GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => OnTap.Dispatch()) }); Content = titleLabel; }
private void AddBifurcation(int index) { //データの更新 var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations"); bifurcationsProp.InsertArrayElementAt(index); bifurcationsProp.SerializedObject.ApplyModifiedProperties(); //UIの更新 //リストの追加 var bifurcationBox = new VisualElement(); var item = bifurcationsProp.GetArrayElementAt(index); var labelProp = item.GetChildProperty("label").GetProperty(); var a = new Foldout(); a.text = $"「{labelProp.stringValue}」"; var toggle = a.Q <Toggle>(); toggle.style.marginBottom = 0f; a.style.marginTop = 10f; toggle.style.backgroundColor = new Color(0, 0, 0, 0.5f); bifurcationBox.Add(a); DefaultLabel.Insert(index, a); item.GetProperty().FindPropertyRelative("commandList.commands").arraySize = 0; bifurcationsProp.SerializedObject.ApplyModifiedProperties(); var commandArrayProp = item.GetChildProperty("commandList.commands"); var l = new CommandListView(CommandItem.ParentList, commandArrayProp); a.Add(l); CustomDetailRoot.Insert(index, bifurcationBox); bifurcationsProp.SerializedObject.ApplyModifiedProperties(); //CommandEditorの更新 RebuildCommandEditor(); }
public TaskPopup(TodoTask task, Action onCancel = null, Action onSubmit = null) { Task = task; SelectedDate = task.date; timePicker.Time = task.date.TimeOfDay; BackgroundColor = StyleManager.MainColor; WidthRequest = 300; titleLabel = new DefaultLabel { Text = Task.title, HorizontalOptions = LayoutOptions.CenterAndExpand }; titleEdit = new DefaultEntry { Text = Task.title, HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.Transparent }; titleEdit.WidthRequest = 250; var editButton = new Image { HorizontalOptions = LayoutOptions.End, Source = "edit_task.png" }; var doneButton = new Image { HorizontalOptions = LayoutOptions.End, Source = "ok.png" }; titlePanel = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 10, Children = { titleLabel, editButton } }; var editPanel = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 0), Children = { titleEdit, doneButton } }; topPanel = new ContentView { HorizontalOptions = LayoutOptions.FillAndExpand, Content = titlePanel, }; editButton.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => Device.BeginInvokeOnMainThread(() => { topPanel.Content = editPanel; titleEdit.Focus(); })) }); doneButton.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => Device.BeginInvokeOnMainThread(UpdateTitle)) }); if (string.IsNullOrWhiteSpace(task.title)) { Device.BeginInvokeOnMainThread(() => { topPanel.Content = editPanel; titleEdit.Focus(); ((Entry)editPanel.Children [0]).Focus(); }); ((Entry)editPanel.Children [0]).Focus(); } popupFragment = new ContentView(); datePicker = new PopupDatePicker { OnItemSelected = view => { if (view != null) { popupFragment.Content = view; } } }; datePicker.DateChanged += (sender, e) => { SelectedDate = datePicker.SelectedDate; }; popupFragment.Content = datePicker.DefaultView; var categoryIcon = new Image { HorizontalOptions = LayoutOptions.EndAndExpand, HeightRequest = 12, Source = task.GetCategory().IconSource }; categoryPicker = new CategoryPicker(); categoryPicker.SelectedIndex = 0; foreach (Category category in CategoryHelper.AllCategories) { categoryPicker.Items.Add(category.Name); if (task.category == category.Name) { categoryPicker.SelectedIndex = categoryPicker.Items.Count - 1; } } categoryPicker.SelectedIndexChanged += (sender, args) => categoryIcon.Source = CategoryHelper.AllCategories[categoryPicker.SelectedIndex].IconSource; var selectCategoryArrow = new Image { HorizontalOptions = LayoutOptions.End, Source = "select.png", HeightRequest = 10 }; selectCategoryArrow.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => categoryPicker.Focus()) }); var categoryLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { new DefaultLabel { Text = "Category", TextColor = StyleManager.MainColor }, categoryIcon, categoryPicker, selectCategoryArrow } }; isFavorite = task.isFavorite; var starResource = isFavorite ? FAVORITE_IMG : NOT_FAVORITE_IMG; var favoriteLabel = new DefaultLabel { Text = "Mark as favorite", TextColor = StyleManager.MainColor }; var favoriteImage = new Image { HorizontalOptions = LayoutOptions.EndAndExpand, Source = starResource, HeightRequest = 15 }; var favoriteLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { favoriteLabel, favoriteImage } }; favoriteImage.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => Device.BeginInvokeOnMainThread(() => { isFavorite = !isFavorite; favoriteImage.Source = isFavorite ? FAVORITE_IMG : NOT_FAVORITE_IMG; })) }); var actionText = "Create"; if (!string.IsNullOrWhiteSpace(task.title)) { actionText = "Update"; } var buttons = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 0, Children = { new DefaultButton { Text = "Cancel", TextColor = Color.White, BackgroundColor = Color.Silver, HorizontalOptions = LayoutOptions.FillAndExpand, Command = new Command(onCancel.Dispatch) }, new DefaultButton { Text = actionText, TextColor = Color.White, BackgroundColor = StyleManager.MainColor, HorizontalOptions = LayoutOptions.FillAndExpand, Command = new Command(() => Device.BeginInvokeOnMainThread(() => { UpdateTask(task); onSubmit.Dispatch(); })) } } }; var mainLayout = new StackLayout { Padding = 15, BackgroundColor = StyleManager.AccentColor, Spacing = 20, Children = // TODO time picker, pass time { timePicker, categoryLayout, favoriteLayout, buttons } }; Children.Add(topPanel); Children.Add(datePicker); Children.Add(popupFragment); Children.Add(mainLayout); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // enable Nutiteq SDK logging Log.EnableAll(); // get MapView MapView view = FindViewById <MapView> (Resource.Id.mapView); // define mandatory parameters // Components keeps internal state and parameters for MapView view.Components = new Components(); // define base projection, almost always EPSG3857, but others can be defined also EPSG3857 proj = new EPSG3857(); // set online base layer with MapQuest Open Tiles view.Layers.BaseLayer = new TMSMapLayer(proj, 0, 18, 0, "http://otile1.mqcdn.com/tiles/1.0.0/osm/", "/", ".png"); /* * //set offline base layer from MBTiles file * //TODO: set path properly * String MbTilePath = "/sdcard/europe-tilemill-mbtiles.sqlite"; * * view.Layers.BaseLayer = new MBTilesMapLayer (proj, 0, 5, 1, MbTilePath, this); */ // start map view.StartMapping(); // add a marker // define marker style (image, size, color) Bitmap pointMarker = UnscaledBitmapLoader.DecodeResource(Resources, Resource.Drawable.olmarker); MarkerStyle.Builder markerStyleBuilder = new MarkerStyle.Builder(); markerStyleBuilder.SetBitmap(pointMarker); markerStyleBuilder.SetColor(NutiteqComponents.Color.White); markerStyleBuilder.SetSize(0.5f); MarkerStyle markerStyle = markerStyleBuilder.Build(); // define label what is shown when you click on marker Label markerLabel = new DefaultLabel("San Francisco", "Here is a marker"); // define location of the marker, it must be converted to base map coordinate system MapPos SanFrancisco = view.Layers.BaseLayer.Projection.FromWgs84(-122.416667f, 37.766667f); MapPos London = view.Layers.BaseLayer.Projection.FromWgs84(0.0f, 51.0f); // create layer and add object to the layer, finally add layer to the map. // All overlay layers must be same projection as base layer, so we reuse it MarkerLayer markerLayer = new MarkerLayer(view.Layers.BaseLayer.Projection); markerLayer.Add(new Marker(SanFrancisco, markerLabel, markerStyle, markerLayer)); view.Layers.AddLayer(markerLayer); // 3d building layer Polygon3DStyle.Builder nml3dStyleBuilder = new Polygon3DStyle.Builder(); Polygon3DStyle nml3dStyle = nml3dStyleBuilder.Build(); StyleSet nmlStyleSet = new StyleSet(); nmlStyleSet.SetZoomStyle(14, nml3dStyle); NMLModelOnlineLayer Online3dLayer = new NMLModelOnlineLayer(view.Layers.BaseLayer.Projection, "http://aws-lb.nutiteq.ee/nml/nmlserver2.php?data=demo&", nmlStyleSet); // persistent caching settings for the layer Online3dLayer.SetMemoryLimit(20 * 1024 * 1024); // 20 MB Online3dLayer.SetPersistentCacheSize(50 * 1024 * 1024); // 50 MB Online3dLayer.SetPersistentCachePath("/sdcard/nmlcache.db"); // mandatory to be set view.Layers.AddLayer(Online3dLayer); // OSM Polygon3D layer Polygon3DStyle.Builder poly3dStyleBuilder = new Polygon3DStyle.Builder(); poly3dStyleBuilder.SetColor(NutiteqComponents.Color.White); Polygon3DStyle poly3dStyle = poly3dStyleBuilder.Build(); StyleSet polyStyleSet = new StyleSet(); polyStyleSet.SetZoomStyle(16, poly3dStyle); Roof DefaultRoof = new FlatRoof(); Polygon3DOSMLayer Poly3DLayer = new Polygon3DOSMLayer(view.Layers.BaseLayer.Projection, 0.3f, DefaultRoof, unchecked ((int)0xffffffff) /* white */, unchecked ((int)0xff888888) /* gray */, 1500, polyStyleSet); view.Layers.AddLayer(Poly3DLayer); // set map center and zoom view.FocusPoint = SanFrancisco; view.Zoom = 5.0f; // set listener for map events MapListener listener = new MyMapListener(); view.Options.MapListener = listener; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // enable Nutiteq SDK logging Log.EnableAll (); // get MapView MapView view = FindViewById<MapView> (Resource.Id.mapView); // define mandatory parameters // Components keeps internal state and parameters for MapView view.Components = new Components (); // define base projection, almost always EPSG3857, but others can be defined also EPSG3857 proj = new EPSG3857 (); // set online base layer with MapQuest Open Tiles view.Layers.BaseLayer = new TMSMapLayer(proj, 0, 18, 0, "http://otile1.mqcdn.com/tiles/1.0.0/osm/", "/", ".png"); /* //set offline base layer from MBTiles file //TODO: set path properly String MbTilePath = "/sdcard/europe-tilemill-mbtiles.sqlite"; view.Layers.BaseLayer = new MBTilesMapLayer (proj, 0, 5, 1, MbTilePath, this); */ // start map view.StartMapping (); // add a marker // define marker style (image, size, color) Bitmap pointMarker = UnscaledBitmapLoader.DecodeResource(Resources, Resource.Drawable.olmarker); MarkerStyle.Builder markerStyleBuilder = new MarkerStyle.Builder (); markerStyleBuilder.SetBitmap (pointMarker); markerStyleBuilder.SetColor (NutiteqComponents.Color.White); markerStyleBuilder.SetSize (0.5f); MarkerStyle markerStyle = markerStyleBuilder.Build (); // define label what is shown when you click on marker Label markerLabel = new DefaultLabel ("San Francisco", "Here is a marker"); // define location of the marker, it must be converted to base map coordinate system MapPos SanFrancisco = view.Layers.BaseLayer.Projection.FromWgs84 (-122.416667f, 37.766667f); MapPos London = view.Layers.BaseLayer.Projection.FromWgs84 (0.0f, 51.0f); // create layer and add object to the layer, finally add layer to the map. // All overlay layers must be same projection as base layer, so we reuse it MarkerLayer markerLayer = new MarkerLayer(view.Layers.BaseLayer.Projection); markerLayer.Add(new Marker(SanFrancisco, markerLabel, markerStyle, markerLayer)); view.Layers.AddLayer(markerLayer); // 3d building layer Polygon3DStyle.Builder nml3dStyleBuilder = new Polygon3DStyle.Builder (); Polygon3DStyle nml3dStyle = nml3dStyleBuilder.Build (); StyleSet nmlStyleSet = new StyleSet (); nmlStyleSet.SetZoomStyle (14, nml3dStyle); NMLModelOnlineLayer Online3dLayer = new NMLModelOnlineLayer (view.Layers.BaseLayer.Projection, "http://aws-lb.nutiteq.ee/nml/nmlserver2.php?data=demo&", nmlStyleSet); // persistent caching settings for the layer Online3dLayer.SetMemoryLimit (20*1024*1024); // 20 MB Online3dLayer.SetPersistentCacheSize (50*1024*1024); // 50 MB Online3dLayer.SetPersistentCachePath ("/sdcard/nmlcache.db"); // mandatory to be set view.Layers.AddLayer(Online3dLayer); // OSM Polygon3D layer Polygon3DStyle.Builder poly3dStyleBuilder = new Polygon3DStyle.Builder (); poly3dStyleBuilder.SetColor (NutiteqComponents.Color.White); Polygon3DStyle poly3dStyle = poly3dStyleBuilder.Build (); StyleSet polyStyleSet = new StyleSet (); polyStyleSet.SetZoomStyle (16, poly3dStyle); Roof DefaultRoof = new FlatRoof (); Polygon3DOSMLayer Poly3DLayer = new Polygon3DOSMLayer (view.Layers.BaseLayer.Projection, 0.3f, DefaultRoof, unchecked((int) 0xffffffff) /* white */, unchecked((int) 0xff888888) /* gray */, 1500, polyStyleSet); view.Layers.AddLayer (Poly3DLayer); // set map center and zoom view.FocusPoint = SanFrancisco; view.Zoom = 5.0f; // set listener for map events MapListener listener = new MyMapListener (); view.Options.MapListener = listener; }
public LoginPage() { NavigationPage.SetHasNavigationBar(this, false); // Status bar for iOS. var statusBar = new BoxView(); if (Device.OS == TargetPlatform.iOS) { statusBar.BackgroundColor = StyleManager.DarkAccentColor; statusBar.HeightRequest = 20; } // Application title & subtitle. var titleString = new FormattedString(); titleString.Spans.Add(new Span { ForegroundColor = StyleManager.AccentColor, FontAttributes = FontAttributes.Italic, FontSize = 40, Text = "Todo " }); titleString.Spans.Add(new Span { ForegroundColor = StyleManager.DarkAccentColor, FontAttributes = FontAttributes.Italic, FontSize = 32, Text = "app" }); var title = new DefaultLabel { FormattedText = titleString, HorizontalOptions = LayoutOptions.Center }; var subtitle = new ItalicLabel { Text = "Helping you doing everything", TextColor = StyleManager.AccentColor }; var titleLayout = new StackLayout { Children = { title, subtitle }, Spacing = 2, Padding = new Thickness(0, 30) }; // Start layout (down arrow). var login = new ItalicLabel { Text = "Log in", CustomFontSize = NamedSize.Medium }; var downArrow = new Image { Source = "down_button.png", HeightRequest = 60 }; var startLayout = new StackLayout { Padding = new Thickness(0, 100), Spacing = 18, Children = { login, downArrow } }; // Login layout. emailTextBox = new DefaultEntry { Placeholder = "Email" }; passwordTextBox = new DefaultEntry { Placeholder = "Password", IsPassword = true }; var entryLayout = new StackLayout { Spacing = 15, Children = { emailTextBox, passwordTextBox } }; submitButton = new DefaultButton { Command = new Command(Submit) }; signUpString = new FormattedString(); signUpString.Spans.Add(new Span { ForegroundColor = StyleManager.AccentColor, FontAttributes = FontAttributes.Italic }); signUpString.Spans.Add(new Span { ForegroundColor = StyleManager.DarkAccentColor, FontAttributes = FontAttributes.Bold }); var toggleModeLabel = new DefaultLabel { FormattedText = signUpString, HorizontalOptions = LayoutOptions.Center }; var signInLayout = new StackLayout { Padding = new Thickness(0, 20), Spacing = 30, Children = { submitButton, toggleModeLabel } }; var loginLayout = new StackLayout { Padding = new Thickness(0, 35), Children = { entryLayout, signInLayout }, IsVisible = false }; downArrow.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => { loginLayout.IsVisible = true; startLayout.IsVisible = false; }) }); var toggleModeGestureRecognizer = new TapGestureRecognizer(); toggleModeGestureRecognizer.Tapped += (sender, ev) => toggleMode(); toggleModeLabel.GestureRecognizers.Add(toggleModeGestureRecognizer); // Main content layout. var contentLayout = new StackLayout { Padding = 25, HorizontalOptions = LayoutOptions.Center, Children = { titleLayout, startLayout, loginLayout } }; Content = new StackLayout { Children = { statusBar, contentLayout } }; setLoginMode(); }