private async void Button_Clicked(object sender, EventArgs e) { var looper = iamGrid.Children.Where(x => x is Button); foreach (Button btn in looper) { btn.BackgroundColor = Color.Default; btn.BorderColor = Color.Transparent; btn.BorderWidth = 0; } Button btne = (Button)sender; btne.BackgroundColor = Color.Transparent; btne.BorderWidth = 2; btne.BorderColor = Color.FromHex("3cc5d5"); if (btne == womanButton) { gender = "0"; } else if (btne == manButton) { gender = "1"; } }
private void SetCustomToolbar(string doneButtonText, string cancelButtonText, string titleText) { if (Control == null) { return; } UIToolbar toolbar = new UIToolbar { BarStyle = UIBarStyle.Default, Translucent = true, BackgroundColor = Color.FromHex("#252D3C").ToUIColor(), BarTintColor = Color.FromHex("#252D3C").ToUIColor() }; toolbar.SizeToFit(); UIBarButtonItem cancelButton = new UIBarButtonItem(cancelButtonText, UIBarButtonItemStyle.Plain, (sender, e) => { Control.ResignFirstResponder(); }); cancelButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Normal); cancelButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Selected); UIBarButtonItem flexible = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); UILabel titleView = new UILabel(new CoreGraphics.CGRect(0, 0, 200, 50)) { Text = titleText, TextAlignment = UITextAlignment.Center, TextColor = UIColor.White }; UIBarButtonItem title = new UIBarButtonItem(titleView); titleView.Font = UIFont.BoldSystemFontOfSize(16); title.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); title.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Selected); UIBarButtonItem doneButton = new UIBarButtonItem(doneButtonText, UIBarButtonItemStyle.Done, (s, ev) => { Control.ResignFirstResponder(); }); doneButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Normal); doneButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Selected); toolbar.SetItems(new UIBarButtonItem[] { cancelButton, flexible, title, flexible, doneButton }, true); Control.InputAccessoryView = toolbar; }
private void SearchConteudo_Focused(object sender, FocusEventArgs e) { SearchConteudo.BackgroundColor = Color.FromHex("#a4eaff"); }
//Post 8quali private async void SwipeItem_Sincronizar(object sender, EventArgs e) { var item = (SwipeItem)sender; item.IsEnabled = false; item.BackgroundColor = Color.FromHex("597FAC"); item.IsVisible = false; using (UserDialogs.Instance.Loading(("Sincronizando dados..."))) { await Task.Run(() => { try { var param = (Ocorrencias)item.CommandParameter; param.sincronizar = false; ocorenciaDAL.Update(param); var usuarioIncluiu = usuarioDAL.GetAll().First(); var listaAnexos = ocorrenciaAnexoDAL.GetAll().Where(w => w.OcorrenciaId == param.OcorrenciaId).ToList(); foreach (var item2 in listaAnexos) { var bytes = GetPhoto(item2.FilePath); item2.Anexo = bytes; } var listaDispo = disposicaoInicial.GetAll().Where(w => w.OcorrenciaId == param.OcorrenciaId).ToList(); OcorrenciaAnexo[] anexos = new OcorrenciaAnexo[listaAnexos.Count]; DTODisposicaoInicial[] disposicoesInicial = new DTODisposicaoInicial[listaDispo.Count]; for (int j = 0; j < listaDispo.Count; j++) { disposicoesInicial[j] = listaDispo[j]; } for (int i = 0; i < listaAnexos.Count; i++) { anexos[i] = listaAnexos[i]; } Ocorrencias ocorrencias = new Ocorrencias(); ocorrencias.Codigo = param.Codigo; ocorrencias.Chave = param.Chave; ocorrencias.Descricao = param.Descricao; ocorrencias.UsuarioIncluiuLogin = usuarioIncluiu.email.ToString(); ocorrencias.DataInclusao = DateTime.Now; ocorrencias.Anexos = anexos; ocorrencias.DisposicaoInicials = disposicoesInicial; string output = JsonConvert.SerializeObject(ocorrencias); service.SendAsync(ocorrencias); } catch (Exception ex) { } }); } OnAppearing(); }
public App() { // The root page of your application var takePhoto = new Button { Text = "GetPhoto" }; var loadImage = new Button { Text = "loadImage" }; var image = new Image(); loadImage.Clicked += async(sender, args) => { var source = ImageSource.FromResource(ResourcePrefix + "test1.jpg"); await Forms(source); }; takePhoto.Clicked += async(sender, args) => { MediaFile file; if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { file = await CrossMedia.Current.PickPhotoAsync(); } else { file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions { Directory = "Sample", Name = "test.jpg" }); } if (file == null) { return; } image.Source = ImageSource.FromStream(() => { var stream = file.GetStream(); //file.Dispose(); return(stream); }); Forms(image.Source); return; #if ANDROID var bitmap1 = BitmapFactory.DecodeStream(file.GetStream()); var ct = new ColorThief(); var ctColor = ct.GetColor(bitmap1); MainPage.BackgroundColor = Color.FromHex(ctColor.Color.ToHexString()); var a = 5; #elif WINDOWS_UWP UWP(file); #elif __IOS__ var bitmap1 = UIImage.FromFile(file.Path); ColorThief ct = new ColorThief(); var ctColor = ct.GetColor(bitmap1); MainPage.BackgroundColor = Color.FromHex(ctColor.Color.ToHexString()); int a = 5; #endif }; MainPage = new ContentPage { Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { new Label { HorizontalTextAlignment = TextAlignment.Center, Text = "Welcome to Xamarin Forms!" }, takePhoto, loadImage, image } } }; }
private async Task Forms(ImageSource file) { var ctColor = await ColorThiefDotNet.Forms.CrossColorThief.Current.GetColor(file); MainPage.BackgroundColor = Color.FromHex(ctColor.Color.ToHexString()); }
protected AColor GetPlaceholderColor() => Element.PlaceholderColor.ToAndroid(Color.FromHex("#80000000"));
public GradientHeaderNavigationPageRenderer(Context context) : base(context) { Color StartColor = Color.FromHex("#19769f"); Color EndColor = Color.FromHex("#35d8a6"); }
public Workout() { LoadBeltsLevel(); BackgroundColor = Color.FromHex((nColor[value].ToString())); InitializeComponent(); }
async void BtnStart_OnClicked(object sender, EventArgs e) { Sliders.IsVisible = false; btnUpTo.IsVisible = false; btnFrom.IsVisible = false; btnStart.IsVisible = false; BeltDesc.IsVisible = true; btnStop.IsVisible = true; slidersValue = (int)Sliders.Value; _isTimerStart = true; if (From == false && Upto == true) { switch ((slidersValue + 1)) { case 1: result = new Random().Next(0, 9); break; case 2: result = new Random().Next(0, 21); break; case 3: result = new Random().Next(0, 34); break; default: DoNothing(); break; } BackgroundColor = Color.FromHex(NColorList[result].ToString()); rotatingLabel.Text = $"{BeltsLevels[result]}"; BeltDesc.Text = $"{BeltsDesc[result]}"; StartTimer(); } else { switch ((slidersValue + 1)) { case 1: result = new Random().Next(0, 34); break; case 2: result = new Random().Next(10, 34); break; case 3: result = new Random().Next(22, 34); break; default: DoNothing(); break; } BackgroundColor = Color.FromHex(NColorList[result].ToString()); rotatingLabel.Text = $"{BeltsLevels[result]}"; BeltDesc.Text = $"{BeltsDesc[result]}"; StartTimerFrom(); } }
private void SetGradientBackground(Android.Support.V7.Widget.Toolbar toolbar) { Tuple <Color, Color> colors = new Tuple <Color, Color>(Color.FromHex("#19769f"), Color.FromHex("#35d8a6")); var direction = GradientDrawable.Orientation.LeftRight; GradientDrawable gradient = new GradientDrawable(direction, new int[] { colors.Item1.ToAndroid().ToArgb(), colors.Item2.ToAndroid().ToArgb() }); gradient.SetCornerRadius(0f); toolbar.SetBackground(gradient); }
public MenuPage() { OptionItems.Clear(); OptionItems.Add(new HomeOptionItem()); OptionItems.Add(new CirclesOptionItem()); OptionItems.Add(new SettingsOptionItem()); OptionItems.Add(new PrivacyOptionItem()); OptionItems.Add(new TermsOptionItem()); OptionItems.Add(new FeedbackOptionItem()); /* OptionItems.Add(new AboutOptionItem());*/ BackgroundColor = Color.FromHex("ffffff"); var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand }; const string defaultImgUrl = "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=retro"; var profileImgUrl = App.CurrentUser.Avatar == "" ? defaultImgUrl : App.CurrentUser.Avatar; var photo = new Image { WidthRequest = 150, HeightRequest = 150, Source = profileImgUrl }; var mask = new Image { Source = "roundmask.png", WidthRequest = 150, HeightRequest = 150, }; var photoGrid = new Grid { ColumnDefinitions = { new ColumnDefinition() }, RowDefinitions = { new RowDefinition() }, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 20, 0, 10) }; photoGrid.Children.Add(photo); photoGrid.Children.Add(mask); layout.Children.Add(photoGrid); var fullName = String.Format("{0} {1}", App.CurrentUser.FirstName, App.CurrentUser.LastName); var label = new Label() { Text = fullName, HorizontalOptions = LayoutOptions.Center, Font = Font.SystemFontOfSize(NamedSize.Large) }; layout.Children.Add(label); Menu = new ListView { ItemsSource = OptionItems, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Transparent }; var cell = new DataTemplate(typeof(MenuTextCell)); cell.SetBinding(TextCell.TextProperty, "Title"); cell.SetBinding(ImageCell.ImageSourceProperty, new Xamarin.Forms.Binding("IconSource")); cell.SetValue(BackgroundColorProperty, Color.Transparent); cell.SetValue(TextCell.TextColorProperty, Color.FromHex("262626")); Menu.ItemTemplate = cell; layout.Children.Add(Menu); var logoutButton = new Button { Text = "LOGOUT", BackgroundColor = Color.Transparent, BorderColor = Color.Transparent, TextColor = Color.FromHex("262626"), HorizontalOptions = LayoutOptions.CenterAndExpand, Image = new FileImageSource { File = "logout.png" } }; logoutButton.Clicked += (sender, e) => App.Logout(); layout.Children.Add(logoutButton); Content = layout; }