public override void Initialize() { base.Initialize(); new PositionLayout(this, new UniScalar(1.0f, -50), 40, HorizontalAlignment.Center, VerticalAlignment.Top) .Create(_name = new Label(Context, "province_name", new UniRectangle(), "")); IconButton closeButton; new PositionLayout(this, 20, 20, HorizontalAlignment.Right, VerticalAlignment.Top, new Padding(3)) .Create(closeButton = new IconButton(Context, "close_button")); new PositionLayout(this, 150, 20, HorizontalAlignment.Center, VerticalAlignment.Bottom, new Padding(30)) .Create(_buildButton = new Button(Context, "build_button", new UniRectangle(), "Build")); _buildButton.Clicked += (b) => Context.RegisterCommand( new NewConstructionCommand(BuildingTypes.AvailableFor(_settlement).First(), _settlement)); _resourceScrollableContainer = new ScrollableContainer<ResourceScrollableItem, Resource>(Context, "settlements", 3, c => new ResourceScrollableItem(c)); new PositionLayout(this, _resourceScrollableContainer.Size.X, _resourceScrollableContainer.Size.Y, HorizontalAlignment.Center, VerticalAlignment.Middle) .Create(_resourceScrollableContainer); closeButton.Clicked += () => Visible = false; }
private void load(IAdjustableClock adjustableClock) { this.adjustableClock = adjustableClock; PlaybackTabControl tabs; Children = new Drawable[] { playButton = new IconButton { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, Scale = new Vector2(1.4f), IconScale = new Vector2(1.4f), Icon = FontAwesome.fa_play_circle_o, Action = togglePause, Padding = new MarginPadding { Left = 20 } }, new OsuSpriteText { Origin = Anchor.BottomLeft, Text = "Playback speed", RelativePositionAxes = Axes.Y, Y = 0.5f, Padding = new MarginPadding { Left = 45 } }, new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, Height = 0.5f, Padding = new MarginPadding { Left = 45 }, Child = tabs = new PlaybackTabControl(), } }; tabs.Current.ValueChanged += newValue => Beatmap.Value.Track.Tempo.Value = newValue; }
private void prepareSearchBar() { searchBar = new SearchBar(); containerView.AddSubview(searchBar); var image = MaterialIcon.CM.MoreVertical; var moreButton = new IconButton(); moreButton.PulseColor = MaterialColor.Grey.Base; moreButton.TintColor = MaterialColor.Grey.Darken4; moreButton.SetImage(image, UIControlState.Normal); moreButton.SetImage(image, UIControlState.Highlighted); searchBar.LeftControls = new UIControl[] { moreButton }; }
private void BotonActivado(object senderBtn) { if (senderBtn != null) { DesactivarBoton(); botonSeleccionado = (IconButton)senderBtn; botonSeleccionado.BackColor = Color.FromArgb(19, 137, 255); botonSeleccionado.TextAlign = ContentAlignment.MiddleCenter; botonSeleccionado.TextImageRelation = TextImageRelation.TextBeforeImage; botonSeleccionado.ImageAlign = ContentAlignment.MiddleRight; botonSeleccionado.FlatAppearance.BorderColor = Color.MidnightBlue; bordeIzquierdo.BackColor = Color.MidnightBlue; bordeIzquierdo.Location = new Point(0, botonSeleccionado.Location.Y); bordeIzquierdo.Visible = true; bordeIzquierdo.BringToFront(); } }
//Methods private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); //button currentBtn = (IconButton)senderBtn; currentBtn.BackColor = Color.FromArgb(235, 212, 137); currentBtn.ForeColor = color; currentBtn.TextAlign = ContentAlignment.MiddleCenter; currentBtn.IconColor = color; currentBtn.TextImageRelation = TextImageRelation.TextBeforeImage; currentBtn.ImageAlign = ContentAlignment.MiddleRight; iconCurrentChildForm.IconChar = currentBtn.IconChar; iconCurrentChildForm.IconColor = Color.Firebrick; iconCurrentChildForm.IconSize = 45; } }
public NewTabButton(ImageBuffer imageBuffer, ThemeConfig theme) { this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Center; this.theme = theme; IconButton = new IconButton(imageBuffer, theme) { HAnchor = HAnchor.Left, Height = theme.MicroButtonHeight, Width = theme.MicroButtonHeight, Name = "Create New", ToolTipText = "Create New Design".Localize(), HoverColor = theme.AccentMimimalOverlay }; this.AddChild(IconButton); }
private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); currentBtn = (IconButton)senderBtn; currentBtn.BackColor = Color.FromArgb(192, 192, 192); currentBtn.ForeColor = color; currentBtn.TextAlign = ContentAlignment.MiddleCenter; currentBtn.IconColor = color; currentBtn.TextImageRelation = TextImageRelation.TextBeforeImage; currentBtn.ImageAlign = ContentAlignment.MiddleRight; leftBorderBtn.BackColor = color; leftBorderBtn.Location = new Point(-16, currentBtn.Location.Y); leftBorderBtn.Visible = true; leftBorderBtn.BringToFront(); } }
private void Welcome_Click(object sender, Color color) { if (sender != null) { btn = (IconButton)sender; btn.BackColor = Color.FromArgb(27, 36, 80); btn.ForeColor = color; btn.TextAlign = ContentAlignment.MiddleCenter; btn.IconColor = color; btn.TextImageRelation = TextImageRelation.TextBeforeImage; btn.ImageAlign = ContentAlignment.MiddleRight; leftBtn.BackColor = color; leftBtn.Location = new Point(0, btn.Location.Y); leftBtn.Visible = true; leftBtn.BringToFront(); } }
private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); //Button currentBtn = (IconButton)senderBtn; currentBtn.BackColor = Color.FromArgb(37, 36, 81); currentBtn.ForeColor = Color.White; currentBtn.TextAlign = ContentAlignment.MiddleCenter; currentBtn.IconColor = Color.White; currentBtn.TextImageRelation = TextImageRelation.TextBeforeImage; currentBtn.ImageAlign = ContentAlignment.MiddleRight; //Current Child Form Icon iconCurrentChildForm.IconChar = currentBtn.IconChar; iconCurrentChildForm.IconColor = color; } }
private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); // Button currentBtn = (IconButton)senderBtn; currentBtn.BackColor = Color.FromArgb(37, 36, 81); currentBtn.ForeColor = color; currentBtn.IconColor = color; //Current Child Form Icon iconCurrentChildForm.IconChar = currentBtn.IconChar; iconCurrentChildForm.IconColor = color; } }
public override void OnInspectorGUI() { serializedObject.Update(); SeparationLine.Horizontal(); EditorGUILayout.LabelField(target.name, K10GuiStyles.bigBoldCenterStyle, GUILayout.Height(28)); SeparationLine.Horizontal(); EditorGUILayout.PropertyField(_alsoLogToConsole); SeparationLine.Horizontal(); EditorGUILayout.LabelField("Custom log", K10GuiStyles.boldCenterStyle, GUILayout.Height(28)); EditorGUILayout.BeginHorizontal(); GUILayout.TextField(SystemInfo.deviceName); GUILayout.TextField(System.DateTime.Now.ToStringOrNull()); EditorGUILayout.EndHorizontal(); textToAdd = GUILayout.TextArea(textToAdd); if (GUILayout.Button("Add Custom Log")) { var log = (EditorLog)target; log.Add(textToAdd); } SeparationLine.Horizontal(); for (int i = _log.arraySize - 1; i >= 0; i--) { var line = _log.GetArrayElementAtIndex(i); var dateTime = line.FindPropertyRelative("_dateTime"); var date = System.DateTime.FromFileTimeUtc(dateTime.longValue); var author = line.FindPropertyRelative("_author"); var message = line.FindPropertyRelative("_message").stringValue; EditorGUILayout.BeginHorizontal(); GUILayout.TextField(author.stringValue); GUILayout.TextField(date.ToStringOrNull()); if (IconButton.Layout("minus", '-', "Remove log line", K10GuiStyles.CYAN_TINT_COLOR)) { _log.DeleteArrayElementAtIndex(i); } EditorGUILayout.EndHorizontal(); GUILayout.TextArea(message); } serializedObject.ApplyModifiedProperties(); }
private async void Favoritos_Clicked(object sender, EventArgs e) { IconButton icon = sender as IconButton; if (Sistema.USUARIO != null) { var objeto = (icon.CommandParameter) as Imovel; if (objeto != null) { var favorito = await Sistema.DATABASE.database.Table <Models.Favoritos>().Where(p => p.idImovel == objeto.id && p.idUsuario == Sistema.USUARIO.cod).FirstOrDefaultAsync(); if (favorito == null) { try { await Sistema.DATABASE.database.InsertAsync(new Models.Favoritos() { idUsuario = Sistema.USUARIO.cod, idImovel = objeto.id }); this.Inicio.viewModel.Imovels[this.Inicio.viewModel.Imovels.IndexOf(objeto)].favorito = "Red"; BindingContext = this.Inicio.viewModel; this.ItemsListView.ItemsSource = this.Inicio.viewModel.Imovels; CrossToastPopUp.Current.ShowToastMessage("Imovel " + objeto.titulo + " adicionado com sucesso", Plugin.Toast.Abstractions.ToastLength.Long); } catch (Exception ex) { CrossToastPopUp.Current.ShowToastMessage(ex.Message, Plugin.Toast.Abstractions.ToastLength.Long); } } else { CrossToastPopUp.Current.ShowToastMessage("Imovel " + objeto.titulo + " já pertence ao seus favoritos", Plugin.Toast.Abstractions.ToastLength.Long); } } } else { OAuthConfig.IndexPage = 0; CrossToastPopUp.Current.ShowToastMessage("Faça o login primeiro para adicionar o imóvel ao seus favoritos"); Sistema.TABBEDPAGE.CurrentPage = Sistema.TABBEDPAGE.Entrar; } }
//activar y desactivar efecto botones private void ActivarBoton(object senderBtn, Color color) { if (senderBtn != null) { DesactivarBoton(); botonSeleccionado = (IconButton)senderBtn; botonSeleccionado.BackColor = Color.FromArgb(37, 36, 81); botonSeleccionado.ForeColor = color; botonSeleccionado.TextAlign = ContentAlignment.MiddleCenter; botonSeleccionado.IconColor = color; botonSeleccionado.TextImageRelation = TextImageRelation.TextBeforeImage; botonSeleccionado.ImageAlign = ContentAlignment.MiddleRight; //borde boton bordeBoton.BackColor = color; bordeBoton.Location = new Point(0, botonSeleccionado.Location.Y); bordeBoton.Visible = true; bordeBoton.BringToFront(); } }
public void ShowMenus(IconButton iconbtn, Panel Submenu) { if (Submenu.Visible == false) { HiddenNuevoperfil(); HiddenNuevaDefensa(); HiddenAgregar(); HidenCarreras(); HidenMenus(); Submenu.Visible = true; FirstButtonActive(iconbtn); } else { Submenu.Visible = false; FirstButtonDesactive(iconbtn); HidenCarreras(); } }
private void FocusButton(object senderBtn, Color color) { if (senderBtn != null) { UnfocusFocusedButton(); // Button Propeties _focusedButton = (IconButton)senderBtn; _focusedButton.BackColor = Color.FromArgb(37, 36, 81); _focusedButton.ForeColor = color; _focusedButton.IconColor = color; // Left Border Panel Properties _leftBorderPanel.BackColor = color; _leftBorderPanel.Location = new Point(0, _focusedButton.Location.Y); _leftBorderPanel.Visible = true; _leftBorderPanel.BringToFront(); } }
private void PasswordHideShow(object sender, EventArgs e) { IconButton btn = (IconButton)sender; IconChar icon = new IconChar(); IconChar eye = (IconChar)61550; IconChar eyeSlash = (IconChar)61552; if (btn.IconChar == eye) { icon = eyeSlash; txtPasswordAdd.UseSystemPasswordChar = false; } else { icon = eye; txtPasswordAdd.UseSystemPasswordChar = true; } btn.IconChar = icon; }
private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); this.currentButton = (IconButton)senderBtn; this.currentButton.BackColor = Color.FromArgb(22, 33, 62); this.currentButton.ForeColor = color; this.currentButton.TextAlign = ContentAlignment.MiddleCenter; this.currentButton.IconColor = color; this.currentButton.TextImageRelation = TextImageRelation.TextBeforeImage; this.currentButton.ImageAlign = ContentAlignment.MiddleRight; buttonControlLeftBorder.BackColor = color; buttonControlLeftBorder.Location = new Point(0, this.currentButton.Location.Y); buttonControlLeftBorder.BringToFront(); } }
private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { CurrentBtn = (IconButton)senderBtn; CurrentBtn.BackColor = Color.FromArgb(170, 170, 170); CurrentBtn.ForeColor = color; CurrentBtn.TextAlign = ContentAlignment.MiddleCenter; CurrentBtn.IconColor = color; CurrentBtn.TextImageRelation = TextImageRelation.TextBeforeImage; CurrentBtn.ImageAlign = ContentAlignment.MiddleRight; LeftBorderBtn.BackColor = color; LeftBorderBtn.Location = new Point(0, CurrentBtn.Location.Y); LeftBorderBtn.Visible = true; LeftBorderBtn.BringToFront(); } }
private void MaximizeHTML(MSDN.Html.Editor.HtmlEditorControl editor, IconButton buttonMax, IconButton buttonMin) { buttonMax.Visible = false; buttonMin.Visible = true; ShowAllEditors(false); posX = editor.Left; posY = editor.Top; posW = editor.Width; posH = editor.Height; editor.Left = 116; editor.Top = 12; editor.Height = 400; editor.ToolbarVisible = true; editor.Visible = true; }
private void ActivateButton(object senderbutton) { if (senderbutton != null) { DisableButton(); currentButton = (IconButton)senderbutton; currentButton.BackColor = Color.WhiteSmoke; currentButton.IconColor = Color.FromArgb(92, 179, 99); currentButton.ImageAlign = ContentAlignment.MiddleCenter; //Left border button //leftBorderButton.BackColor = Color.FromArgb(92, 179, 99); //leftBorderButton.Location = new Point(0, currentButton.Location.Y); //leftBorderButton.Visible = true; //leftBorderButton.BringToFront(); ////Current Child Form Icon //currentButton.IconChar = currentButton.IconChar; //currentButton.IconColor = color; } }
void prepareToolbar() { toolbar = new Toolbar(); containerView.AddSubview(toolbar); toolbar.Title = "Material"; toolbar.TitleLabel.TextColor = MaterialColor.White; toolbar.Detail = "Build Beautiful Software"; toolbar.DetailLabel.TextColor = MaterialColor.White; var image = MaterialIcon.CM.Menu; var menuButton = new IconButton(); menuButton.PulseColor = MaterialColor.White; menuButton.TintColor = MaterialColor.White; menuButton.SetImage(image, UIControlState.Normal); menuButton.SetImage(image, UIControlState.Highlighted); var switchControl = new MaterialSwitch(state: MaterialSwitchState.Off, style: MaterialSwitchStyle.LightContent, size: MaterialSwitchSize.Small); image = MaterialIcon.CM.Search; var searchButton = new IconButton(); searchButton.PulseColor = MaterialColor.White; searchButton.TintColor = MaterialColor.White; searchButton.SetImage(image, UIControlState.Normal); searchButton.SetImage(image, UIControlState.Highlighted); /* * To lighten the status bar - add the * "View controller-based status bar appearance = NO" * to your info.plist file and set the following property. */ toolbar.BackgroundColor = MaterialColor.Blue.Base; toolbar.LeftControls = new UIControl[] { menuButton }; toolbar.RightControls = new UIControl[] { switchControl, searchButton }; }
private void setState(IconButton child) { switch (activeTopMenuKey) { case UiKeys.TopMenu.ElevationTools: State.SelectedTool = child.Key; break; case UiKeys.TopMenu.TerrainPaint: State.SelectedTool = child.Key == UiKeys.SplatMap.AutoPaint || child.Key == UiKeys.SplatMap.AutoPaintGlobal ? child.Key : UiKeys.SplatMap.Paint; State.SelectedToolData = child.Key; break; case UiKeys.TopMenu.Assets: State.SelectedTool = child.Key == UiKeys.Assets.Erase ? child.Key : UiKeys.Assets.Asset; State.SelectedToolData = child.Key; break; } }
private void ativaBtnGerencia(object senderBtn, Color color) { desativaBtn(); iconBtn = (IconButton)senderBtn; iconBtn.BackColor = Color.FromArgb(37, 36, 81); iconBtn.ForeColor = color; iconBtn.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; iconBtn.IconColor = color; iconBtn.TextImageRelation = TextImageRelation.TextBeforeImage; iconBtn.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; pnlLeftGerencia.BackColor = color; pnlLeftGerencia.Location = new Point(0, iconBtn.Location.Y); pnlLeftGerencia.Visible = true; pnlLeftGerencia.BringToFront(); iconeFrmFilho.IconChar = iconBtn.IconChar; iconeFrmFilho.IconColor = Color.FromArgb(26, 32, 40); }
private void GuardLogIn(Form childForm, IconButton iconButton) { if (UserProfile.CurrentUser != null) { if (UserProfile.CurrentUser.Quyen.Trim() == "Manage" || UserProfile.CurrentUser.Quyen.Trim() == "Guard") { openChildForm(childForm, iconButton); } else { MessageBox.Show("Tài khoản của bạn không thể sử dụng chức năng này"); } } else { MessageBox.Show("Đăng nhập để sử dụng chức năng"); } }
private void ActivateButtonBarraTitulo(object senderBtn, Color color) { if (senderBtn != null) { DisableButtonBarraTitulo(); //Icono y Color Button currentBtnTitulo = (IconButton)senderBtn; currentBtnTitulo.ForeColor = color; currentBtnTitulo.IconColor = color; //AlineBorder Button topBorderBtn.BackColor = color; // topBorderBtn.Location = new Point(currentBtnTitulo.Location.X, 0); topBorderBtn.Location = new Point(currentBtnTitulo.Location.X, currentBtnTitulo.Location.Y); topBorderBtn.Visible = true; topBorderBtn.BringToFront(); } }
public static void HabilitarBotones(bool activo, IconButton boton1, IconButton boton2, IconButton boton3) { //ACTIVA O DESACTIVA LOS BOTONES boton1.Enabled = activo; boton2.Enabled = !activo; boton3.Enabled = !activo; //if (boton1.Enabled == true) //{ // boton1.BackColor = Color.FromArgb(21, 30, 41); // boton1.IconColor = Color.White; //} //else //{ // boton1.BackColor = Color.FromArgb(177, 180, 183); // boton1.IconColor = Color.Black; //} }
private void HighlightButton(object sender, Color color) { DisableHighlight(); if (sender != null) { currentButton = (IconButton)sender; currentButton.BackColor = Color.FromArgb(43, 28, 86); currentButton.ForeColor = color; currentButton.TextAlign = ContentAlignment.MiddleCenter; currentButton.IconColor = color; currentButton.TextImageRelation = TextImageRelation.TextBeforeImage; currentButton.ImageAlign = ContentAlignment.MiddleRight; leftBorderPanel.BackColor = color; leftBorderPanel.Location = new Point(0, currentButton.Location.Y); leftBorderPanel.Visible = true; leftBorderPanel.BringToFront(); } }
private void ActivateButton(object senderbutton) { if (senderbutton != null) { DisableButton(); currentButton = (IconButton)senderbutton; currentButton.BackColor = Color.FromArgb(42, 40, 60); currentButton.IconColor = Color.FromArgb(115, 249, 181); currentButton.ImageAlign = ContentAlignment.MiddleCenter; //Left border button leftBorderButton.BackColor = Color.FromArgb(67, 192, 121); leftBorderButton.Location = new Point(0, currentButton.Location.Y); leftBorderButton.Visible = true; leftBorderButton.BringToFront(); ////Current Child Form Icon //currentButton.IconChar = currentButton.IconChar; //currentButton.IconColor = color; } }
//metody public void ActivateButton(object senderBtn) { if (senderBtn != null) { DisableButton(); //Button currentBtn = (IconButton)senderBtn; currentBtn.BackColor = sideMenuColor; currentBtn.ForeColor = activeColor; currentBtn.IconColor = activeColor; //Left border button leftBorderBtn.BackColor = activeColor; leftBorderBtn.Location = new Point(0, currentBtn.Location.Y); leftBorderBtn.Visible = true; leftBorderBtn.BringToFront(); //Current Child Form Icon iconCurrentChildForm.IconChar = currentBtn.IconChar; } }
private void actButton(object senderBtn, Color color) { if (senderBtn != null) { dsbButton(); //Btn currentBtn = (IconButton)senderBtn; currentBtn.BackColor = Color.FromArgb(37, 36, 81); currentBtn.ForeColor = color; currentBtn.TextAlign = ContentAlignment.MiddleCenter; currentBtn.IconColor = color; currentBtn.TextImageRelation = TextImageRelation.TextBeforeImage; currentBtn.ImageAlign = ContentAlignment.MiddleRight; //pansub pb_iconform.IconChar = currentBtn.IconChar; pb_iconform.IconColor = currentBtn.IconColor; lbl_nameform.Text = currentBtn.Text; } }
private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); currentButton = (IconButton)senderBtn; currentButton.BackColor = Color.FromArgb(0, 68, 107); currentButton.ForeColor = color; currentButton.IconColor = color; leftBorderBtn.BackColor = color; leftBorderBtn.Location = new Point(0, currentButton.Location.Y); leftBorderBtn.Visible = true; leftBorderBtn.BringToFront(); lblTitle.Text = currentButton.Text; } }
public override void Initialize() { _ratioX = Size.X; _ratioY = Size.Y; _screenX = ConfigurationManager.Config.ScreenSize.X; _screenY = ConfigurationManager.Config.ScreenSize.Y; _texture = new RenderTexture(Context.DirectX.Device, Size); _rectangle = new TexturedRectangle(Context, _texture.ShaderResourceView, Size); _camera = new Camera(new Vector3(0,200,0), new Vector3(0, MathUtil.PiOverTwo, 0)); _terrain = new Terrain(Context, Context.World.ProvinceManager.LandProvinces.ToList()); _orthoProjectionMatrix = Matrix.OrthoLH(2*_ratioX, 2*_ratioY, ConfigurationManager.Config.NearLimit, ConfigurationManager.Config.FarLimit); _water = new TexturedRectangle(Context, Context.TextureManager.Create("dark_paper.png", "Data/UI/"), ConfigurationManager.Config.WorldSize * Scaling); _water.TextureRepeat(new Vector2I(4,2)); IconButton centerButton = new IconButton(Context, "province_map_center") { Coordinates = new UniRectangle(new UniScalar(1.0f, -35), 5, 30, 30) }; centerButton.Clicked += () => MoveCamera((Vector3) _selectedProvince.Center); Register(centerButton); }
void Paint(Element parent) { new Div(parent, div=>{ div.ClassName="span6 offset3 well"; div.Hide(); }) ; SearchDiv= new Div(default(Element), searchdiv=>{ searchdiv.ClassName= "span6 offset3 nav"; var inputFecha=new InputText(searchdiv, ip=>{ ip.ClassName="input-medium search-query"; ip.SetAttribute("data-mask","99.99.9999"); ip.SetPlaceHolder("dd.mm.aaaa"); }).Element(); new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-search icon-large"; abn.JSelect().Click(evt=>{ if( ! inputFecha.Value.IsDateFormatted()){ Div.CreateAlertErrorAfter(SearchDiv.Element(),"Digite una fecha valida"); return; } LoadGastos( inputFecha.Value.ToServerDate() ); }); }); BNew= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-plus-sign icon-large"; abn.JSelect().Click(evt=>{ FormDiv.FadeIn(); GridDiv.FadeOut(); Form.Element().Reset(); BDelete.Element().Disabled=true; }); }); BDelete=new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-remove-sign icon-large"; abn.Disabled=true; abn.JSelect().Click(evt=>{ RemoveRow(); }); }); BList= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-reorder icon-large"; abn.Disabled=true; abn.JSelect().Click(evt=>{ FormDiv.FadeOut(); GridDiv.FadeIn(); abn.Disabled=true; }); }); }); SearchDiv.AppendTo(parent); FormDiv= new Div(default(Element), formdiv=>{ formdiv.ClassName="span6 offset3 well"; Form = new Form(formdiv, f=>{ f.ClassName="form-horizontal"; f.Action="api/Gasto/"; f.Method="post"; var inputId= new InputText(f, e=>{ e.Name="Id"; e.Hide(); }); var cbConcepto=new SelectField(f, (e)=>{ e.Name="IdConcepto"; e.ClassName="span12"; new HtmlOption(e, o=>{ o.Value=""; o.Selected=true; o.Text="Seleccione el concepto ..."; }); LoadConceptos(e); }); var cbFuente= new SelectField(f, (e)=>{ e.Name="IdFuente"; e.ClassName="span12"; new HtmlOption(e, o=>{ o.Value=""; o.Selected=true; o.Text="Seleccione la fuente de pago ..."; }); LoadFuentes(e); }); var fieldValor= new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Valor"; field.SetPlaceHolder("$$$$$$$$$$"); field.AutoNumericInit(); field.Style.TextAlign="right"; }); new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Beneficiario"; field.SetPlaceHolder("Pagado a ...."); }); new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Descripcion"; field.SetPlaceHolder("Descripcion"); }); var bt = new SubmitButton(f, b=>{ b.JSelect().Text("Guardar"); b.LoadingText(" Guardando ..."); b.ClassName="btn btn-info btn-block" ; }); var vo = new ValidateOptions() .SetSubmitHandler( form=>{ bt.ShowLoadingText(); var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update"); jQuery.PostRequest<BLResponse<Gasto>>(action, form.AutoNumericGetString(), cb=>{},"json") .Success(d=>{ Cayita.Javascript.Firebug.Console.Log("Success guardar gasto",d); if(string.IsNullOrEmpty(inputId.Value()) ) AppendRow(d.Result[0]); else UpdateRow(d.Result[0]); form.Reset(); }) .Error((request, textStatus, error)=>{ Cayita.Javascript.Firebug.Console.Log("request", request ); Cayita.Javascript.Firebug.Console.Log("error", error ); Div.CreateAlertErrorBefore(form.Elements[0], textStatus+": "+ request.StatusText); }) .Always(a=>{ bt.ResetLoadingText(); }); }) .AddRule((rule, msg)=>{ rule.Element=fieldValor.Element(); rule.Rule.Required(); msg.Required("Digite el valor del gasto"); }) .AddRule((rule, msg)=>{ rule.Element=cbConcepto.Element(); rule.Rule.Required(); msg.Required("Seleccione el concepto"); }) .AddRule((rule, msg)=>{ rule.Element=cbFuente.Element(); rule.Rule.Required(); msg.Required("Seleccione al fuente del pago"); }); f.Validate(vo); }); }); FormDiv.AppendTo(parent); GridDiv= new Div(default(Element), gdiv=>{ gdiv.ClassName="span10 offset1"; TableGastos= new HtmlTable(gdiv, table=>{ InitTable (table); }); gdiv.Hide(); }); GridDiv.AppendTo(parent); }
void Paint(Element parent) { new Div(parent, div=>{ div.ClassName="span6 offset3 well"; div.Hide(); }) ; SearchDiv= new Div(default(Element), searchdiv=>{ searchdiv.ClassName= "span6 offset3 nav"; BNew = new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-plus-sign icon-large"; abn.JSelect().Click(evt=>{ GridDiv.Hide(); FormDiv.FadeIn(); Form.Element().Reset(); BDelete.Element().Disabled=true; BList.Element().Disabled=false; }); }); BDelete= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-remove-sign icon-large"; abn.Disabled=true; abn.JSelect().Click(evt=>{ RemoveRow(); }); }); BList= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-reorder icon-large"; abn.JSelect().Click(evt=>{ FormDiv.Hide(); GridDiv.FadeIn(); BList.Element().Disabled=true; }); }); }); SearchDiv.AppendTo(parent); GridDiv= new Div(default(Element), gdiv=>{ gdiv.ClassName="span6 offset3"; TableFuentes= new HtmlTable(gdiv, table=>{ InitTable(table); LoadFuentes(table); }); }); GridDiv.AppendTo(parent); FormDiv= new Div(default(Element), formdiv=>{ formdiv.ClassName="span6 offset3 well"; formdiv.Hide(); Form = new Form(formdiv, f=>{ f.ClassName="form-horizontal"; f.Action="api/Fuente/"; var inputId= new InputText(f, e=>{ e.Name="Id"; e.Hide(); }); var cbTipo= new SelectField(f, (e)=>{ e.Name="Tipo"; e.ClassName="span12"; new HtmlOption(e, o=>{ o.Value=""; o.Selected=true; o.Text="Seleccione el tipo "; }); new HtmlOption(e, o=>{ o.Value="Credito"; o.Text="Credito"; }); new HtmlOption(e, o=>{ o.Value="Debito"; o.Text="Debito"; }); }); var fieldCodigo=new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Codigo"; field.SetPlaceHolder("Codigo del Recurso ## Grupo ##.## Item"); }); var fieldNombre=new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Nombre"; field.SetPlaceHolder("Nombre del Recurso"); }); var bt = new SubmitButton(f, b=>{ b.JSelect().Text("Guardar"); b.LoadingText(" Guardando ..."); b.ClassName="btn btn-info btn-block" ; }); var vo = new ValidateOptions() .SetSubmitHandler( form=>{ bt.ShowLoadingText(); var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update"); jQuery.PostRequest<BLResponse<Fuente>>(action, form.Serialize(), cb=>{},"json") .Success(d=>{ Cayita.Javascript.Firebug.Console.Log("Success guardar recurso",d); if(string.IsNullOrEmpty(inputId.Value()) ) AppendRow(d.Result[0]); else UpdateRow(d.Result[0]); FormDiv.FadeOut(); GridDiv.Show (); }) .Error((request, textStatus, error)=>{ Cayita.Javascript.Firebug.Console.Log("request", request ); Div.CreateAlertErrorBefore(form.Elements[0], textStatus+": "+ request.StatusText); }) .Always(a=>{ bt.ResetLoadingText(); }); }) .AddRule((rule, msg)=>{ rule.Element=cbTipo.Element(); rule.Rule.Required(); msg.Required("Seleccione tipo de Recurso"); }) .AddRule((rule,msg)=>{ rule.Element=fieldNombre.Element(); rule.Rule.Required().Maxlength(64); msg.Required("Indique el nombre del Recurso").Maxlength("Maximo 64 Caracteres"); }).AddRule((rule,msg)=>{ rule.Element=fieldCodigo.Element(); rule.Rule.Required().Maxlength(5); msg.Required("Indique el codigo del Recurso").Maxlength("Maximo 5 caracteres"); }); f.Validate(vo); }); }); FormDiv.AppendTo(parent); }