Exemplo n.º 1
0
        public SessionCell()
        {
            title = new Label {
                YAlign = TextAlignment.Center
            };
            title.SetBinding(Label.TextProperty, "Title");

            label = new Label {
                YAlign = TextAlignment.Center,
                Font   = Font.SystemFontOfSize(10)
            };
            label.SetBinding(Label.TextProperty, "LocationDisplay");

            var fav = new Image {
                Source = FileImageSource.FromFile("favorite.png"),
            };
            //TODO: implement favorites
            //fav.SetBinding (Image.IsVisibleProperty, "IsFavorite");

            var text = new StackLayout {
                Orientation       = StackOrientation.Vertical,
                Padding           = new Thickness(0, 0, 0, 0),
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Children          = { title, label }
            };

            layout = new StackLayout {
                Padding           = new Thickness(20, 0, 0, 0),
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Children          = { text, fav }
            };
            View = layout;
        }
Exemplo n.º 2
0
        public TodoItemCell()
        {
            var label = new Label {
                VerticalTextAlignment = TextAlignment.Center,
                HorizontalOptions     = LayoutOptions.StartAndExpand
            };

            label.SetBinding(Label.TextProperty, "Name");

            var tick = new Image {
                Source            = FileImageSource.FromFile("check.png"),
                HorizontalOptions = LayoutOptions.End
            };

            tick.SetBinding(Image.IsVisibleProperty, "Done");

            var layout = new StackLayout {
                Padding           = new Thickness(20, 0, 20, 0),
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Children          = { label, tick }
            };

            View = layout;
        }
Exemplo n.º 3
0
        public PdfPage(BaseInboxMessage request, Document document, bool showSignButton, EventHandler OnAssinar)
        {
            this.Document         = document;
            this.SignatureRequest = request;

            this.Title = "PDF";

            if (Device.OS == TargetPlatform.iOS)
            {
                this.Icon = (FileImageSource)FileImageSource.FromFile("pdf.png");
            }

            pdfWebView = new CustomWebView
            {
                HorizontalOptions    = LayoutOptions.FillAndExpand,
                VerticalOptions      = LayoutOptions.FillAndExpand,
                MinimumHeightRequest = 300,
                OverviewMode         = true
            };

            if (showSignButton)
            {
                var relativeLayout = new RelativeLayout();

                relativeLayout.Children.Add(pdfWebView, Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }), Constraint.RelativeToParent((parent) => {
                    return(parent.Y);
                }), Constraint.RelativeToParent((parent) => {
                    return(parent.Width);
                }), Constraint.RelativeToParent((parent) => {
                    return(parent.Height - 50);
                }));

                Button btnAssinar = new Button()
                {
                    Text = AppResources.SIGN_DOCUMENT,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand
                };

                relativeLayout.Children.Add(btnAssinar, Constraint.RelativeToView(pdfWebView, (Parent, sibling) => {
                    return(0);
                }), Constraint.RelativeToView(pdfWebView, (parent, sibling) => {
                    return(sibling.Height);
                }), Constraint.RelativeToParent((parent) => {
                    return(parent.Width);
                }), Constraint.Constant(50));

                this.Content = relativeLayout;

                btnAssinar.Clicked += OnAssinar;
            }
            else
            {
                this.Content = pdfWebView;
            }

            CreateShareToolbarItem(this);
        }
Exemplo n.º 4
0
        private async void TomarClick(object sender, EventArgs e)
        {
            Resultado.Text     = "";
            Precision.Progress = 0;
            text.Text          = "";
            using (UserDialogs.Instance.Loading("Cargando imagen..."))
            {
                await CrossMedia.Current.Initialize();

                var foto = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions()
                {
                    CompressionQuality = 100,
                    SaveToAlbum        = true
                                         //Directory="clasificator",
                                         //Name="source.jpg"
                });

                if (foto == null)
                {
                    return;
                }

                _foto            = foto;
                ImgSource.Source = FileImageSource.FromFile(foto.Path);
            }
            await ClasificadorClick();
        }
Exemplo n.º 5
0
        public ImageSource FromCachedResource(string resource)
        {
            if (Cache.ContainsKey(resource))
            {
                ImageSource result;
                Cache[resource].TryGetTarget(out result);

                return(result);
            }
            {
                /*var imgArrayLazyTask = new Lazy<Task<byte[]>>(
                 *  async () =>
                 *  {
                 *      var assembly = typeof(ImageFactory).GetTypeInfo().Assembly;
                 *
                 *      using (var inputStream = assembly.GetManifestResourceStream(resource))
                 *      using (var outputStream = new MemoryStream())
                 *      {
                 *          await inputStream.CopyToAsync(outputStream);
                 *          return outputStream.ToArray();
                 *      }
                 *  },
                 *  isThreadSafe: true);
                 *
                 * imageSource = new StreamImageSource() { Stream = async _ => new MemoryStream(await imgArrayLazyTask.Value) };
                 */
                //imageSource = new StreamImageSource { Stream = (c) => GetStreamedImage(resource)};
                var source = FileImageSource.FromFile(resource);
                Cache[resource] = new WeakReference <ImageSource>(source);

                return(source);
            }
        }
Exemplo n.º 6
0
        public AccountIndexPage()
        {
            this.Title = "Wubi Paws";             //Bug should be My Account;

            ToolbarItem logout = new ToolbarItem();

            logout.Order = ToolbarItemOrder.Primary;
            logout.Icon  = (FileImageSource)FileImageSource.FromFile("ic_exit_to_app_black_24dp.png");
            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetBackButtonTitle(this, "Back");

            logout.Clicked          += SignOut;
            this.CurrentPageChanged += AccountIndexPage_CurrentPageChanged;

            this.ToolbarItems.Add(logout);
            if (Device.OS == TargetPlatform.iOS)
            {
                this.TintColor = AppSettings.Constants.ButtonSecondaryBlueTintColor;
            }
            this.Children.Add(ViewFactory.CreatePage <AccountViewModel, MyProfilePage> () as MyProfilePage);
            this.Children.Add(ViewFactory.CreatePage <PetListingViewModel, PetsList> () as PetsList);
            this.Children.Add(ViewFactory.CreatePage <PetServicesViewModel, PetServicesListPage> () as PetServicesListPage);
            this.Children.Add(new SettingsPage());
            base.SwipeEnabled = true;
        }
        private void Init()
        {
            var addTile = new ToolbarItem
            {
                Text = "Add",
                Icon = OnPlatform(
                    iOS: (FileImageSource)FileImageSource.FromFile("Icons/Done.png"),
                    Android: (FileImageSource)FileImageSource.FromFile("Done.png"),
                    Windows: (FileImageSource)FileImageSource.FromFile("Assets/Icons/Done.png"))
            };

            addTile.SetBinding(ToolbarItem.CommandProperty, new Binding("AddTileCommand"));
            ToolbarItems.Add(addTile);

            var removeTile = new ToolbarItem
            {
                Text = "Remove",
                Icon = OnPlatform(
                    iOS: (FileImageSource)FileImageSource.FromFile("Icons/Remove.png"),
                    Android: (FileImageSource)FileImageSource.FromFile("Remove.png"),
                    Windows: (FileImageSource)FileImageSource.FromFile("Assets/Icons/Remove.png"))
            };

            removeTile.SetBinding(ToolbarItem.CommandProperty, new Binding("RemoveTileCommand"));
            ToolbarItems.Add(removeTile);
        }
Exemplo n.º 8
0
        private async void TomarFoto(object sender, EventArgs e)
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                return;
            }

            var foto = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions()
            {
                PhotoSize          = PhotoSize.Custom,
                CustomPhotoSize    = 10,
                CompressionQuality = 92,
                Name = "image.jpg"
            });

            _foto = foto;

            if (_foto == null)
            {
                return;
            }

            Img.Source = FileImageSource.FromFile(_foto.Path);
        }
Exemplo n.º 9
0
        public ParticipantCell()
        {
            // L'image du calendrier à gauche
            var image = new Image {
                HorizontalOptions = LayoutOptions.Start
            };

            image.WidthRequest  = 40;
            image.HeightRequest = 40;
            image.Source        = FileImageSource.FromFile("picto_invite.png");

            // Le titre
            var titleLayout = CreateLayoutTitle();

            // L'icone de check de prsence à droite
            var imageCheck = new Image {
                HorizontalOptions = LayoutOptions.End
            };

            imageCheck.WidthRequest  = 30;
            imageCheck.HeightRequest = 30;
            imageCheck.Source        = FileImageSource.FromFile("check.png");
            imageCheck.SetBinding(Image.IsVisibleProperty, "IsPresenceValidee");

            var viewLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(20, 10, 20, 10),
                Children          = { image, titleLayout, imageCheck }
            };

            View = viewLayout;
        }
Exemplo n.º 10
0
        public object?Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is string Name))
            {
                return(null);
            }

            string imagePath;

            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                imagePath = Name;
                break;

            case Device.iOS:
                imagePath = Name + ".png";
                break;

            case Device.UWP:
                imagePath = "Icons/" + Name + ".png";
                break;

            default:
                throw new PlatformNotSupportedException("Unsupported platform for loading images");
            }
            return(FileImageSource.FromFile(imagePath));
        }
Exemplo n.º 11
0
        public EvenementCell()
        {
            // L'image du calendrier à gauche
            var image = new Image {
                HorizontalOptions = LayoutOptions.Start
            };

            image.WidthRequest  = 40;
            image.HeightRequest = 40;
            image.Source        = FileImageSource.FromFile("picto_manifestation.png");

            // Le titre
            var titleLayout = CreateLayoutTitle();



            var viewLayout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(20, 10),
                Children    = { image, titleLayout }
            };

            View = viewLayout;
        }
        public BasePickerPage()
        {
            var doneButton = new ToolbarItem
            {
                Text = "Done",
                Icon = OnPlatform(
                    iOS: (FileImageSource)FileImageSource.FromFile("Icons/Done.png"),
                    Android: (FileImageSource)FileImageSource.FromFile("Done.png"),
                    Windows: (FileImageSource)FileImageSource.FromFile("Assets/Icons/Done.png"))
            };

            doneButton.Clicked += PickButtonClicked;
            ToolbarItems.Add(doneButton);

            var cancelButton = new ToolbarItem
            {
                Text = "Cancel",
                Icon = OnPlatform(
                    iOS: (FileImageSource)FileImageSource.FromFile("Icons/Cancel.png"),
                    Android: (FileImageSource)FileImageSource.FromFile("Cancel.png"),
                    Windows: (FileImageSource)FileImageSource.FromFile("Assets/Icons/Cancel.png"))
            };

            cancelButton.Clicked += CancelButtonClicked;
            ToolbarItems.Add(cancelButton);
        }
Exemplo n.º 13
0
        //ItemsFollowViewModel viewModel;
        public FollowUsPage()
        {
            Title = "Follow us";
            InitializeComponent();
            //BindingContext = viewModel = new ItemsFollowViewModel();
            LogoFU.Source = FileImageSource.FromFile("header-logo-hichem.png");
            ObservableCollection <Item> employeeList = new ObservableCollection <Item>();

            ListFU.ItemsSource = employeeList;

            employeeList.Add(new Item {
                Id = Guid.NewGuid().ToString(), Text = "Facebook", Icon = "FACEBOOK.png", GoToDetail = "listArrow.png", DetailUrl = "https://www.facebook.com/Keohichemcaocap/"
            });
            employeeList.Add(new Item {
                Id = Guid.NewGuid().ToString(), Text = "Youtube", Icon = "YOUTUBE.png", GoToDetail = "listArrow.png", DetailUrl = "https://www.youtube.com/channel/UCT12GWcVZiDyfYB2ztLouWA"
            });
            employeeList.Add(new Item {
                Id = Guid.NewGuid().ToString(), Text = "Trụ sở", Icon = "ADDRESS.png", GoToDetail = "listArrow.png", DetailPage = new MapPage()
            });
            employeeList.Add(new Item {
                Id = Guid.NewGuid().ToString(), Text = "Đặt hẹn lịch", Icon = "LICHHEN.png", GoToDetail = "listArrow.png", DetailPage = new HICHEM.Views.ApointmentPage()
            });
            employeeList.Add(new Item {
                Id = Guid.NewGuid().ToString(), Text = "Đăng ký nhà phân phối", Icon = "PHANPHOI.png", GoToDetail = "listArrow.png", DetailPage = new HICHEM.Views.DistributorPage()
            });
            //employeeList.Add(new Item { Id = Guid.NewGuid().ToString(), Text = "Tiện ích", Icon = "COUPON.png", GoToDetail = "listArrow.png", DetailUrl = "tienich.html" });
        }
Exemplo n.º 14
0
        private async void BtnAddImage_Clicked(object sender, System.EventArgs e)
        {
            if (this.panelImages.Children.Count >= 5)
            {
                return;
            }

            var re = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions()
            {
                CompressionQuality = 92, PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium
            });

            if (re != null && !string.IsNullOrEmpty(re.Path))
            {
                var image = new Image();
                image.Source        = FileImageSource.FromFile(re.Path);
                image.Aspect        = Aspect.AspectFill;
                image.WidthRequest  = 50;
                image.HeightRequest = 50;
                panelImages.Children.Insert(panelImages.Children.Count - 2, image);


                ViewModels.MyBJUT.MomentPublishPageViewModel.Images.Add(re);
            }
        }
Exemplo n.º 15
0
        public void Init()
        {
            VM.BindData();

            ListView lv = new ListView();

            lv.HorizontalOptions = LayoutOptions.FillAndExpand;
            lv.VerticalOptions   = LayoutOptions.FillAndExpand;
            lv.SetBinding(ListView.ItemsSourceProperty, new Binding("ItemCollection"));
            lv.ItemSelected += (sender, e) =>
            {
                if (e.SelectedItem != null)
                {
                    Navigation.PushAsync(new JegerPage((Jeger)e.SelectedItem), true);
                    ((ListView)sender).SelectedItem = null;
                }
            }; //Remember to remove this event handler on dispoing of the page;
            DataTemplate dt = new DataTemplate(typeof(CircleImageCell));

            dt.SetBinding(CircleImageCell.TextProperty, "Navn");
            dt.SetBinding(CircleImageCell.ImageSourceProperty, "Image");
            lv.ItemTemplate = dt;
            if (VM.ItemCollection.Any())
            {
                Content = lv;
            }
            else
            {
                var btn = new Button()
                {
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    Text            = "Opprett første jeger",
                    BackgroundColor = Color.FromHex("#74B058")
                };
                btn.Clicked += delegate(object sender, EventArgs args)
                {
                    Navigation.PushAsync(new JegerPage(new Jeger()), true);
                };
                var myImage = new CircleImage()
                {
                    Source          = FileImageSource.FromFile("placeholder_hunter.jpg"),
                    BorderThickness = 2,
                    BorderColor     = Color.White,
                    Aspect          = Aspect.AspectFill,
                    Margin          = 20
                };

                Content = new StackLayout()
                {
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.Center,
                    Children          =
                    {
                        myImage,
                        btn
                    }
                };
            }
        }
Exemplo n.º 16
0
        public StartPage()
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            this.BackgroundImageSource = FileImageSource.FromFile("drawable/twitch_gradient_flip.png");
        }
Exemplo n.º 17
0
        private async void ElegirImage(object sender, EventArgs e)
        {
            await CrossMedia.Current.Initialize();

            _foto = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new PickMediaOptions());

            Img.Source = FileImageSource.FromFile(_foto.Path);
        }
Exemplo n.º 18
0
        public SplashPage(string splashResourceName)
        {
            var imageSplash = new Image();

            imageSplash.Source = FileImageSource.FromFile(splashResourceName);;

            this.Content = imageSplash;
        }
Exemplo n.º 19
0
        public static async Task <FileImageSource> ResizeImage(this FileImageSource imageData, float width, float height)
        {
            await Task.Yield();

            FileStream file = await ResizeImage(imageData.ImageToStream(), width, height);

            return((FileImageSource)FileImageSource.FromFile(file.Name));
        }
Exemplo n.º 20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="imageData"></param>
        /// <param name="Quality">From 0 to 100</param>
        /// <returns></returns>
        public static async Task <FileImageSource> CompressImage(this FileImageSource imageData, int Quality)
        {
            await Task.Yield();

            FileStream file = await CompressImage(imageData.ImageToStream(), Quality);

            return((FileImageSource)FileImageSource.FromFile(file.Name));
        }
Exemplo n.º 21
0
 public RootPage(Page page) : base(page)
 {
     BackgroundImageSource = FileImageSource.FromFile("dance.jpg");
     ToolbarItems.Add(new ToolbarItem
     {
         Text    = "Menu",
         Command = new Command(() => { DisplayAlert("Hamburger menu", "Specialised for navigation", "Sounds great!"); })
     });
 }
Exemplo n.º 22
0
        private async void ElegirClick(object sender, EventArgs e)
        {
            await CrossMedia.Current.Initialize();

            var foto = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions());

            _foto            = foto;
            ImgSource.Source = FileImageSource.FromFile(foto.Path);
        }
Exemplo n.º 23
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Image img   = new Image();
            var   fname = (String)value;

            fname      = fname.Replace(' ', '_').ToLower() + ".jpg";
            img.Source = FileImageSource.FromFile(fname);

            return(img);
        }
Exemplo n.º 24
0
        public TestPage(string nick)
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            this.BackgroundImageSource = FileImageSource.FromFile("drawable/twitch_gradient_flip.png");

            Prepare(nick);
        }
        public ColorDetails(ColorModel color)
        {
            BindingContext = this.color = color;

            InitializeComponent();

            NavigationPage.SetTitleIcon(this, (FileImageSource)FileImageSource.FromFile("brush.png"));

            sliderTint.ValueChanged += SliderTintValueChanged;
        }
Exemplo n.º 26
0
        async void Handle_Clicked(object sender, System.EventArgs e)
        {
            await Plugin.Media.CrossMedia.Current.Initialize();

            _foto = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions()
            {
                Directory = "Vision",
                Name      = "Target.jpg"
            });

            LottieView.IsVisible = false;
            srcImage.Source      = FileImageSource.FromFile(_foto.Path);


            var stream = _foto.GetStream();

            var httpClient = new HttpClient();
            var url        = ServiceApiUrl;

            httpClient.DefaultRequestHeaders.Add("Prediction-Key", ApiKey);

            var content = new StreamContent(stream);

            var response = await httpClient.PostAsync(url, content);

            if (!response.IsSuccessStatusCode)
            {
                await DisplayAlert("Ups!", "Error 404", "a");

                return;
            }

            var json = await response.Content.ReadAsStringAsync();

            var c = JsonConvert.DeserializeObject <ClasificationResponse>(json);

            var p = c.Predictions.FirstOrDefault();

            if (p == null)
            {
                await DisplayAlert("Ups!", "Imagen no reconocida", "Ok");

                return;
            }
            //ResultLabel.Text = $"{p.TagName} - {p.Probability:p0}";

            if (p.TagName == "cross" || p.TagName == "exit")
            {
                await Navigation.PushPopupAsync(new OkPopupPage(p.TagName));
            }
            else
            {
                await Navigation.PushPopupAsync(new WarningPopupPage(p.TagName));
            }
        }
Exemplo n.º 27
0
        private void CreateShareToolbarItem(ContentPage page)
        {
            ToolbarItem ti = new ToolbarItem();

            ti.Priority = 0;
            ti.Order    = ToolbarItemOrder.Primary;
            ti.Icon     = (FileImageSource)FileImageSource.FromFile("share.png");
            ti.Command  = PdfShareViewModel.ShareCommand;

            page.ToolbarItems.Add(ti);
        }
Exemplo n.º 28
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            var fileName = value.ToString();

            return(FileImageSource.FromFile(fileName));
        }
Exemplo n.º 29
0
        private async void TomarFoto(object sender, EventArgs e)
        {
            await Plugin.Media.CrossMedia.Current.Initialize();

            _foto = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions()
            {
                Directory = "Vision",
                Name      = "Target.jpg"
            });

            Img.Source = FileImageSource.FromFile(_foto.Path);
        }
Exemplo n.º 30
0
        public CodeBehindAsyncPage(ISiteValidatorAsync asyncValidator)
        {
            _siteValidator = asyncValidator;

            Title           = "Code Behind Async";
            IconImageSource = FileImageSource.FromFile("code_branch_solid");

            Content = MyWebView;

            MyWebView.Navigating += OnNavigating;
            MyWebView.Navigated  += OnNavigated;
        }