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

checkbox checked change event throws exception

$
0
0

at Xamarin.Forms.Platform.iOS.CheckBoxRendererBase1[T].OnElementCheckedChanged (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\CheckBoxRendererBase.cs:138 at (wrapper delegate-invoke) System.EventHandler1[Xamarin.Forms.CheckedChangedEventArgs].invoke_void_object_TEventArgs(object,Xamarin.Forms.CheckedChangedEventArgs)
at Xamarin.Forms.CheckBox+<>c.<.cctor>b__33_0 (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\CheckBox.cs:15
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311
at Xamarin.Forms.CheckBox.set_IsChecked (System.Boolean value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\CheckBox.cs:33
at Xamarin.Forms.Platform.iOS.CheckBoxRendererBase`1[T].OnControlCheckedChanged (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\CheckBoxRendererBase.cs:133
at Xamarin.Forms.Platform.iOS.FormsCheckBox.OnTouchUpInside (System.Object sender, System.EventArgs e) [0x0000f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\FormsCheckBox.cs:47
at UIKit.UIControlEventProxy.Activated () [0x00004] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIControl.cs:38
--- End of stack trace from previous location where exception was thrown ---

at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at ControladorMovil.iOS.Application.Main (System.String[] args) [0x00001] in /Main.cs:17


Java.Lang.IllegalStateException: FragmentManager is already executing transactions

$
0
0

I want to add a TabbedPage as a child of another TabbedPage, it works fine for me, but when I press the back button the application throws me an exception: Java.Lang.IllegalStateException: 'FragmentManager is already executing transactions'

UIKit.UIWebView still occurs

$
0
0

Hello i am facing the know UIKit.UIWebView with appstore connect. My xamarin forms version is 4.5.0.617. i added the --warn-on-type-ref=UIKit.UIWebView and i can see the warnings below.

2> /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/iordaniskantharidis/Library/Caches/Xamarin/mtbs/builds/PortBook.iOS/01e5572b03e96c72b575d6b4caeea634/obj/iPhone/Debug/response-file.rsp --warn-on-type-ref=UIKit.UIWebView 2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(844,3): warning MT1502: One or more reference(s) to type 'UIKit.UIWebView' already exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' before linking 2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(844,3): warning MT1503: One or more reference(s) to type 'UIKit.UIWebView' still exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' after linking

What i doing wrong?

Shutting down the app and removing from memory

$
0
0

HI

I have tried several methods to quit the application

Including

FinishAffinity();
JavaSystem.Exit(0);

Android.OS.Process.KillProcess(Android.OS.Process.MyPid());

None do the trick .. I still see the app running

Suggestions??

Regards

M,R.

Binding text label on a home page to a timer

$
0
0

We have a really simple app, the idea is the timer will update a label on the home screen depending on different configuration within the mobile app. I have created the binding and can update the homepage from it's self but not from the timer. I think what is missing is a OnChange within the home page to detect if the string has changed.

Display layout code, bind the label to the name "LabelText"

<Label                
Text = "{Binding LabelText, Mode=TwoWay}"
x:Name="MainPageStatusText"
HorizontalOptions="CenterAndExpand"
Grid.Row="2"
Grid.Column="0" 
Grid.ColumnSpan="6"
VerticalOptions="CenterAndExpand"
TextColor="White"
FontSize="Medium"/>

=====
This is the class file to link the text string to the label, I can see it been called from the different places but when it's called from the app.cs it does not work

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms;

namespace Binding_Demo
{
    public class MyClass : INotifyPropertyChanged
    {
        protected void OnPropertyChanged(PropertyChangedEventArgs e)
       { PropertyChanged?.Invoke(this, e); }

       protected void OnPropertyChanged(string propertyName)
       { OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); }

       public event PropertyChangedEventHandler PropertyChanged;

      private string labelText;

      public string LabelText
      {
         get {
            return labelText;
            }


        set
        {
            labelText = value;
            OnPropertyChanged("LabelText");

         }
      }
   } 
}

=====
This is the code inside the homepage, this works and I can see it sending data to the text label

    public static MyClass _myClass = new MyClass();
    public Homepage()
    {

        BindingContext = _myClass;
        _myClass.LabelText = "Inside the home page";

    }

======

This is the App.cs code, we start the timer and then want to set the text on the Homepage label. I can see the class been called, but it does not set the text.

 using System;
 using System.Diagnostics;
 using System.Threading.Tasks;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;

 namespace Binding_Demo
 {
 public partial class App : Application
{
    public static MyClass _myClass = new MyClass();

    public App()
    {
        //InitializeComponent();

        Device.StartTimer(TimeSpan.FromSeconds(10), () =>
        {

            Task.Run(() =>
            {
                Debug.WriteLine("Timer has been triggered");

                // !!!!! This is not setting the text in the label !!!!!
                BindingContext = _myClass;
                _myClass.LabelText = "Inside the timer app";

            });
            return true; //use this to run continuously
        });

        MainPage = new NavigationPage(new MainPage());
    }

    protected override void OnStart()
    {
        //

    }

    protected override void OnSleep()
    {
    }

    protected override void OnResume()
    {
        // force app to mainpage and clear the token  


    }
}

}

I am trying to display icon in my tabbed page but tutorials aint helping, Need Help.

$
0
0

I couldnt find Icon Property inside my toolbar and IconImageSource is not helping,
I have created icons from android assest and had all icon inside mipmap according to resoulation,
{

<?xml version="1.0" encoding="utf-8" ?>

<TabbedPage.ToolbarItems>

</TabbedPage.ToolbarItems>

<Local:PaProfile Title="Profile"
                 IconImageSource="Profile.png"/>


}
Same Problem for Profile PAge Also.

SetFlag not work in android?

$
0
0

The class, property, or method you are attempting to use ('.ctor') is part of IndicatorView; to use it, you must opt-in by calling Forms.SetFlags("IndicatorView_Experimental") before calling Forms.Init().

but in the ManActivity.cs I have set the flag:
`base.OnCreate(savedInstanceState);

        global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
        global::Xamarin.Forms.Forms.SetFlags("IndicatorView_Experimental");
        Xamarin.Essentials.Platform.Init(this, savedInstanceState);
        global::Xamarin.Forms.Forms.Init(this, savedInstanceState);`

it still give an error?

integrate an image editor

$
0
0

Hi,

I want to integrate an image editor (similar to adobe creative SDK or Img.ly SDK) into xamarin.forms app, can anyone please suggest me a cross platform image editor?


NavigationBar.TitleView does not hide menu icon in UWP.

$
0
0

This is my NavBar title view:

<NavigationPage.TitleView>
        <StackLayout Margin="0" Padding="6,0,6,0" BackgroundColor="Yellow"
                     Orientation="Horizontal">
            <Button VerticalOptions="Center" ImageSource="backArrow_icon.png"
                    HorizontalOptions="Start"
                    HeightRequest="30" MinimumHeightRequest="30"
                    WidthRequest="30" MinimumWidthRequest="30"/>
            <Label VerticalOptions="Center"
                   HorizontalOptions="StartAndExpand"
                   Text="{x:Static resources:AppResources.Share}"/>
            <Button VerticalOptions="Center" ImageSource="Check_Icon.png"
                    HorizontalOptions="Start"
                    HeightRequest="30" MinimumHeightRequest="30"
                    WidthRequest="30" MinimumWidthRequest="30"/>
        </StackLayout>
    </NavigationPage.TitleView>

How do I make the menu icon marked in red, invisible? or get rid of it?

UITesting - How to check if the text visible is written in bold / italics?

$
0
0

Hi I need to check if the text visible in the android application is written in bold / italics. I found information about checking the font size or color, but I don't see information about checking other text preferences. Is it also possible to check the alignment of the text (is it centered, left / right alignment) ??

Netflix style home page

$
0
0

Hi I'm extremely new to xamarin forms and I tremendously suck at coding layouts. I'm trying to figure out for hours now how to create a content page with some scrollviews that mimics something like this:

Any chance that you guys have samples or snippets to share for something like it?

Checksum mismatch for dex base.apk

$
0
0

Hi, when i try to start my app is showing me the following Output and the application never starts

Loaded assembly: Newtonsoft.Json.dll [External]
Loaded assembly: System.Net.Http.Extensions.dll [External]
Loaded assembly: System.Net.Http.Primitives.dll [External]
10-28 18:50:34.905 I/zygote (25825): Not late-enabling -Xcheck:jni (already on)
10-28 18:50:34.955 W/zygote (25825): Unexpected CPU variant for X86 using defaults: x86
10-28 18:50:35.089 W/zygote (25825): Attempt to remove non-JNI local reference, dumping threadLoaded assembly: Xamarin.Android.Arch.Core.Common.dll [External]

10-28 18:50:35.089 W/monodroid(25825): Creating public update directory: /data/user/0/com.companyname.matriculav4/files/.__override__
10-28 18:50:35.089 W/monodroid(25825): Using override path: /data/user/0/com.companyname.matriculav4/files/.override
10-28 18:50:35.090 W/monodroid(25825): Using runtime path: /data/app/Mono.Android.DebugRuntime-UW27OQR6UlSFB5vHXyH-8Q==/lib/x86
10-28 18:50:35.090 W/monodroid(25825): checking directory: /data/user/0/com.companyname.matriculav4/files/.__override__/lib
10-28 18:50:35.090 W/monodroid(25825): directory does not exist: /data/user/0/com.companyname.matriculav4/files/.__override__/lib
10-28 18:50:35.090 W/monodroid(25825): checking directory: /storage/emulated/0/Android/data/com.companyname.matriculav4/files/.__override__/lib
10-28 18:50:35.090 W/monodroid(25825): directory does not exist: /storage/emulated/0/Android/data/com.companyname.matriculav4/files/.__override__/lib

10-28 18:50:39.028 W/OpenGLRenderer(25825): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
10-28 18:50:39.028 D/OpenGLRenderer(25825): Swap behavior 0
10-28 18:50:39.115 D/EGL_emulation(25825): eglCreateContext: 0x9b090860: maj 3 min 0 rcv 3
10-28 18:50:39.186 D/EGL_emulation(25825): eglMakeCurrent: 0x9b090860: ver 3 0 (tinfo 0x862cbbd0)
10-28 18:50:39.189 E/eglCodecCommon(25825): glUtilsParamSize: unknow param 0x00008cdf
10-28 18:50:39.190 E/eglCodecCommon(25825): glUtilsParamSize: unknow param 0x00008cdf
10-28 18:50:39.190 E/eglCodecCommon(25825): glUtilsParamSize: unknow param 0x00008824
10-28 18:50:39.191 E/eglCodecCommon(25825): glUtilsParamSize: unknow param 0x00008824
10-28 18:50:39.299 D/EGL_emulation(25825): eglMakeCurrent: 0x9b090860: ver 3 0 (tinfo 0x862cbbd0)
10-28 18:50:39.463 D/EGL_emulation(25825): eglMakeCurrent: 0x9b090860: ver 3 0 (tinfo 0x862cbbd0)
10-28 18:50:39.545 D/EGL_emulation(25825): eglMakeCurrent: 0x9b090860: ver 3 0 (tinfo 0x862cbbd0)
10-28 18:50:39.593 D/EGL_emulation(25825): eglMakeCurrent: 0x9b090860: ver 3 0 (tinfo 0x862cbbd0)
10-28 18:50:39.598 W/View (25825): dispatchProvideAutofillStructure(): not laid out, ignoring
10-28 18:50:39.604 I/AssistStructure(25825): Flattened final assist data: 2564 bytes, containing 1 windows, 9 views
10-28 18:51:06.222 I/zygote (25825): Do partial code cache collection, code=30KB, data=25KB
10-28 18:51:06.222 I/zygote (25825): After code cache collection, code=30KB, data=25KB
10-28 18:51:06.223 I/zygote (25825): Increasing code cache capacity to 128KB
10-28 18:51:20.057 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:51:20.057 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:51:50.058 I/zygote (25825): Do partial code cache collection, code=61KB, data=47KB
10-28 18:51:50.058 I/zygote (25825): After code cache collection, code=61KB, data=47KB
10-28 18:51:50.058 I/zygote (25825): Increasing code cache capacity to 256KB
10-28 18:52:00.061 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:52:00.061 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:52:40.063 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:53:20.066 I/chatty (25825): uid=10084(u0_a84) Profile Saver identical 2 lines
10-28 18:53:20.067 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:54:00.070 W/zygote (25825): Checksum mismatch for dex base.apk
10-28 18:54:00.070 W/zygote (25825): Checksum mismatch for dex base.apk

I would be great if you can help me, all of my process and methods are running in threads and are async

How to Update label text from another class?

$
0
0

I know its a silly question but I am new in Xamarin.forms
I want to Update label text from another class in xamarin.forms. please guide me with a example. Thanks

An error occurred trying to load the page. Index was outside the bounds of the array.

$
0
0

I'm building a mobile application using Xamarin Form.When I tried to open AndroidManifest.xml in Visual Studio 2019 Community by Right Click -> Xamarin.Android Project -> Properties -> Android Manifest , I'm getting following error,

"An error occurred trying to load the page. Index was outside the bounds of the array."

But the application is working perfectly, just does not show the Android Manifest in properties.

I have try recreate the Android Manifest again and replace the old Manifest in Xamarin.Android but it still does not resolve the problem.

I have delete bin and obj file of Xamarin.Android but still problem persist.

I have create another new Xamarin Form and try to read the AndroidManifest.xml from properties and I can read it. But It just does not show in Xamarin Form my project

1. I have check the Xamarin Log in Visual studio by going too Help -> Xamarin -> Open Logs . It do show some error log.

Can anyone help me regrading this problem. I have attached the Xamarin Log regarding the problem and include the Android Manifest

Android Manifest

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0" package="com.companyname.VMS.ResidentMobileApp" android:installLocation="preferExternal"> <application> <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data> </provider> </application> <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="26" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <application android:label="VMS.ResidentMobileApp.Android"></application> </manifest>

Dynamic Form data Binding to carousel view ItemSource property

$
0
0

Hello All,
I need to display dynamic forms in the carousel view. The form gets generated based on the JSON response from API and I have to show that particular form in the carousel view.

I am able to integrate my content view with some static content to the carousel view using this "CardsView(2.6.1) "package.

However, I am stuck at the data binding part because my content view is actually a dynamic form on which the data gets populated based on the JSON response from API. So, how can I create and bind the dynamic model to ItemSource Property of the carousel view?
Thanks in advance.


How to Refresh CollectionView ItemTemplate

$
0
0

xaml:

   <ContentPage.Resources>
        <ResourceDictionary>
            <Style x:Key="darkerButton" TargetType="Button">
                <Setter Property="BackgroundColor" Value="#ddd"/>
                <Setter Property="TextColor" Value="Black" />
                <Setter Property="BorderColor" Value="Blue"/>
                <Setter Property="FontSize" Value="Default" />
                <Setter Property="CornerRadius" Value="10" />
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>
    <ContentPage.Content>
        <StackLayout>
            <Frame Style="{StaticResource FrameStyle}">
                <StackLayout >
                    <Label x:Name="ApointingPersonName"  Text="" Style="{StaticResource LableHeading}"/>
                    <Label x:Name="ApointingPersonTag"  Text="" Style="{StaticResource LableSubHeading}"/>
                </StackLayout>
            </Frame>
            <!--<StackLayout HeightRequest="90" BackgroundColor="#E8AD00">-->
            <Frame OutlineColor="#EFEFEF" HeightRequest="78" Margin="1" Padding="3">
                <CollectionView ItemsSource="{Binding dayList}">
                    <CollectionView.ItemsLayout>
                        <GridItemsLayout Orientation="Horizontal"  HorizontalItemSpacing="5" VerticalItemSpacing="1" />
                    </CollectionView.ItemsLayout>
                    <CollectionView.ItemTemplate>
                        <DataTemplate x:DataType="models:DayList">
                            <Button x:Name="DayButton" Text="{Binding BindDayDate }"  MinimumHeightRequest="25" Clicked="DayButton_Clicked" Style="{StaticResource darkerButton}"/>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
            </Frame>
            <BoxView HeightRequest="1" BackgroundColor="MediumTurquoise"/>
            <Frame Style="{StaticResource FrameStyle}">
                <StackLayout>
                    <StackLayout>
                        <Label x:Name="SelectedDayHead" Text="" Style="{StaticResource LableHeading}" HorizontalTextAlignment="Center" LineBreakMode="HeadTruncation"/>
                    </StackLayout>
                    <ContentView x:Name="SlotNOView" IsVisible="False" >
                        <Label x:Name="SlotNOAvailable" Text="" FontSize="Medium" VerticalTextAlignment="Center" FontAttributes="Bold" TextColor="Red"/>
                    </ContentView>
                    <RefreshView x:Name="SlotContentView"  IsVisible="False">
                        <CollectionView x:Name="SlotListView">
                            <CollectionView.ItemsLayout>
                                <GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="5" VerticalItemSpacing="5" SnapPointsType="Mandatory"/>
                            </CollectionView.ItemsLayout>
                            <CollectionView.ItemTemplate>
                                <DataTemplate x:DataType="models:SlotListData">
                                    <StackLayout>
                                        <Button Text="{Binding slot}" Clicked="SelectedSlot_Clicked"/>
                                    </StackLayout>
                                </DataTemplate>
                            </CollectionView.ItemTemplate>
                        </CollectionView>
                    </RefreshView>
                </StackLayout>
            </Frame>
        </StackLayout>
    </ContentPage.Content>

xaml.cs:

namespace EZQueue.Views.BookAppointment
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class TimeSlotList : ContentPage
    {
        VMTimeSlotList VMModel;
        public ServiceSlot serviceSlot { get; set; }
        public WorkTemplate workTemplate { get; set; }
        public ApointingPerson apointingPerson { get; set; }
        DayList dayList { get; set; }

        public TimeSlotList(ServiceSlot InputServiceSlot,ApointingPerson InputapointingPerson)
        {
            InitializeComponent();
            apointingPerson = InputapointingPerson;
            ApointingPersonName.Text = apointingPerson.Name;
            ApointingPersonTag.Text = InputServiceSlot.TagList;
            serviceSlot = InputServiceSlot;
            VMModel = new VMTimeSlotList(serviceSlot);
            BindingContext = VMModel;
            GetTimeSlotList();
            GetWorkTemplateList();
            GetCancelServiceList();
        }

        async void GetTimeSlotList()
        {
            await VMModel.RefreshListAsync();
        }

        async void GetWorkTemplateList()
        {
            await VMModel.RefreshWorkTemplateAsync();
        }

        async void GetCancelServiceList()
        {
            await VMModel.RefreshGetCancelServiceAsync();
        }

        async void GetSlotListData()
        {
            await VMModel.RefreshGetSlotListDataAsync();
            SlotListView.ItemsSource = VMModel.SlotListDataGroup;
            SlotContentView.IsVisible = true;
        }
        private void DayButton_Clicked(object sender, EventArgs e)
        {
            SlotContentView.IsVisible = false;
            SlotNOView.IsVisible = false;
            Button btn = (Button)sender;
            dayList=(DayList)btn.BindingContext;
            VMTimeSlotList.SelectedDate = DateTime.Parse(dayList.date);
            SelectedDayHead.Text = dayList.dayString + ", " + dayList.date;
            checkSoltAvailableORNot();
        }

        public void checkSoltAvailableORNot()
        {
            switch (dayList.dayString)
            {
                case
                                "Monday":
                    if (VMModel.workTemplate.Monday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;

                case
                              "Tuesday":
                    if (VMModel.workTemplate.Tuesday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;

                case
                            "Wednesday":
                    if (VMModel.workTemplate.Wednesday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;

                case
                            "Thursday":
                    if (VMModel.workTemplate.Thursday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;

                case
                            "Friday":
                    if (VMModel.workTemplate.Friday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;

                case
                            "Saturday":
                    if (VMModel.workTemplate.Saturday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;

                case
                            "Sunday":
                    if (VMModel.workTemplate.Sunday == true)
                    {
                        GetSlotListData();
                    }
                    else
                    {
                        slotNOAvailable();
                    }
                    break;
            }
        }

        public void slotNOAvailable()
        {
            SlotNOAvailable.Text = "Slot NOT Available...!!";
            SlotNOView.IsVisible = true;
        }


        private void SelectedSlot_Clicked(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            SlotListData SelectedTime = (SlotListData)btn.BindingContext;
            Navigation.PushAsync(new CustomerDetail(SelectedTime,VMModel.workTemplate,apointingPerson,dayList) { Title = "Patient Details" });
        }
    }
}

vMmodel:
namespace EZQueue.ViewModels
{
    public class CancelStartEnd
    {
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
    }

    public class VMTimeSlotList : INotifyPropertyChanged
    {
        public ObservableCollection<DayList> dayListAll { get; set; } = new ObservableCollection<DayList>();
        public ObservableCollection<DayList> dayList { get; set; } = new ObservableCollection<DayList>();

        public ObservableCollection<CancelService> cancelServiceAll { get; set; } = new ObservableCollection<CancelService>();
        public ObservableCollection<CancelService> cancelService { get; set; } = new ObservableCollection<CancelService>();
        public CancelStartEnd cancelStartEnd { get; set; } = new CancelStartEnd();

        public WorkTemplate workTemplateAll { get; set; } = new WorkTemplate();
        public WorkTemplate workTemplate { get; set; } = new WorkTemplate();

        public List<SlotListData> SlotListDataGroupAll { get; set; } = new List<SlotListData>();
        public List<SlotListData> SlotListDataGroup { get; set; } = new List<SlotListData>();

        DateTime TodayDate = DateTime.Today.AddDays(0);
        public ObservableCollection<Appointment> appointment { get; set; } = new ObservableCollection<Appointment>();

        public int serviceSlotID { get; set; }

        public static DateTime SelectedDate { get; set; }
        public List<string> BookedAppointmentTime { get; set; } = new List<string>();

        public VMTimeSlotList(ServiceSlot InputServiceSlot)
        {
            serviceSlotID = InputServiceSlot.ServiceSlotID;
        }

        private void UpdatelistDayList()
        {
            dayList.Clear();
            foreach (var item in dayListAll)
            {
                dayList.Add(item);
            }

            UpdateUserPromt();
        }

        public async Task RefreshListAsync()
        {
            IsRefreshing = true;
            try
            {
                dayListAll = await WebManager.GetDayListAsync(TodayDate, serviceSlotID);
                UpdatelistDayList();
            }
            catch { }
            IsRefreshing = false;
        }

        private void UpdateWorkTemplate()
        {
            workTemplate = workTemplateAll;
            UpdateUserPromt();
        }

        private void UpdateSlotListData()
        {
            SlotListDataGroup.Clear();
            foreach (var item in SlotListDataGroupAll)
            {
                SlotListDataGroup.Add(item);
            }
            UpdateUserPromt();
        }

        public async Task RefreshWorkTemplateAsync()
        {
            IsRefreshing = true;
            try
            {
                workTemplateAll = await WebManager.GetWorkTemplateAsync(serviceSlotID);
                UpdateWorkTemplate();
            }
            catch {}
            IsRefreshing = false;
        }

        public async Task RefreshGetSlotListDataAsync()
        {
            IsRefreshing = true;
            try
            {
                await getCancelServiceAsync();
                await getappointmentAsync();
                SlotListDataGroupAll.Clear();
                DateTime StartTime = workTemplate.StartTime;
                DateTime EndTime = workTemplate.EndTime;
                TimeSpan span = EndTime.Subtract(StartTime);
                int TotalMinutes = (int)span.TotalMinutes;
                int TimeSpan = (int)workTemplate.SlotGranularity.TotalMinutes;
                int count = TotalMinutes / TimeSpan;
                DateTime dateTime = StartTime;

                DateTime t2 = Convert.ToDateTime((cancelStartEnd.StartTime.ToShortTimeString()));
                DateTime t3 = Convert.ToDateTime((cancelStartEnd.EndTime.ToShortTimeString()));
                for (int j = 0; j < count; j++)
                {
                    DateTime t1 = Convert.ToDateTime((dateTime.ToShortTimeString()));
                    int v1 = DateTime.Compare(t1, t2);
                    int v2 = DateTime.Compare(t1, t3);

                    /* if t1 is less than t2 then result is -1 
                     *   if t1 equals t2 then result is 0 
                     *   if t1 is greater than t2 then result 1 
                     */

                    if (!(BookedAppointmentTime.Contains(dateTime.ToShortTimeString()))&&((v1>=0) & v2>=0 )||(v1<0 & v2<0)&&!(BookedAppointmentTime.Contains(dateTime.ToShortTimeString())))
                    {
                        SlotListDataGroupAll.Add(new SlotListData() { slot = dateTime.ToShortTimeString() });
                    }
                    dateTime = dateTime.AddMinutes(TimeSpan);
                }
                UpdateSlotListData();
            }
            catch(Exception e) { }
            IsRefreshing = false;
        }

        public async Task RefreshGetCancelServiceAsync()
        {
            cancelServiceAll = await WebManager.GetCancelServiceAsync(workTemplate.ServiceSlotID);
        }

        private async Task getCancelServiceAsync()
        {
            foreach (var item in cancelServiceAll)
            { 
                if(SelectedDate.ToShortDateString()==item.Date.ToShortDateString())
                {
                    cancelStartEnd=new CancelStartEnd() { StartTime = item.StartTime, EndTime = item.EndTime };
                }
            }
        }

        private async Task getappointmentAsync()
        {
            string ServiceSlotIDSelectedDate = workTemplate.ServiceSlotID.ToString() + "," + SelectedDate.ToString();
            appointment = await WebManager.GetAppointmentAsync(ServiceSlotIDSelectedDate);
            BookedAppointmentTime.Clear();
            foreach (var item in appointment)
            {
                BookedAppointmentTime.Add(item.StartTime.ToShortTimeString());
            }
        }
        public void UpdateUserPromt()
        {
            if (0 == SlotListDataGroupAll.Count)
            {
                if (false == NetworkInterface.GetIsNetworkAvailable())
                {
                    ShowMessage(EZQResource.SMInternateNotAvailable, true);
                }
            }
        }

        public void ShowMessage(string Message, bool bIsError = false)
        {
            UserPromt = Message;
            if (bIsError)
            {
                UserPromtColor = Color.Red;
            }
            else
            {
                UserPromtColor = Color.Black;
            }
        }

        public string m_UserPromt = "";
        public string UserPromt
        {
            get
            {
                return m_UserPromt;
            }
            set
            {
                if (m_UserPromt != value)
                {
                    m_UserPromt = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public Color m_UserPromtColor;
        public Color UserPromtColor
        {
            get
            {
                return m_UserPromtColor;
            }
            set
            {
                if (m_UserPromtColor != value)
                {
                    m_UserPromtColor = value;
                    NotifyPropertyChanged();
                }
            }
        }

        private bool m_isRefreshing = false;
        public bool IsRefreshing
        {
            get { return m_isRefreshing; }
            set
            {
                if (m_isRefreshing != value)
                {
                    m_isRefreshing = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        void NotifyPropertyChanged([CallerMemberName] string name = "")
        {
            if (name != "")
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
            }
        }
    }
}

data ~~~~
DayList:
  public class DayList
    {
        public int serviceSlotID { get; set; }
        public string dayString { get; set; }
        public string date { get; set; }
        public string BindDayDate {
            get
            {
                return string.Format("{0} \n{1}", dayString,DateTime.Parse(date).ToShortDateString());
            }
        }
    }

classWorkTemplate:~~~~

 public class WorkTemplate
    {
        public int WorkTemplateID { get; set; }
        public string Name { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public TimeSpan SlotGranularity { get; set; }

        public bool Monday { get; set; }
        public bool Tuesday { get; set; }
        public bool Wednesday { get; set; }
        public bool Thursday { get; set; }
        public bool Friday { get; set; }
        public bool Saturday { get; set; }
        public bool Sunday { get; set; }

        public int ServiceSlotID { get; set; }
    }

VideoLink:
https://youtu.be/kpKBlJ91wyo

details page content displays correctly but listview page items are present but blank.

$
0
0

The list shows correct # of items but the items are empty however the details page shows the correct content. The xaml and code behind for both
are attached. this code is vs2019 pro based in mobile app with shared lib and and android, ios, uwp and web projects.

get the imei number of the device

$
0
0

hi,
I want find the imei number of the device in xamarin forms .I have tryed the following solution but nothing is happen

This is serviceImei which implement the interface IServiceImei containg one function

And Mianpage having the following code

when i exceute this nothing is happen.
plz provide some suggestion.

Data after the Camera Capture always return Null

$
0
0

Good Day All

i am opening an Intent for Camera and I take a photo and when i save i want to get the saved file . i open my intent like this

                           Intent takePicture = new Intent(MediaStore.ActionImageCapture);
                           var  mPhotoUri = this.Activity.ContentResolver.Insert(MediaStore.Images.Media.ExternalContentUri, new ContentValues()); 
                            takePicture.PutExtra(MediaStore.ExtraOutput, mPhotoUri); 
                            StartActivityForResult(takePicture, 0); 

and in the Activity results i do this

       public override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            if (requestCode == 0)
            {
                Uri u = null;
                if (hasImageCaptureBug())
                {
                    Java.IO.File fi = new Java.IO.File("/sdcard/tmp");  
                   u = Uri.Parse(Android.Provider.MediaStore.Images.Media.InsertImage(this.Activity.ContentResolver, fi.AbsolutePath, null, null)); 
                }
                else
                {
               **     u = data.Data; **
                }
      }

The intent gives me null

     u = data.Data;  

Thanks

Saving Picker SelectedItem to a table Binding

$
0
0

Hi! I am trying to save the selected item from the picker to a string which i can save in my sqlite table. I have used the MVVM and I dont know how to go any further. Here is my view model:

` public List Ingredients { get; set; }
public OilPickerViewModel()
{
Ingredients = GetIngredients().OrderBy(t => t.Value).ToList();
}

    public List<Ingredient> GetIngredients()
    {
        var ingredients = new List<Ingredient>()
        {
            new Ingredient(){Key = 1, Value = "Lavanda"},
            new Ingredient(){Key = 2, Value = "Peppermint"}
          };
        return ingredients;
    }
    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged([CallerMemberName] string name = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
    }
    private Ingredient _selectedIngredient1 { get; set; }
    public Ingredient SelectedIngredient1
    {
        get { return _selectedIngredient1; }
        set
        {
            if(_selectedIngredient1 != value)
            {
                _selectedIngredient1 = value;
                MyIngredient1 = _selectedIngredient1.Value;
            }
        }
    }
    private string myIngredient1 { get; set; }
    public string MyIngredient1
    {
        get { return myIngredient1; }
        set
        {
            if( myIngredient1 != value)
            {
                myIngredient1 = value;
                OnPropertyChanged();
            }
        }
    }`

Here it is what I have written in my view:
<Picker x:Name="ulei1Picker" Title="Alege primul ingredient" ItemsSource="{Binding Ingredients}" ItemDisplayBinding="{Binding Value}" SelectedItem="{Binding SelectedIngredient1}"/> <Button Text="Salveaza" x:Name="saveButton" Clicked="SaveButton_Clicked"/>

and my code-behind:

void SaveButton_Clicked(object sender, EventArgs e) { if ( ulei1Picker.SelectedItem == null ) { DisplayAlert("...");} else { Blend blend = new Blend() { Ulei1 = ulei1Picker.SelectedItem?.ToString() }}
I need the selected value from the picker to be saved to the Ulei1 string from the table but i just cant. How do I make this work?>!

Viewing all 204402 articles
Browse latest View live


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