Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Pickers opens box twice when focused after focus an entry

$
0
0

Hi everyone!!
I have a big issue that I can't solve from myself.

like the title says, in my android app (using xamarin.forms 3.4.0.1009999 after I updated from a very old version) when I select an entry, then tap over a picker, it opens twice.
A workaround I found is to place the picker in a StackLayout.. but when the picker is in a grid this workaround doesn't work.

Searching into the web, this issue should be resolved in release 3.4.0.1 so.. any ideas?

thanks!!!


"sharpie pod bind" and simulator architecture

$
0
0

Hello,
I have a library that I am binding for Xamarin.
My library have multiple dependencies.
I used "sharpie pod bind" command to create the .frameworks used as native references.

My problem is that the the .framework generated by the command "sharpie pod bind" contain only devices architectures, and does not include simulator.
Is there a way to run "sharpie pod bind" for the simulator architecture ?
Otherwise, is there a way to know what commands are executed when running "sharpie pod bind"

Navigating from Detail Page to a new NavigationPage working in Code Behind but now working with MVVM

$
0
0

Hello everyone, I'm facing a problem with navigation in MasterDetail page,
Here is what I want to do
MasterDetail Page -> On the DetailPage I have a listview that when I tap the item I want to go to a new Hierarchical NavigationPage -> Go to the page of the Item clicked.

If I implement on the code behind the XAML Detail Page it works, It navigate to the PlacePage fine the way I want.

    private async void MyListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
    {
        if(e.SelectedItem == null)
            return;

        var placeData = e.SelectedItem as Place;
        await Navigation.PushAsync(new PlacePage(placeData));
        MyListView.SelectedItem = null;
    }

But I want to implement using MVVM, I have a Navigation Service that I call this way from the ViewModel:

    private async void PlaceTapped(Place place)
    {
        await this._navigationService.NavigateToPlace(place);
    }

And inside the navigation service I have:

    public async Task NavigateToPlace(Place placeData)
    {
        try
        {
            await Application.Current.MainPage.Navigation.PushAsync(new PlacePage(placeData));
        }
        catch(Exception ex)
        {
            Debug.WriteLine(ex);
        }
    }

It is the same PushAsync as in the Codebehind but It throw this error:
System.InvalidOperationException: PushAsync is not supported globally on Android, please use a NavigationPage.

Can anyone help me?

How to get the grid.row and grid.column value while clicking the button

$
0
0


<Grid.RowDefinitions>



</Grid.RowDefinitions>
<Grid.ColumnDefinitions>



</Grid.ColumnDefinitions>

    <Button Grid.Row="0" Grid.Column="0" BackgroundColor="White" Clicked="Button_Clicked"/>
    <Button Grid.Row="0" Grid.Column="1" BackgroundColor="White" Clicked="Button_Clicked"/>
    <Button Grid.Row="0" Grid.Column="2" BackgroundColor="White" Clicked="Button_Clicked"/>

    <Button Grid.Row="1" Grid.Column="0" BackgroundColor="White" Clicked="Button_Clicked"/>
    <Button Grid.Row="1" Grid.Column="1" BackgroundColor="White" Clicked="Button_Clicked"/>
    <Button Grid.Row="1" Grid.Column="2" BackgroundColor="White" Clicked="Button_Clicked"/>

    <Button Grid.Row="2" Grid.Column="0" BackgroundColor="White" Clicked="Button_Clicked"/>
    <Button Grid.Row="2" Grid.Column="1" BackgroundColor="White" Clicked="Button_Clicked"/>
    <Button Grid.Row="2" Grid.Column="2" BackgroundColor="White" Clicked="Button_Clicked"/>
</Grid>

While clicking a button i need to fetch the row and column value.Is it possible?

ListView with CachingStrategy="RecycleElement" UIKit Consistency error

$
0
0

Using Visual Studio 2019 Preview, I created an Xamarin Forms Shell project with iOS and Android apps.

I updated the MockDataStore to add 1000 items to the list.

The list view has CachingStrategy="RecycleElement"

        <ListView 
            x:Name="ItemsListView" 
            ItemsSource="{Binding Items}"
            VerticalOptions="FillAndExpand"
            HasUnevenRows="true"
            IsPullToRefreshEnabled="false"
            CachingStrategy="RecycleElement"
            ItemSelected="OnItemSelected">

When I run the app in the iOS simulator or on an iPhone, I can scroll the list, but eventually the app crashes with the error below.

If I change the CachingStrategy="RecycleElementAndDataTemplate", the error no longer occurs.

Any idea why? What is it doing under the covers that I need to account for?

Thank you,

Michael

Unhandled Exception:
UIKit.UIKitThreadAccessException: UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.
at UIKit.UIApplication.EnsureUIThread () [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:88
at UIKit.UIGestureRecognizer.RemoveTarget (Foundation.NSObject target, System.IntPtr action) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIGestureRecognizer.g.cs:342
at UIKit.UIGestureRecognizer.OnDispose () [0x00016] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIGestureRecognizer.cs:41
at UIKit.UIGestureRecognizer.Dispose (System.Boolean disposing) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIGestureRecognizer.g.cs:959
at Foundation.NSObject.Finalize () [0x00000] in /Library/Fr
ameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/Foundation/NSObject2.cs:143
2019-02-04 11:41:49.073822-0500 WhiskyPassport.iOS[19858:1375488] Unhandled managed exception:
UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread. (UIKit.UIKitThreadAccessException)
at UIKit.UIApplication.EnsureUIThread () [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:88
at UIKit.UIGestureRecognizer.RemoveTarget (Foundation.NSObject target, System.IntPtr action) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIGestureRecognizer.g.cs:342
at UIKit.UIGestureRecognizer.OnDispose () [0x00016] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/UIKit/UIGestureRecognizer.cs:41
at UIKit.UIGestureRecognizer.Dispose (System.Boolean disposing) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin
.iOS/UIKit/UIGestureRecognizer.g.cs:959
at Foundation.NSObject.Finalize () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.13/src/Xamarin.iOS/Foundation/NSObject2.cs:143

Android Emulator Windows Hypervisor performance

$
0
0

I recently removed HAXM and enabled Hyper-v and Hypervisor for running the android emulator. Followed the docs and configured everything. Everything
seems to work fine, however the performance is a bit laggy. Not unusable and not terrible but not as snappy as Intel HAXM. So went back to using HAXM.

During research I noted that the official android docs recommend HAXM over Hypervisor.

Anyone else have a similar experience? Just curious.

Cheers

Push Notifications working on iOS 10 device, but not iOS 11

$
0
0

I've got them working fine on an ios 10 device, but on an iOS 11 device, they're not arriving. All the initialization code is being run successfully (I can see the Token being generated etc.) and no errors are appearing in the application output.

I can't see any documentation that says we need to do anything different on iOS 11. Or am I missing something?

[Newtonsoft.Json] Cannot deserialize my JSON ...

$
0
0

Hi devs !

I make my first mobile app with Xamarin.Forms. This app is connected to our Oracle DataBase with Rest Service.
Here is the error message:

My JSON result:

{
"items": [
{
"id_categorie": 1,
"label_categorie": "Situation dangereuse"
},
{
"id_categorie": 2,
"label_categorie": "Presqu'accident"
},
{
"id_categorie": 3,
"label_categorie": "Accident bénin"
},
{
"id_categorie": 4,
"label_categorie": "Accident de service"
},
{
"id_categorie": 5,
"label_categorie": "Accident de trajet"
},
{
"id_categorie": 6,
"label_categorie": "Incident Environnement"
}
]
}

And my C# code:

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Net.Http;
    using Newtonsoft.Json;

    using Xamarin.Forms;
    using Xamarin.Forms.Xaml;

    namespace PackQSE_Mobile.Views
    {
        public class Categories
        {
            public string id_categorie { get; set; }
            public string label_categorie { get; set; }
        }

        [XamlCompilation(XamlCompilationOptions.Compile)]
        public partial class Declaration : ContentPage
        {
            // Liste des Url pour l'accès aux données :
            private const string UrlCategories = "http://my-serv:8080/ords/pack_epi/categories_accidents/type_accidents";

            // Autres variables privées pour les protocoles HTTP...
            private HttpClient _client = new HttpClient();
            private ObservableCollection<Categories> _categories;

            public Declaration ()
            {
                InitializeComponent ();
            }

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

                var contenu = await _client.GetStringAsync(UrlCategories);
                var categories = JsonConvert.DeserializeObject<List<Categories>>(contenu);

                _categories = new ObservableCollection<Categories>(categories);
                ListeCategories.ItemsSource = _categories;
            }
        }
    }

What should I do to make it work ?

Thanks a lot in advance.


How can I fix a view to the bottom of the parent regardless of the soft keyboard showing in Android

$
0
0

I have a view like so:

I am trying to get the Entry to appear right above the keyboard, while still keeping the list view and it's items above visible and scrollable. I'm close to this by setting AdjustResize in my MainActivity.

The problem now is that the grid view beneath the entry gets pushed above the soft keyboard. I want it to be fixed to the bottom, i.e. hidden behind the keyboard. Is there anyway to achieve this, such as align parent bottom like in Android?

I have tried using scrollviews and stacklayout VerticalOptions but these haven't created the desired effect.

Here is my Xaml as it stands:

<ContentPage.Content>
    <StackLayout BackgroundColor="LightGray">
        <Grid VerticalOptions="FillAndExpand">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ListView x:Name="ListView"
               . . .
            </ListView>
        </Grid>
        <StackLayout Orientation="Horizontal" IsVisible="{Binding EntryShowing}">
            <Entry x:Name="Entry"
                    Text="{Binding EntryText}"
                    TextChanged="TextChanged"
                    HorizontalOptions="FillAndExpand"
                    Placeholder="PlaceHolder" 
                    Keyboard="Numeric"/>
            <Button Text="Button" Command="{Binding Command}"
                    HorizontalOptions="End"/>
        </StackLayout>
        <Grid Margin="5, 5" VerticalOptions="End">
            <Button x:Name="Button"
                    IsVisible="False"
                    Grid.Column="0"
                    VerticalOptions="CenterAndExpand"
                    HorizontalOptions="Start"
                    HeightRequest="30"
                    Text="Button"
                    FontSize="Micro"
                    FontAttributes="Bold"
                    TextColor="White"
                    BackgroundColor="Red"
                    Command="{Binding Command}" />
            <Button x:Name="SubmitButton"
                    Grid.Column="1"
                    VerticalOptions="CenterAndExpand"
                    HorizontalOptions="End"
                    HeightRequest="30"
                    CornerRadius="3"
                    Text="Done"
                    FontSize="9"
                    TextColor="White"
                    BackgroundColor="#5989B5"
                    Command="{Binding FinishCommand}"
                    IsVisible="{Binding IsVisible}" />
        </Grid>
    </StackLayout>
</ContentPage.Content>

Download and install .ipa file

$
0
0

I created *.ipa and *.plist files , uploaded in server.
I using this linke InstallApp and finally I can install app on real device.
but after install app doesn't work and General/Device Management doesn't have any trust.
How to install and run my application?

Xamarin Add another Section to Json

$
0
0

wondering if anybody can help with a solution I am looking for. In my Xamarin project, I have a 'add another line' button which adds another stack layout underneath it with the same controls as the first one. I want to save the new added one to JSON but not sure where to start, has anybody done this before?

I have added the first stack to json but i need it to reckonise the new ones on the button press. (sorry if it does not make sense)

Page.xaml Code:

`<Grid Margin="0, 30, 0, 30">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Label x:Name="NameLabel" Text="Name" TextColor="Black" FontSize="20" Grid.Column="0" Grid.Row="0" />
            <Label x:Name="ArrivalLabel" Text="Arrival" TextColor="Black" FontSize="20" Grid.Column="1" Grid.Row="0" />
            <Label x:Name="DescriptionLabel" Text="Description" TextColor="Black" FontSize="20" Grid.Column="2" Grid.Row="0" />
            <Label x:Name="DepartLabel" Text="Depart" TextColor="Black" FontSize="20" Grid.Column="3" Grid.Row="0" />
            <Label x:Name="SignLabel" Text="Sign" TextColor="Black" FontSize="20" Grid.Column="4" Grid.Row="0" />
        </Grid>
        <StackLayout x:Name="AddMoreNotes">
            <StackLayout>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Entry x:Name="Name" FontSize="20" Grid.Column="0" Grid.Row="0" />
                    <TimePicker x:Name="Arrival" FontSize="20" Grid.Column="1" Grid.Row="0" />
                    <Entry x:Name="Description" FontSize="20" Grid.Column="2" Grid.Row="0" />
                    <TimePicker x:Name="Depart" FontSize="20" Grid.Column="3" Grid.Row="0" />
                    <Entry x:Name="Sign" FontSize="20" Grid.Column="4" Grid.Row="0"/>
                </Grid>
            </StackLayout>
            <!--Add More View Spawns Here Do Not Change-->
        </StackLayout>

        <StackLayout Orientation="Horizontal" HorizontalOptions="End">
            <Button x:Name="AddMoreButton" Text="Add More" FontSize="16" BorderRadius="6" Clicked="AddMoreButton_Clicked" />
        </StackLayout>`

Page.xaml.cs Code:

    `private void AddMoreButton_Clicked(object sender, EventArgs e)
        {
            AddMoreNotes.Children.Add(new AttendanceAddMoreView()
            {

            });
        }

        private void SubmitButton_Clicked(object sender, EventArgs e)
        {
            var attendanceChecklist = new AttendanceChecklist();
            var AttentionOf1 = new List<AttentionOf>();
            var AttendanceSection1 = new List<AttendanceSection>();

            attendanceChecklist.TheDate = TheDate.Date;
            attendanceChecklist.AttendanceNumber = AttendanceNumber.Text;
            attendanceChecklist.EmployeeName = EmployeeName.Text;

            AttentionOf1.Add(new AttentionOf()
            {
                FirstName = FirstName.Text,
                LastName = LastName.Text,
                AddressLine1 = AddressLine1.Text,
                AddressLine2 = AddressLine2.Text,
                CityOrTown = CityOrTown.Text,
                County = County.Text,
                Postcode = Postcode.Text,
                ContractTitleOrRef = ContractTitleOrRef.Text,
                CustomerName = CustomerName.Text,
                SiteContact = SiteContact.Text,
            });

            AttendanceSection1.Add(new AttendanceSection()
            {
                Name = Name.Text,
                Arrival = Arrival.Time,
                Description = Description.Text,
                Depart = Depart.Time,
                Sign = Sign.Text
            });

            attendanceChecklist.attentionOf = AttentionOf1;
            attendanceChecklist.attendanceSection = AttendanceSection1;
            var json = JsonConvert.SerializeObject(attendanceChecklist, Newtonsoft.Json.Formatting.Indented);

            var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var filename = Path.Combine(documents, "AttendanceNote.json");
            File.WriteAllText(filename, json);
            }`

Unable to deploy any app to IOS device since upgrading Xcode and Xamarin

$
0
0

Hi, is anyone else having this issue. I get it with existing projects and new "helloWorld" ones... (targeting IOS 7.1)

writeDictToFile:1249 open failed for .../obj/iPhone/Debug/mtouch-cache/install-shadow-directory/3a0069ec9b7a99ce8b1e6aa71e94ecde/852945422379d79b73b5ea1ec8ac0f0cf41d0b21/ManifestCache.plist : No such file or directory

MDMCacheDirectoryManifest:1323 writeDictToFile failed to write to .../obj/iPhone/Debug/mtouch-cache/install-shadow-directory/3a0069ec9b7a99ce8b1e6aa71e94ecde/852945422379d79b73b5ea1ec8ac0f0cf41d0b21/ManifestCache.plist : No such file or directory

error MT1006: Could not install the application '.../Debug/JahGeneIOS.app' on the device Test iPhone: TimeOut Error (error: 0xe800000c).

ACR User Dialogs not working in Android PCL

$
0
0

I am trying to use ACR User Dialog in my PCL Project. It works like a charm in my iOS project build but when I try to build my Android Project, it gives me the below error:

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'AndHUD, Version=1.2.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'AndHUD.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) TimPapp.Droid

I already have AndHUD 1.2.0 package installed in NuGet. Any idea what can be the reason? Appreciate any help.

Empty space at the bottom of grid cell

$
0
0

Hi,
I saw a lot of people with empty space at the bottom of their ListView, but in my case, I have empty space at the bottom of each Grid in my ListView.

Red is the background color of the grid, yellow is the background color of EACH element I put in my grid.
Here is the XAML:
<ContentPage.Content> <StackLayout BackgroundColor="White"> <ListView x:Name="ItemListView" ItemsSource="{Binding ItemList}" HasUnevenRows="True"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Margin="10" RowSpacing="1" BackgroundColor="Red" VerticalOptions="Fill"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="2*" /> </Grid.ColumnDefinitions> <Label Text="{Binding RTNavisionDescriptionEN}" FontSize="18" TextColor="Black" FontAttributes="Bold" BackgroundColor="Yellow" Grid.Row="0" Grid.Column="1" /> <Label Text="{Binding RTPartNumber}" FontSize="14" BackgroundColor="Yellow" Grid.Row="1" Grid.Column="1" /> <Label Text="{Binding RTBrand}" FontSize="14" BackgroundColor="Yellow" Grid.Row="2" Grid.Column="1" /> <Label Text="{Binding PartStatusRT}" FontSize="14" BackgroundColor="Yellow" Grid.Row="3" Grid.Column="1" /> <Label Text="Inventaire" FontSize="14" BackgroundColor="Yellow" Grid.Row="4" Grid.Column="1" /> <Label Text="Prix" FontSize="14" BackgroundColor="Yellow" Grid.Row="5" Grid.Column="1" /> <Image Source="{Binding ImageURL}" BackgroundColor="Yellow" Grid.Row="0" Grid.Column="0" Grid.RowSpan="6" /> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout> </ContentPage.Content> </ContentPage>

Can anyone point me towards the reason for this empty space?

Thank you very much!

Parsing JSONString

$
0
0

Hi
I have trouble parsing my JSONstring retrived from my url.
below is my JSONString
php_resp = "{\"customer\":\"turkerler\",\"authority\":\"1023\",\"url\":\"http:\/\/gultekinteknik.com.tr\/file\/TURKERLER-LOGO1.png\",\"message\":\"Welcome\"}"

I need your urgent help guys! Thanks in advance.


Listview without tapping and higlighting. Only for displaying informations

$
0
0

Hi there,

I'm searching a solution for a listview which is not tappable. I only want to display some informations via this view - there should be no highlighting by tapping or any action after a tap. Is there still an existing workaround?

Thank you for your help.

FCM messages going to all devices even when a single device's Token is entered

$
0
0

When sending test messages from the FCM Console, even if I enter a single device's token using 'Test Device', the message is going to all my devices with the app installed.

Is this a known bug?

I know this is not Xamarin-specific - but people here may have used FCM and have experienced this!

making text clickable in uiLabel

$
0
0

I have a UILabel that will have text that I want clickable. For example, if a user enters in someone's name in the body, we want to to make that clickable and have it go to the user's profile, but I'm lost on how to get the tagging to work in terms on how to detect it and make it clickable when presented to the user.

I've looked around for solutions and I just get XF solutions which is not at all helpful.

Background service stop when app is terminated Xamarin android

$
0
0

Hello guys i'm trying to check for notification every 1 minute
when click the home button every 1 min i receive notification but when i terminate the app from the task manager i don't receive anything
this is my code :

Mainactivity.cs

    protected override void OnCreate(Bundle bundle)
    {
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;
        bbundle = bundle;
        base.OnCreate(bundle);
        InitBroadcast();

        global::Xamarin.Forms.Forms.Init(this, bbundle);
        UserDialogs.Init(this);
        ImageCircleRenderer.Init();
        RoundedBoxViewRenderer.Init();
        DeviceOrientationImplementation.Init();
        CarouselViewRenderer.Init();
        Xamarin.Forms.DataGrid.DataGridComponent.Init();
        Zumero.DataGridComponent.Init();


        // NOTIFICATION 
        LocalNotificationsImplementation.NotificationIconId = Resource.Drawable.app_epf;


        LoadApplication(new App());
        // BAckground task for notification 

        var intent = new Intent(this, typeof(PeriodicService));
        StartService(intent);


        AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
            //Console.WriteLine(args.ExceptionObject.GetType());

        };



    }

     void InitBroadcast()
    {
        TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc));
        long millis = (long)ts.TotalMilliseconds;

        Intent intentAlarm = new Intent(this, typeof(BackgroundReceiver));
        AlarmManager alarmManager = (AlarmManager)GetSystemService(Context.AlarmService);
        int interval = 10000;

        alarmManager.SetRepeating(AlarmType.RtcWakeup, millis, interval, PendingIntent.GetBroadcast(this, 1, intentAlarm, PendingIntentFlags.UpdateCurrent));


     }

PeriodicService.cs

namespace epf.Droid
{
[Service(Enabled = true, Exported = false)]
public class PeriodicService : Service
{
public override IBinder OnBind(Intent intent)
{
return null;
}

    public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
    {
        // From shared code or in your PCL
        CrossLocalNotifications.Current.Show("SERVICE", "SERVICE");

        return StartCommandResult.NotSticky;
    }

}

}

namespace epf.Droid
{
[BroadcastReceiver(Enabled = true, Exported = false)]
public class BackgroundReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{

        PowerManager pm = (PowerManager)context.GetSystemService(Context.PowerService);
        PowerManager.WakeLock wakeLock = pm.NewWakeLock(WakeLockFlags.Partial, "BackgroundReceiver");
        wakeLock.Acquire();

        LocalNotif notification = new LocalNotif();
        CrossLocalNotifications.Current.Show("BACKROUND TEST", "RAPPEL A ZÉB");
        BadgeConter badgenumber = new BadgeConter();
        badgenumber.badgenotification("MARKS", "ABSENCES", "OTHERS", "EVENTS");
        int numberbadge = badgenumber.badge5;
        Badge badge = new Badge(context);
        badge.count(numberbadge);
        Console.WriteLine("JE SUIS DANS SERVICE BADGEDABA TKOUN 3 --> " + numberbadge);
        wakeLock.Release();

        ////Toast.MakeText(context, string.Format("THE TIME IS {0}", DateTime.Now.ToShortTimeString()), ToastLength.Long).Show();
        //Vibrator vibrator = (Vibrator)context.GetSystemService(Context.VibratorService);
        LocalNotif notification1 = new LocalNotif();


        //vibrator.Vibrate(500);
    }
}

}

Thank you

UWP mysterious Command Bar

$
0
0

Hello guys,

I have really strange problem in one of my projects. In my UWP project a mysterious command bar appears above my pivot headers. And I don't know where did it come from and how to remove it. I managed to find it in the Live Visual Tree and when I set its "Visibility" property to "Collapse" it disappear. But I don't know how to make it disappear with C# code.

I'm attaching an image of my problem. I will be very grateful if someone can help me with this!!!

Best Regards,
K. Petkov

Viewing all 204402 articles
Browse latest View live


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