Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

After Email confirm , User can sign up Information. how to do that?

$
0
0


After i clicked confirm button.

After I confirmed my pin number for Email validation,

And then i can register my Acount,..
how do i make it ?

right now, even though i did not clicked confirm button, i can register my information.

how do i make if condition that i have to click confirm button then register process working?

  <Entry x:Name="Entry_Email"  Placeholder="Email"></Entry>
        <Button x:Name="Confirlemailinfo" Text="Confirmed Email" Clicked="Confirm_email"/>





    public  void Confirm_email(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Entry_Email.Text))
            { 
            try
            {

                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress("sjin@pkim.com");
                mail.To.Add(Entry_Email.Text);
                mail.Subject = "Email Confirmation";
                mail.Body = "Confirm pin code:" + number;

                SmtpServer.Port = ;
                SmtpServer.Host = "smtp.gmail.com";
                SmtpServer.EnableSsl = true;
                SmtpServer.UseDefaultCredentials = false;
                SmtpServer.Credentials = new System.Net.NetworkCredential("");

                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {
                DisplayAlert("Faild", ex.Message, "OK");
            }
            PopupNavigation.Instance.PushAsync(new MyPopupPage(number));
            }
        else
            DisplayAlert("please", "Enter Email", "OK");
    }

To open another app from xamarin forms app

$
0
0

From a xamarin forms app, when we click a button is it possible to open an app in power apps (with SSO also) ? Could anyone give me suggestions.

Dark Mode

$
0
0

Hello, there is a way to force my app to use light mode? when the iPhone use dark mode some of the controls (entry and navigation bars) turns black and made me interface a little fuzzy.

thx in advance

How to share an url to my app?

$
0
0

I want to share an url, the url of page where I am, to my Xamarin Forms App (Android and iOS).

And when I',m going to share this url...

I want that my app appears into the share options list, to send this url to my app to a specific page, beacause I want to use this url strings into the app.

Play video UWP

$
0
0

I am using the following code to open a video in the UWP part of a Xamarin forms App.

   protected override void OnAppearing()
    {
        base.OnAppearing();

        try
        {
                var mainDir = FileSystem.AppDataDirectory;
                string filepath = Path.Combine(mainDir, "CCapture.mp4");
                if (File.Exists(filepath))
                    CrossMediaManager.Current.Play(filepath);
        }
        catch (Exception ex)
        {
            string errMessage = ex.Message;
        }

When I navigate to screen I can see the player but no video is displayed. If I use a http url it works.

Any help would be appreciated.

Can we Run a task(sending the data to server) in background when app killed(InActive) in IOS?

Uploading multiple Image Using FlowlistView

$
0
0

Hi Xamarin Forum

can I get a little help I want to upload my multiple image to a folder in my web server can some body help me here is my current codes

XAML

<ScrollView>
            <StackLayout>
                <StackLayout Orientation="Horizontal">
                    <Label Text="CREATE A POST" Margin="9,20,0,0" FontFamily="Raleway-Bold" FontAttributes="Bold" FontSize="16"></Label>
                </StackLayout>
                <Label Text="Title" FontFamily="Raleway-Black" Margin="20,0,20,0"></Label>
                <controls:CustomEntry x:Name="HouseName" TextColor="Black" Margin="20,0,20,0" BackgroundColor="Transparent" FontAttributes="Bold" WidthRequest="200"/>
                <StackLayout Orientation="Horizontal">
                    <StackLayout>
                        <Label Text="Year Built" FontFamily="Raleway-Black" Margin="20,0,20,0"></Label>
                        <controls:CustomEntry x:Name="yearbuiltentry" TextColor="Black" Margin="20,0,0,0" BackgroundColor="Transparent" FontAttributes="Bold" WidthRequest="150"/>
                    </StackLayout>
                    <StackLayout>
                        <Label Text="Price" FontFamily="Raleway-Black" Margin="20,0,10,0" HorizontalOptions="End"></Label>
                        <controls:CustomEntry x:Name="HousePrice" TextColor="Black" Margin="20,0,0,0" BackgroundColor="Transparent" FontAttributes="Bold" WidthRequest="190"/>
                    </StackLayout>
                </StackLayout>
                <Label Text="Location" FontFamily="Raleway-Black" Margin="20,0,20,0"></Label>
                <controls:CustomEntry x:Name="HouseLocation" TextColor="Black" Margin="20,0,20,0" BackgroundColor="Transparent" FontAttributes="Bold" WidthRequest="200"/>
                <Label Text="Description" FontFamily="Raleway-Black" Margin="20,0,20,0"></Label>
                <controls:CustomEntry x:Name="postContent" TextColor="Black" Margin="20,0,20,0" BackgroundColor="Transparent" FontAttributes="Bold" WidthRequest="200"/>
                <Label Text="IMAGES" FontAttributes="Bold" FontSize="16" FontFamily="Raleway-Bold" Margin="20,0,20,0"/>
                <StackLayout Orientation="Horizontal" HeightRequest="100" Margin="20,0,0,0">
                    <flv:FlowListView FlowColumnCount="3" x:Name="listItems" 
                        SeparatorVisibility="None"
                        HasUnevenRows="false" RowHeight="300">
                        <flv:FlowListView.FlowColumnTemplate>
                            <DataTemplate >
                                <ffimageloading:CachedImage  DownsampleToViewSize="true" x:Name="ImageContainer" AbsoluteLayout.LayoutFlags="All" HeightRequest="300" AbsoluteLayout.LayoutBounds="0,0,1,1" Source="{Binding .}"  Aspect="AspectFill" HorizontalOptions="FillAndExpand">
                                </ffimageloading:CachedImage>
                            </DataTemplate>
                        </flv:FlowListView.FlowColumnTemplate>
                    </flv:FlowListView>
                    <Button TextColor="White" BackgroundColor="Gray"  Text="+" Clicked="Handle_Clicked" Margin="5,0,10,0"/>
                </StackLayout>
                <controls:CustomEntry x:Name="FloorArea" TextColor="Black" Margin="20,10,20,10" BackgroundColor="Transparent" Placeholder="Size in Sq Ft" FontAttributes="Bold" WidthRequest="200"/>
                <Label Text="LIVING SPACE" FontFamily="Raleway-Black" Margin="20,0,10,0" FontAttributes="Bold"></Label>
                <StackLayout>
                    <StackLayout Orientation="Horizontal">
                        <Image Source="Bedroom.png" WidthRequest="50" HeightRequest="50"/>
                        <Label Text="Bedroom" FontFamily="Raleway-Black"/>
                        <Label BindingContext="{x:Reference inc_stepper}" Text="{Binding Value}" x:Name="Bedroom"/>
                        <Stepper Minimum="0" Maximum="4" x:Name="inc_stepper" Increment="1" StyleClass="stepperClass" />
                    </StackLayout>
                    <StackLayout Orientation="Horizontal">
                        <Image Source="Bath.png" WidthRequest="50" HeightRequest="50"/>
                        <Label Text="Baths" FontFamily="Raleway-Black"/>
                        <Label BindingContext="{x:Reference inc_stepper2}" Text="{Binding Value}" x:Name="BathToilet" />
                        <Stepper Minimum="0" Maximum="4" x:Name="inc_stepper2" Increment="1" Margin="100,0,0,0" />
                    </StackLayout>
                    <StackLayout Orientation="Horizontal">
                        <Image Source="Floors.png" WidthRequest="50" HeightRequest="50"/>
                        <Label Text="Floors" FontFamily="Raleway-Black"/>
                        <Label BindingContext="{x:Reference inc_stepper3}" Text="{Binding Value}" x:Name="Storey" />
                        <Stepper Minimum="0" Maximum="4" x:Name="inc_stepper3" Increment="1" Margin="100,0,0,0" />
                    </StackLayout>
                </StackLayout>
                <Label Text="AVAILABLE FOR" FontFamily="Raleway-Black" Margin="20,0,10,0" FontAttributes="Bold"></Label>
                <Button Text="UPLOAD" Clicked="Upload_File"/>
            </StackLayout>
        </ScrollView>

CodeBehind

public partial class PostCreationPage : ContentPage
{
//public List postslist;
//string json;
List _images = new List();
public PostCreationPage()
{
InitializeComponent();

    }

    protected override void OnAppearing()
    {
        base.OnAppearing();

        MessagingCenter.Subscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelected", (s, images) =>
        {
            listItems.FlowItemsSource = images;
            _images = images;
        });
    }
    protected override void OnDisappearing()
    {
        base.OnDisappearing();
        MessagingCenter.Unsubscribe<App, List<string>>(this, "ImagesSelected");
    }

    private MediaFile _mediaFile;

    async void Handle_Clicked(object sender, System.EventArgs e)
    {

        // await DependencyService.Get<IMediaService>().OpenGallery();

        //_mediaFile.GetStream();
        //var memoryStream = new MemoryStream();

        //if (Device.RuntimePlatform == Device.iOS)
        //{
        //    //If the image is modified (drawings, etc) by the users, you will need to change the delivery mode to HighQualityFormat.
        //    bool imageModifiedWithDrawings = false;
        //    if (imageModifiedWithDrawings)
        //    {
        //        await GMMultiImagePicker.Current.PickMultiImage(true);
        //    }
        //    else
        //    {
        //        await GMMultiImagePicker.Current.PickMultiImage();
        //    }

        //    MessagingCenter.Unsubscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectediOS");
        //    MessagingCenter.Subscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectediOS", (s, images) =>
        //    {
        //        //If we have selected images, put them into the carousel view.
        //        if (images.Count > 0)
        //        {
        //            listItems.ItemsSource = images;

        //        }
        //    });
        //}
        //If we are on Android, call IMediaService.
        if (Device.RuntimePlatform == Device.Android)
        {
            DependencyService.Get<IMediaService>().OpenGallery();

            MessagingCenter.Unsubscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectedAndroid");
            MessagingCenter.Subscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectedAndroid", (s, images) =>
            {
                //If we have selected images, put them into the carousel view.
                if (images.Count > 0)
                {
                    listItems.ItemsSource = images;   
                }
            });
        }

    }

    private List<string> CompressAllImages(List<string> totalImages)
    {
        int displayCount = 1;
        int totalCount = totalImages.Count;
        List<string> compressedImages = new List<string>();
        foreach (string path in totalImages)
        {
            compressedImages.Add(DependencyService.Get<ICompressImages>().CompressImage(path));
            displayCount++;
        }
        return compressedImages;
    }

    private async void Upload_File(object sender, EventArgs e)
    {
        List<string> imagePaths = _images;

        string userfirstname = App.FirstName;
        var page = new LoadingPage();
        var content = new MultipartFormDataContent();
        var imageName = Path.GetFileName(imagePaths.ToString());
        await PopupNavigation.Instance.PushAsync(page);

        var httpClient = new HttpClient();

        var Absolutepath_1 = "http://167.86.109.234:8087/Uploads";

        Pipeline databaseConnect = new Pipeline();
        try
        {
            SqlCommand sqlInsert = new SqlCommand("INSERT INTO tablename(House_Name, Post_Content, Photo, Photo_2, Photo_3, Photo_4, Location, Floor_Area, Price, Bedroom, Toilet_And_Bath, Uploader, Date_Uploaded) " +
            "VALUES(@HouseName, @PostContent, @Photo, @Photo2, @Photo3, @Photo4, @Location, @Price, @Floor, @Bedroom, @TB,  @Uploader, @DateUploaded)", databaseConnect.connectDB());
             {
                sqlInsert.Parameters.Add("@Photo", SqlDbType.VarChar);
                sqlInsert.Parameters.Add("@Photo2", SqlDbType.VarChar);
                sqlInsert.Parameters.Add("@Photo3", SqlDbType.VarChar);
                sqlInsert.Parameters.Add("@Photo4", SqlDbType.VarChar);

                foreach (var value in imagePaths)
                {
                    string extensionName = ".jpg";
                    string pathNames = Absolutepath_1 + "/" + Path.GetFileName(value) + extensionName;
                    sqlInsert.Parameters["@Photo"].Value = pathNames;
                    sqlInsert.Parameters["@Photo2"].Value = pathNames;
                    sqlInsert.Parameters["@Photo3"].Value = pathNames;
                    sqlInsert.Parameters["@Photo4"].Value = pathNames;

                }
                sqlInsert.Parameters.AddWithValue("@Uploader", userfirstname);
                sqlInsert.Parameters.AddWithValue("@DateUploaded", DateTime.Now);
                sqlInsert.Parameters.AddWithValue("@Location", HouseLocation.Text);
                sqlInsert.Parameters.AddWithValue("@Price", HousePrice.Text);
                sqlInsert.Parameters.AddWithValue("@Floor", FloorArea.Text);
                sqlInsert.Parameters.AddWithValue("@Bedroom", Bedroom.Text);
                sqlInsert.Parameters.AddWithValue("@HouseName", HouseName.Text);
                sqlInsert.Parameters.AddWithValue("@TB", BathToilet.Text);
                sqlInsert.Parameters.AddWithValue("@Storey", Storey.Text);
                sqlInsert.Parameters.AddWithValue("@PostContent", postContent.Text);

                int i = sqlInsert.ExecuteNonQuery();

                await PopupNavigation.Instance.PopAsync();
                await Navigation.PopAsync();

                await DisplayAlert("Success", "Uploaded to Database.", "OK");
             }

        }
        catch (Exception ex)
        {

        }
    }

    internal static StreamContent CreateFileContent(Stream stream, string fileName, string contentType)
    {
        var fileContent = new StreamContent(stream);

        fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") {
            Name = "\"files\"",
            FileName = "\"" + fileName + "\""
        };

        return fileContent;
    }

}

Thanks in advance

Download video or file with progress indication from app in xamarin forms

$
0
0

Can any one Please let me know how to do Download video or file with progress indication from app in xamarin forms ?
Please help me on this?

Thanks in advance.


How to pass parameter from Rg.Plugin.Popup to content page?

$
0
0

When I am going to pass parameter from Rg.Plugin.Popup page to a Content page,the content page will reload
so how to accept parameters from popup page to content page?

Master Detail on Android (Prism) - Accessing Camera via Detail disables Hamburger Menu button

$
0
0

HI,

I have a MasterDetail Page with a button to access the Camera or Gallery on several of the Detail Pages. I'm noticing that upon exiting the Camera/Gallery the Hamburger Menu button is disabled and the only way to access the Menu is by swiping from the left of the screen.

Has anyone come across this behaviour and found a workaround?

Thanks in advance

How read metadata with crossmediamanager in audio stream.

$
0
0

public async void PlayStream()
{
var mediaItem = await CrossMediaManager.Current.Play("URL");
mediaItem.MetadataUpdated += (sender, args) => {
title = args.MediaItem.Title;
};
}
Everything works correctly with an mp3 file, while metadata is not received with a streaming stream. Why ?

Set different external storage path for xam.plugin.media?

$
0
0

I would like to save the photos in the private folder of the application (android/data/com.companyname...) on the SD card and not on emulated/0/Android/data/... Is it possible to change this parameter or do I have to create my own custom camera?

I get the path from Context.GetExternalFilesDirs list

Thanks

Displaying all images inside FlowListVIew

$
0
0

Hi Xamarin Forum
does anyone already used FlowlistView to display images from recorded file path in database and display the image in a tile design just like instagram?

Binding with StringFormat only works after hot reload!

$
0
0

When the page appears, the label becomes invisible:
<Label Text="{Binding NoDays, StringFormat={local:Translate workingDays}}"/>
but if I issued a hot reload (for example; typing a space after the end tag and then save)
the text is shown with the correct format!

A bug?!

How to capture (within time interval) GeoLocation without button click (run as background service)

$
0
0

How to capture GeoLocation (latitude, longitude and current date and time) without button click, run like background service/program within some time interval or when location is changed using Xamarin form.


Changing MainPage between AppShell and NagivationPage breaks app screen.

$
0
0

Hello.
I found an issue of Xamarin.Forms 4.0 on Changing MainPage between AppShell and NagivationPage.

It is very easy to reproduce the issue.

1) Create a Xamarin.Forms 4.0 solution with AppShell Template

2) Add a Content Page (LoginPage.xaml)

3) Change MainPage at App.xaml.cs like this;

        public App()
        {
            InitializeComponent();

            DependencyService.Register<MockDataStore>();
            //MainPage = new AppShell();
            MainPage = new NavigationPage(new LoginPage());
        }

4) Change MainPage in LoginPage like this;

        private void LoginButton_Clicked(object sender, EventArgs e)
        {
            Application.Current.MainPage = new AppShell();
        }

5) Add a MenuItem in AppShell and Add Logout method like this;

  private void LogoutMenuItem_Clicked(object sender, EventArgs e) {
           Application.Current.MainPage = new NavigationPage(new Views.LoginPage());
  }

6) Bulid and run the app

7) “Login and Logout” action makes app screen broken like the attached screen shot file.

App MainPage is changed like this;

NavigationPage(new Views.LoginPage()) => new AppShell() => NavigationPage(new Views.LoginPage()).

It is very common pattern to implement Login function and I am regarding it must be a XF bug.

It is very easy to reproduce, but I attached my source code for the convenience

My testing environment is Visual Studio 2019 on Windows 10 Pro and I updated XF 4.0 up to date.

Is there any solution or workaround to solve the issue?

Best regards.

Forms to Native and back to Forms and still maintain the Forms navigation stack?

$
0
0

Hi All
How can I maintain the navigation stack in following scenario

  1. Page 1 on Forms

  2. Page 2 on IOS using page renderers

  3. Page 3 on IOS is a UIViewController (Lets call this ProcessImagePage) created & called from custom renderer from step 2

  4. When Page 3 is done processing I navigate back to Page 4 on forms via following code:

var secondViewController = App.GoToPostScanPage().CreateViewController(); NavigationController.PushViewController(secondViewController, true);

The navigation stack is like this
Page 1-> ProcessImagePage-> Page 3

Is there a way I can maintain the navigation stack to be
Page 1-> Page 2-> Page 3?

More details on my approach available on this SO post:

http://stackoverflow.com/questions/28084453/xamarin-forms-to-native-back-query

Thanks
Supreet

Button States

$
0
0

How i can make states in button?
Example:
0 state - transparent button background and string label = null
1 state - green button background and string label = label
2 state - red button background and string label = !label

There will be more such buttons 10

Labels and Editor controls crash when text is set with large number of characters per line

$
0
0

In Xamarin Forms 4.4 if you have a really long string with no line breaks it crashes both the editor and label controls

Is there any way to implement Stripe card widget in the Xamarin.Forms?

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>