public WeatherView() { InitializeComponent(); if (Device.OS == TargetPlatform.iOS) Icon = new FileImageSource { File = "tab1.png" }; }
private async void SwitchButton_OnTapped(object sender, EventArgs e) { try { Xamarin.Forms.Image img = (Xamarin.Forms.Image)sender; Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)img.Source; MovementListTbl obj = (MovementListTbl)objFileImageSource.BindingContext; string strFileName = objFileImageSource.File; if (strFileName == "off_btn.png") { obj.MoveIcon = "on_btn.png"; img.Source = "on_btn.png"; obj.Selected = true; } else { obj.MoveIcon = "off_btn.png"; img.Source = "off_btn.png"; obj.Selected = false; } await App.mvDatabase.SaveItemAsync1(obj); } catch (Exception ex) { StaticMethods.ShowToast(ex.Message); } }
public ForecastView() { InitializeComponent(); if (Device.OS == TargetPlatform.iOS) Icon = new FileImageSource { File = "tab2.png" }; ListViewWeather.ItemTapped += (sender, args) => ListViewWeather.SelectedItem = null; }
public IconLabelView (FileImageSource source, string text) { BackgroundColor = StyleKit.CardFooterBackgroundColor; var label = new Label () { Text = text, FontSize = 9, FontAttributes = FontAttributes.Bold, TextColor = StyleKit.LightTextColor }; var stack = new StackLayout () { Padding = new Thickness (5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center, Children = { new Image () { Source = source, HeightRequest = 10, WidthRequest = 10 }, label } }; Content = stack; }
static SKBitmap LoadBitmap(Xamarin.Forms.FileImageSource src) { if (string.IsNullOrEmpty(src.File)) { var imgPath = ResourcePath.GetPath(src.File); } }
public CardView(Opdracht opdracht) { Card card = new Card (); Grid grid = new Grid { Padding = new Thickness (0, 1, 1, 1), RowSpacing = 1, ColumnSpacing = 1, BackgroundColor = StyleKit.CardBorderColor, VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength (70, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength (30, GridUnitType.Absolute) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength (4, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength (60, GridUnitType.Absolute) } } }; // Meegeven als de opdracht is afgewerkt. grid.Children.Add ( new CardStatusView (opdracht), 0, 1, 0, 2); // Meegeven van de detail (bedrijf, adres ... ) grid.Children.Add (new CardDetailsView (opdracht), 1, 4, 0, 1); grid.Children.Add (new IconLabelView (opdracht,StyleKit.Icons.Alert, "Navigeer"), 1, 1); switch (opdracht.Statuslabel) { case "Afgewerkt": source = StyleKit.Icons.Completed; break; case "Start": source = StyleKit.Icons.Resume; break; case "Stop": source = StyleKit.Icons.Stop; break; default: break; } grid.Children.Add ( new IconLabelView (opdracht, source, opdracht.Statuslabel ) , 2, 1); //Detailpage grid.Children.Add (new ConfigIconView (opdracht), 3, 1); Content = grid; }
public static string GetImagePathFromImage(Image objImage) { if (objImage.Source is Xamarin.Forms.FileImageSource) { Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)objImage.Source; return(objFileImageSource.File); } return(null); }
public async Task<IControl> GetImage(FileImageSource source, ImageFormat format) { var path = Path.Combine(Forms.Game.Content.RootDirectory, source.File); if (File.Exists(path)) { using (var stream = File.OpenRead(path)) return await ImageFactory.CreateFromStream(stream, format, CancellationToken.None); } var texture = Forms.Game.Content.Load<Texture2D>(source.File); return ImageFactory.CreateFromTexture(texture, format); }
public MasterPage() { InitializeComponent(); if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows) { Icon = new FileImageSource { File = "Images/ApplicationBar.Select.png" }; } }
protected async override void Invoke(ImageButton button) { Xamarin.Forms.ImageButton img = (Xamarin.Forms.ImageButton)button; Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)img.Source; if (objFileImageSource.File == "yes.png") { button.Source = "no.png"; } else { button.Source = "yes.png"; } }
public TeamsPage() { InitializeComponent(); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += async(sender, e) => { // cast to an image Image theImage = (Image)sender; Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)theImage.Source; Navigation.PushAsync(await SquadPage.generateSquadPage(objFileImageSource.File)); Tunisia.Text = objFileImageSource.File; // now you have a reference to the image }; tn.GestureRecognizers.Add(tapGestureRecognizer); }
public void OnImgPausePlayTap(object sender, EventArgs e) { var objAudioDataSender = sender as Image; var SelectedTourAudio = objAudioDataSender.BindingContext as TourLocation; Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)imgPausePlay.Source; if (objFileImageSource.File == "play_icon.png") { UpdateCurrentTimeofAudio(); player.Play(); imgPausePlay.Source = "pause_icon.png"; } else { player.Pause(); imgPausePlay.Source = "play_icon.png"; } }
public DetailPage(Page root) : base(root) { if (Device.OS == TargetPlatform.iOS) { Icon = new FileImageSource { File = Device.OS == TargetPlatform.iOS ? "captain_planet_foundation_logo12.png" : null, }; Title = null; BarTextColor = Color.Black; } else { root.BackgroundColor = Color.White; this.BarTextColor = Color.Black; } this.BarBackgroundColor = Color.FromHex("#6DB4A6"); }
private void DrawOptionsPage() { toggleButton = new Xamarin.Forms.Slider (); toggleButton.Value = 4; toggleButton2 = new Xamarin.Forms.Slider (); toggleButton2.Value = 2; toggleButton.Maximum = 20; toggleButton2.Maximum = 20; toggleButton2.ValueChanged+= (object sender, ValueChangedEventArgs e) => { //groupGap = e.NewValue; }; toggleButton.ValueChanged+= (object sender, ValueChangedEventArgs e) => { groupPadding = e.NewValue; (tree.Levels [0] as TreeMapFlatLevel).GroupPadding = groupPadding; tree.Refresh (); }; picker1 = new PickerExt(); picker2 = new PickerExt(); picker1.Items.Add("Squarified"); picker1.Items.Add("Slice And Dice Horizontal"); picker1.Items.Add("Slice And Dice Vertical"); picker1.Items.Add("Slice And Dice Auto"); picker1.HeightRequest = 40; picker1.SelectedIndex = 0; picker1.SelectedIndexChanged += picker1_SelectedIndexChanged; picker2.Items.Add("RangeColorMapping"); picker2.Items.Add("DesaturationColorMapping"); picker2.Items.Add("UniColorMapping"); picker2.Items.Add("PaletteColorMapping"); picker2.HeightRequest = 40; picker2.SelectedIndex = 0; picker2.SelectedIndexChanged += picker2_SelectedIndexChanged; picker1.BackgroundColor = Color.White; picker2.BackgroundColor = Color.White; label6 = new Label() { Text = " " + "Settings", FontSize = 60, HeightRequest = 60, YAlign = TextAlignment.End, TextColor = Color.White }; label3 = new Label() { Text = "Layout Type", HeightRequest = 20, YAlign = TextAlignment.End, TextColor = Color.Black }; label4 = new Label() { Text = "Color Mapping", HeightRequest = 20, YAlign = TextAlignment.End, TextColor = Color.Black }; label5 = new Label() { Text = "Group Padding", HeightRequest = 30, YAlign = TextAlignment.Center, TextColor = Color.Black, }; label9 = new Label() { Text = "Group Gap", HeightRequest = 20, YAlign = TextAlignment.Center, TextColor = Color.Black }; if (Device.OS == TargetPlatform.Android) { picker1.BackgroundColor = Color.FromRgb(239, 239, 239); picker2.BackgroundColor = Color.FromRgb(239, 239, 239); label3.FontSize = 20; label4.FontSize = 20; label5.FontSize = 20; } //label10.WidthRequest = tree.Width; //label11.WidthRequest = tree.Width; label5.WidthRequest = label9.Width; if (Device.OS == TargetPlatform.WinPhone) { label5.WidthRequest = 150; label9.WidthRequest = 150; picker1.HeightRequest = 60; picker2.HeightRequest = 60; label3.TextColor = Color.White; label4.TextColor = Color.White; label5.TextColor = Color.White; this.BackgroundColor = Color.Black; FileImageSource images = new FileImageSource(); images.File = "options.png"; baritem.Icon = images; label3.Text = " " + "Layout Type"; label3.HeightRequest = 22; label4.Text = " " + "Color Mapping"; label4.HeightRequest = 22; label5.Text = " " + "Group Padding"; label5.HeightRequest = 22; label9.TextColor = Color.White; } if (Device.OS == TargetPlatform.Windows && Device.Idiom != TargetIdiom.Tablet) { picker1.BackgroundColor = Color.Gray; picker2.BackgroundColor = Color.Gray; } }
public static void SetTitleIcon(BindableObject bindable, FileImageSource value) { bindable.SetValue(TitleIconProperty, value); }
public AddRatingView(Cheese cheese) { _viewModel = new AddRatingViewModel (cheese, this); BindingContext = _viewModel; var cheeseName = new Label (); cheeseName.Text = string.Format ("The cheese name is {0}", _viewModel.RatingToAdd.CheeseName); var dairyName = new Label () { Text = "Dairy Name" }; dairyName.Text = string.Format ("The dairy name is {0}", _viewModel.RatingToAdd.DairyName); var ratingLabel = new Label () { Text = "Rating:" }; var notesLabel = new Label () { Text = "Notes:" }; var ratingView = new RatingView (true); ratingView.SetBinding (RatingView.WedgeRatingProperty, "RatingToAdd.WedgeRating"); var notesEntry = new Entry () { }; notesEntry.SetBinding (Entry.TextProperty, "RatingToAdd.Notes"); var entryGrid = new Grid () { ColumnSpacing = 0, RowSpacing = 2, VerticalOptions = LayoutOptions.Start }; entryGrid.RowDefinitions.Add (new RowDefinition (){ Height = GridLength.Auto }); entryGrid.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); entryGrid.ColumnDefinitions.Add (new ColumnDefinition () { Width = GridLength.Auto }); entryGrid.ColumnDefinitions.Add (new ColumnDefinition (){ Width = new GridLength (1, GridUnitType.Star) }); entryGrid.Children.Add (ratingLabel, 0, 0); entryGrid.Children.Add (ratingView, 1, 0); entryGrid.Children.Add (notesLabel, 0, 1); entryGrid.Children.Add (notesEntry, 1, 1); var saveButton = new Button () { Text = "Save", FontAttributes = FontAttributes.Bold, BackgroundColor = CheeseColors.RED, TextColor = Color.White, FontSize = 18, BorderRadius = 0 }; saveButton.Command = _viewModel.AddRatingCommand; var cancelButton = new Button () { Text = "Cancel", FontAttributes = FontAttributes.Bold, BackgroundColor = CheeseColors.GRAY, TextColor = Color.White, FontSize = 18, BorderRadius = 0 }; var grid = new Grid () { RowDefinitions = { new RowDefinition { Height = new GridLength (40, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition () { Width = new GridLength (.5, GridUnitType.Star) }, new ColumnDefinition () { Width = new GridLength (.5, GridUnitType.Star) } }, Padding = new Thickness (0, 0, 0, 0), RowSpacing = 0, ColumnSpacing = 0 }; grid.Children.Add (saveButton, 0, 0); grid.Children.Add (cancelButton, 1, 0); cancelButton.Clicked += async (sender, e) => { await Navigation.PopAsync(true); }; var cameraImage = new FileImageSource (); cameraImage.File = "Camera.png"; var cameraButton = new Button () { Image = cameraImage, Text="Take Photo" }; cameraButton.Clicked += async (sender, e) => { var cv = new CameraView(); await Navigation.PushModalAsync(cv); }; var scroll = new ScrollView (); scroll.Content = new StackLayout { Children = { cheeseName, dairyName, entryGrid, cameraButton, grid } }; var headerImage = new Image { Source = "Rectangle1.png", Aspect = Aspect.AspectFill }; Content = new StackLayout() { Children = { headerImage, scroll } }; }
public IconLabelView(Opdracht opdracht, FileImageSource source, String text) { adressen = DataController.Instance.GetAddresses(); presatielijst = DataController.Instance.GetAchievements(); gemeentes = DataController.Instance.GetCitys(); adrestText = adressen[opdracht.Adres].Straat + " " + adressen[opdracht.Adres].Nummer + ", " + gemeentes[adressen[opdracht.Adres].Gemeente].Postcode + " " + gemeentes[adressen[opdracht.Adres].Gemeente].Plaats; BackgroundColor = StyleKit.CardFooterBackgroundColor; img = new Image() { Source = source, HeightRequest = 10, WidthRequest = 10 }; var label = new Label() { Text = text, FontSize = 9, FontAttributes = FontAttributes.Bold, TextColor = StyleKit.LightTextColor }; var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (sender, e) => { if (label.Text == "Navigeer") { label.Text = "geklikt"; Geocode geo = new Geocode(); geo.Latitude = opdracht.Latitude; geo.Longitude = opdracht.Longitude; Place place = new Place(); if (Device.OS == TargetPlatform.iOS) { place.Name = adrestText; place.Vicinity = "Brugge"; } else { place.Name = "Brugge"; place.Vicinity = adrestText; } place.Location = geo; LaunchMapApp(place); } else if (label.Text == "Start") { label.Text = "Stop"; opdracht.Statuslabel = "Stop"; img.Source = StyleKit.Icons.Stop; opdracht.starttijd = DateTime.Now; DataController.Instance.Update(opdracht); SyncController.Instance.SyncNeeded(); bool found = false; foreach (Prestatie pres in presatielijst) { if (pres.OpdrachtID == opdracht.ID) { found = true; } } if (!found) { Prestatie presatie = new Prestatie(); presatie.Aanvang = DateTime.Now; presatie.Duur = 0; presatie.OpdrachtID = opdracht.ID; DataController.Instance.Insert(presatie); SyncController.Instance.SyncNeeded(); } } else if (label.Text == "Stop") { label.Text = "Start"; opdracht.Statuslabel = "Start"; img.Source = StyleKit.Icons.Resume; Debug.WriteLine("gevonden tijd: " + opdracht.starttijd); start = opdracht.starttijd.Value.TimeOfDay; DataController.Instance.Update(opdracht); SyncController.Instance.SyncNeeded(); einde = DateTime.Now.TimeOfDay; TimeSpan tijd = CalculateTime(); foreach (Prestatie pres in presatielijst) { if (pres.OpdrachtID == opdracht.ID) { pres.Duur = pres.Duur + Convert.ToDecimal(tijd.TotalMinutes); DataController.Instance.Update(pres); SyncController.Instance.SyncNeeded(); } } } }; label.GestureRecognizers.Add(tapGestureRecognizer); //TO-DO: latitude & longitude in een navigeerknop. //opdracht.Latitude, opdracht.Longitude var stack = new StackLayout() { Padding = new Thickness(5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center, Children = { img,label } }; Content = stack; }
async Task PushTabbedLeadPage(Account lead = null) { LeadDetailViewModel viewModel = new LeadDetailViewModel(Navigation, lead); var leadDetailPage = new LeadDetailPage() { BindingContext = viewModel, Title = TextResources.Details, }; if (Device.OS == TargetPlatform.iOS) leadDetailPage.Icon = Icon = new FileImageSource() { File = "LeadDetailTab" }; if (lead != null) { leadDetailPage.Title = lead.Company; } else { leadDetailPage.Title = "New Lead"; } leadDetailPage.ToolbarItems.Add( new ToolbarItem(TextResources.Save, "save.png", async () => { if (string.IsNullOrWhiteSpace(viewModel.Lead.Company)) { await DisplayAlert("Missing Information", "Please fill in the lead's company to continue", "OK"); return; } var answer = await DisplayAlert( title: TextResources.Leads_SaveConfirmTitle, message: TextResources.Leads_SaveConfirmDescription, accept: TextResources.Save, cancel: TextResources.Cancel); if (answer) { viewModel.SaveLeadCommand.Execute(null); await Navigation.PopAsync(); } })); await Navigation.PushAsync(leadDetailPage); }
private StackLayout GetOptionPage() { // toggleButton.WidthRequest = picker1.Width - label5.Width; // toggleButton2.WidthRequest = picker1.Width - label9.Width; toggleButton.HorizontalOptions = LayoutOptions.Fill; toggleButton2.HorizontalOptions = LayoutOptions.Fill; var layoutpage = new StackLayout { Spacing = 10, Orientation = StackOrientation.Vertical, //Padding = Device.OnPlatform(iOS: 10, Android : 10, WinPhone : 50), Children = { label5, toggleButton } }; // var togglepage = new StackLayout // { // Spacing = 10, // Orientation = StackOrientation.Vertical, // //Padding = Device.OnPlatform(iOS: 10, Android : 10, WinPhone : 50), // Children = { label9, toggleButton2 } // }; var page1 = new StackLayout { Spacing = 10, Orientation = StackOrientation.Vertical, //Padding = Device.OnPlatform(iOS: 10, Android : 10, WinPhone : 50), Children = { label3, picker1 } }; var page2 = new StackLayout { Spacing = 10, Orientation = StackOrientation.Vertical, //Padding = Device.OnPlatform(iOS: 10, Android : 10, WinPhone : 50), Children = { label4 ,picker2} }; var page3 = new StackLayout { Spacing = 40, Orientation = StackOrientation.Vertical, //Padding = Device.OnPlatform(iOS: 10, Android: 10, WinPhone: 10), Children = { page1, page2 } }; var page = new StackLayout(); if (Device.Idiom != TargetIdiom.Tablet) { page = new StackLayout { Spacing = 40, Orientation = StackOrientation.Vertical, Padding = Device.OnPlatform(iOS: 10, Android: 10, WinPhone: 10), Children = {page3, layoutpage} }; } else { page = new StackLayout { Spacing = 40, Orientation = StackOrientation.Vertical, Padding = Device.OnPlatform(iOS: 10, Android: 10, WinPhone: 10), Children = { page3 } }; } var page4 = new StackLayout { Spacing = 40, Orientation = StackOrientation.Vertical, //Padding = Device.OnPlatform(iOS: 10, Android: 10, WinPhone: 10), Children = { label6, page } }; if (Device.OS == TargetPlatform.WinPhone) { picker1.BackgroundColor = Color.Black; picker2.BackgroundColor = Color.Black; page.Spacing = 25; FileImageSource images = new FileImageSource(); images.File = "Check.png"; baritem.Icon = images; return page4; } if (Device.Idiom == TargetIdiom.Phone && Device.OS == TargetPlatform.Windows) { page.BackgroundColor = Color.Black; this.BackgroundColor = Color.Black; picker1.BackgroundColor = Color.Black; picker2.BackgroundColor = Color.Black; label3.TextColor = label4.TextColor = label5.TextColor = Color.White; label3.FontSize = label4.FontSize = label5.FontSize = 17; label3.HeightRequest = label4.HeightRequest = label5.HeightRequest = 25; } return page; }