protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window?.SetSoftInputMode(SoftInput.AdjustResize);

                Methods.App.FullScreenApp(this, true);

                // Create your application here
                SetContentView(Resource.Layout.SelectRegisterLayout);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Пример #2
0
        public static async Task GetSettings_Api(Activity context)
        {
            if (Methods.CheckConnectivity())
            {
                (int apiStatus, var respond) = await Current.GetOptionsAsync();

                if (apiStatus == 200)
                {
                    if (respond is OptionsObject result)
                    {
                        ListUtils.SettingsSiteList = null;
                        ListUtils.SettingsSiteList = result.DataOptions;

                        AppSettings.OneSignalAppId = result.DataOptions.AndroidMPushId;
                        OneSignalNotification.RegisterNotificationDevice();

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                        dbDatabase.InsertOrUpdateSettings(result.DataOptions);
                        dbDatabase.Dispose();
                    }
                    else
                    {
                        Methods.DisplayReportResult(context, respond);
                    }
                }
            }
        }
Пример #3
0
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();
                //A great place to initialize Xamarin.Insights and Dependency Services!
                RegisterActivityLifecycleCallbacks(this);

                instance = this;

                Settings st = new Settings();

                Client.WebsiteUrl = st.WebsiteUrl;
                Current.CurrentInstance.ServerKey = st.ServerKey;
                Current.CurrentInstance.SetWebsiteURL(st.WebsiteUrl, st.ServerKey);

                //Bypass Web Errors
                //======================================
                if (Settings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    var client = new HttpClient(new AndroidClientHandler());
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 |
                                                            SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
                }

                if (Settings.TurnTrustFailureOn_WebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback +=
                        (sender, cert, chain, sslPolicyErrors) => true;
                    var b = new AesCryptoServiceProvider();
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                // Check Created My Folder Or Not
                //======================================
                IMethods.IPath.Chack_MyFolder();
                //======================================

                //Init Settings
                WowTime_Main_Settings.Init();

                //Change the Lang
                WowTime_Main_Settings.SetApplicationLang(this, Settings.Lang);
                //======================================

                //App restarted after crash
                //======================================
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #5
0
 //Notification >> Popup
 private void NotifcationPopupPrefOnPreferenceChange(object sender, Preference.PreferenceChangeEventArgs eventArgs)
 {
     try
     {
         if (eventArgs.Handled)
         {
             var etp   = (SwitchPreferenceCompat)sender;
             var value = eventArgs.NewValue.ToString();
             etp.Checked = bool.Parse(value);
             if (etp.Checked)
             {
                 UserDetails.NotificationPopup = true;
                 OneSignalNotification.RegisterNotificationDevice();
             }
             else
             {
                 UserDetails.NotificationPopup = false;
                 OneSignalNotification.Un_RegisterNotificationDevice();
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Пример #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);
                Window?.SetSoftInputMode(SoftInput.AdjustResize);

                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Register_Layout);

                //Get Value
                InitComponent();
                LoadConfigSettings();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Пример #7
0
        public static async Task GetSettings_Api(Activity activity)
        {
            if (Methods.CheckConnectivity())
            {
                await GetLanguages_Api(activity);

                var lang = ListUtils.LanguagesSiteList.FirstOrDefault(languages => languages.LanguagesName.ToLower() == UserDetails.LangName)?.LanguagesName ?? "";//english

                (int apiStatus, var respond) = await Current.GetOptionsAsync(lang);

                if (apiStatus == 200)
                {
                    if (respond is GetOptionsObject result)
                    {
                        if (result.Data != null)
                        {
                            AppSettings.OneSignalAppId = result.Data.PushId;
                            OneSignalNotification.RegisterNotificationDevice();

                            ListUtils.SettingsSiteList.Clear();
                            ListUtils.SettingsSiteList.Add(result.Data);

                            SqLiteDatabase dbDatabase = new SqLiteDatabase();
                            dbDatabase.InsertOrUpdateSettings(result.Data);
                            dbDatabase.Dispose();
                        }
                    }
                }
                //else Methods.DisplayReportResult(activity, respond);
            }
        }
Пример #8
0
 //Notification >> Popup
 private void NotificationPopupPref_OnPreferenceChange(object sender,
                                                       Preference.PreferenceChangeEventArgs eventArgs)
 {
     try
     {
         if (eventArgs.Handled)
         {
             var etp   = (SwitchPreference)sender;
             var value = eventArgs.NewValue.ToString();
             etp.Checked = bool.Parse(value);
             if (etp.Checked)
             {
                 OneSignalNotification.RegisterNotificationDevice();
             }
             else
             {
                 OneSignalNotification.Un_RegisterNotificationDevice();
             }
         }
     }
     catch (Exception e)
     {
         Crashes.TrackError(e);
     }
 }
        //Notification >> Popup
        private void NotifcationPopupPrefOnPreferenceChange(object sender, Preference.PreferenceChangeEventArgs eventArgs)
        {
            try
            {
                switch (eventArgs.Handled)
                {
                case true:
                {
                    var etp   = (SwitchPreferenceCompat)sender;
                    var value = eventArgs.NewValue.ToString();
                    etp.Checked = bool.Parse(value);
                    switch (etp.Checked)
                    {
                    case true:
                        UserDetails.NotificationPopup = true;
                        OneSignalNotification.RegisterNotificationDevice();
                        break;

                    default:
                        UserDetails.NotificationPopup = false;
                        OneSignalNotification.Un_RegisterNotificationDevice();
                        break;
                    }

                    break;
                }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Пример #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                View mContentView = Window.DecorView;
                var  uiOptions    = (int)mContentView.SystemUiVisibility;
                var  newUiOptions = uiOptions;

                newUiOptions |= (int)SystemUiFlags.Fullscreen;
                newUiOptions |= (int)SystemUiFlags.HideNavigation;
                mContentView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

                Window.AddFlags(WindowManagerFlags.Fullscreen);

                base.OnCreate(savedInstanceState);

                // Create your application here
                SetContentView(Resource.Layout.RegisterLayout);

                //Get Value And Set Toolbar
                InitComponent();
                InitToolbar();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                // Create your application here
                SetContentView(Resource.Layout.FirstLayout);

                //Get Value
                InitComponent();

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                if (Methods.CheckConnectivity())
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => ApiRequest.GetSettings_Api(this)
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #12
0
        public override void OnCreate()
        {
            try
            {
                Instance = this;

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                //Bypass Web Errors
                //======================================
                if (AppSettings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    var client = new HttpClient(new AndroidClientHandler());
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls13;
                    Console.WriteLine(client);
                }

                if (AppSettings.TurnTrustFailureOnWebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                    var b = new AesCryptoServiceProvider();
                    Console.WriteLine(b);
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                // Check Created My Folder Or Not
                //======================================
                Methods.Path.Chack_MyFolder();
                //======================================

                //Init Settings
                MainSettings.Init();

                ClassMapper.SetMappers();

                //App restarted after crash
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
                AppDomain.CurrentDomain.UnhandledException  += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException       += TaskSchedulerOnUnobservedTaskException;

                AppCompatDelegate.CompatVectorFromResourcesEnabled = true;

                FirebaseApp.InitializeApp(this);

                Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver();
                ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Пример #13
0
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();

                Instance = this;

                //A great place to initialize Xamarin.Insights and Dependency Services!
                RegisterActivityLifecycleCallbacks(this);

                Instance = this;

                Client client = new Client(AppSettings.Cert);
                Console.WriteLine(client);

                if (AppSettings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    HttpClient clientHttp = new HttpClient(new Xamarin.Android.Net.AndroidClientHandler());
                    Console.WriteLine(clientHttp);
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13 | SecurityProtocolType.Ssl3;
                }

                if (AppSettings.TurnTrustFailureOnWebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                    System.Security.Cryptography.AesCryptoServiceProvider b = new System.Security.Cryptography.AesCryptoServiceProvider();
                    Console.WriteLine(b);
                }

                //OneSignal Notification
                //======================================
                OneSignalNotification.RegisterNotificationDevice();

                //Init Settings
                SharedPref.Init();

                ClassMapper.SetMappers();

                //App restarted after crash
                AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser;
                AppDomain.CurrentDomain.UnhandledException  += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException       += TaskSchedulerOnUnobservedTaskException;

                FirebaseApp.InitializeApp(this);
                Methods.Path.Chack_MyFolder();

                Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver();
                ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Пример #14
0
        public static async Task <GetSiteSettingsObject.Config> GetSettings_Api(Activity context)
        {
            if (Methods.CheckConnectivity())
            {
                await SetLangUserAsync(context).ConfigureAwait(false);

                (var apiStatus, dynamic respond) = await Current.GetSettings();

                if (apiStatus != 200 || !(respond is GetSiteSettingsObject result) || result.config == null)
                {
                    return(Methods.DisplayReportResult(context, respond));
                }

                ListUtils.SettingsSiteList = result.config;

                AppSettings.OneSignalAppId = result.config.AndroidMPushId;
                OneSignalNotification.RegisterNotificationDevice();

                //Products Categories
                var listProducts = result.config.ProductsCategories.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = cat.Value,
                    CategoriesColor = "#ffffff"
                }).ToList();

                ListUtils.ListCategoriesProducts.Clear();
                ListUtils.ListCategoriesProducts = new ObservableCollection <Classes.Categories>(listProducts);

                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                dbDatabase.InsertOrUpdateSettings(result.config);
                dbDatabase.Dispose();

                try
                {
                    if (ListUtils.ListCategoriesProducts.Count == 0)
                    {
                        Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "List Categories Products Not Found, Please check api get_site_settings ", "Close");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                return(result.config);
            }
            else
            {
                Toast.MakeText(context, context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                return(null);
            }
        }
Пример #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                //Set Full screen
                Methods.App.FullScreenApp(this, true);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                    LoadConfigSettings();
                }
                else
                {
                    if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted)
                    {
                        LoadConfigSettings();
                    }
                    else
                    {
                        RequestPermissions(new[]
                        {
                            Manifest.Permission.ReadExternalStorage,
                            Manifest.Permission.WriteExternalStorage
                        }, 101);
                    }
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //Set Full screen
            SetFullScreenWindow();

            Instance = this;

            if (string.IsNullOrEmpty(UserDetails.DeviceId))
            {
                OneSignalNotification.RegisterNotificationDevice();
            }
        }
 //Notifcation >> Popup
 private void Notifcation_Popup_Pref_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     if (e.Handled)
     {
         SwitchPreference etp = (SwitchPreference)sender;
         var value            = e.NewValue.ToString();
         etp.Checked = Boolean.Parse(value);
         if (etp.Checked)
         {
             OneSignalNotification.RegisterNotificationDevice();
         }
         else
         {
             OneSignalNotification.Un_RegisterNotificationDevice();
         }
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window?.SetSoftInputMode(SoftInput.AdjustResize);

                Methods.App.FullScreenApp(this, true);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                if ((int)Build.VERSION.SdkInt is < 23)
                {
                    LoadConfigSettings();
                    CheckCrossAppAuthentication();
                }
                else
                {
                    if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted &&
                        CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted)
                    {
                        LoadConfigSettings();
                        CheckCrossAppAuthentication();
                    }
                    else
                    {
                        RequestPermissions(new[]
                        {
                            Manifest.Permission.ReadExternalStorage,
                            Manifest.Permission.WriteExternalStorage
                        }, 101);
                    }
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
Пример #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Methods.App.FullScreenApp(this);

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);

                SetContentView(Resource.Layout.First_Activity_Layout);

                LoginButton    = FindViewById <Button>(Resource.Id.LoginButton);
                RegisterButton = FindViewById <Button>(Resource.Id.RegisterButton);
                SkipButton     = FindViewById <Button>(Resource.Id.SkipButton);
                VideoViewer    = FindViewById <VideoView>(Resource.Id.videoView);

                Android.Net.Uri uri = Android.Net.Uri.Parse("android.resource://" + PackageName + "/" + Resource.Raw.MainVideo);
                VideoViewer.SetVideoURI(uri);
                VideoViewer.Start();

                if (!AppSettings.ShowSkipButton)
                {
                    SkipButton.Visibility = ViewStates.Gone;
                }

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                    () => ApiRequest.GetSettings_Api(this)
                });
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Пример #20
0
        private void InitComponent()
        {
            try
            {
                ImageBackgroundGradation = FindViewById <ImageView>(Resource.Id.backgroundGradation);
                BtnLogin      = FindViewById <Button>(Resource.Id.LoginButton);
                BtnRegister   = FindViewById <Button>(Resource.Id.RegisterButton);
                TxtFirstTitle = FindViewById <TextView>(Resource.Id.firstTitle);
                BtnSkip       = FindViewById <Button>(Resource.Id.SkipButton);

                var display = WindowManager.DefaultDisplay;
                var size    = new Point();
                display.GetSize(size);
                int   width  = size.X;
                int   height = size.Y;
                int[] color  = { Color.ParseColor("#3033c6"), Color.ParseColor("#fb0049") };
                var(gradient, bitmap) = ColorUtils.GetGradientDrawable(this, color, width, height);
                if (bitmap != null)
                {
                    ImageBackgroundGradation.SetImageBitmap(bitmap);
                }

                Console.WriteLine(gradient);
                TxtFirstTitle.Text = GetText(Resource.String.Lbl_FirstSubTitle);

                if (!AppSettings.ShowSkipButton)
                {
                    BtnSkip.Visibility = ViewStates.Gone;
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                //Set Full screen
                View mContentView = Window?.DecorView;
                var  uiOptions    = (int)mContentView.SystemUiVisibility;
                var  newUiOptions = uiOptions;

                newUiOptions |= (int)SystemUiFlags.Fullscreen;
                newUiOptions |= (int)SystemUiFlags.HideNavigation;
                mContentView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

                Window?.AddFlags(WindowManagerFlags.Fullscreen);

                // Create your application here
                SetContentView(Resource.Layout.Login_Layout);

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();
                GetTimezone();

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Пример #22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                // Create your application here
                SetContentView(Resource.Layout.First_Layout);
                //Get Value
                InitComponent();

                //Check and Get Settings
                GetSettingsSite();

                if (!string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Пример #23
0
        private void InitComponent()
        {
            try
            {
                ImageView image1 = FindViewById <ImageView>(Resource.Id.Iconimage);
                ImageView image2 = FindViewById <ImageView>(Resource.Id.Iconimage2);

                LoginButton    = FindViewById <Button>(Resource.Id.LoginButton);
                RegisterButton = FindViewById <Button>(Resource.Id.RegisterButton);

                GlideImageLoader.LoadImage(this, "FirstImageOne", image1, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                GlideImageLoader.LoadImage(this, "FirstImageTwo", image2, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                if (!string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);
                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Main);

                Client a = new Client(AppSettings.TripleDesAppServiceProvider);
                Console.WriteLine(a);

                //Get Value And Set Toolbar
                InitComponent();
                InitSocialLogins();

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                if (Methods.CheckConnectivity())
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => ApiRequest.GetSettings_Api(this), GetTimezone
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #25
0
        public static async Task <GetSiteSettingsObject.ConfigObject> GetSettings_Api(Activity context)
        {
            if (Methods.CheckConnectivity())
            {
                await SetLangUserAsync().ConfigureAwait(false);

                (var apiStatus, dynamic respond) = await Current.GetSettings();

                if (apiStatus != 200 || !(respond is GetSiteSettingsObject result) || result.Config == null)
                {
                    return(Methods.DisplayReportResult(context, respond));
                }

                ListUtils.SettingsSiteList = result.Config;

                AppSettings.OneSignalAppId = result.Config.AndroidNPushId;
                OneSignalNotification.RegisterNotificationDevice();

                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                dbDatabase.InsertOrUpdateSettings(result.Config);
                dbDatabase.Dispose();

                //Page Categories
                var listPage = result.Config.PageCategories?.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = Methods.FunString.DecodeString(cat.Value),
                    CategoriesColor = "#ffffff",
                    SubList         = new List <SubCategories>()
                }).ToList();

                CategoriesController.ListCategoriesPage.Clear();
                if (listPage?.Count > 0)
                {
                    CategoriesController.ListCategoriesPage = new ObservableCollection <Classes.Categories>(listPage);
                }

                if (result.Config.PageSubCategories?.SubCategoriesList?.Count > 0)
                {
                    //Sub Categories Page
                    foreach (var sub in result.Config.PageSubCategories?.SubCategoriesList)
                    {
                        var subCategories = result.Config.PageSubCategories?.SubCategoriesList?.FirstOrDefault(a => a.Key == sub.Key).Value;
                        if (subCategories?.Count > 0)
                        {
                            var cat = CategoriesController.ListCategoriesPage.FirstOrDefault(a => a.CategoriesId == sub.Key);
                            if (cat != null)
                            {
                                foreach (var pairs in subCategories)
                                {
                                    cat.SubList.Add(pairs);
                                }
                            }
                        }
                    }
                }

                //Group Categories
                var listGroup = result.Config.GroupCategories?.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = Methods.FunString.DecodeString(cat.Value),
                    CategoriesColor = "#ffffff",
                    SubList         = new List <SubCategories>()
                }).ToList();

                CategoriesController.ListCategoriesGroup.Clear();
                if (listGroup?.Count > 0)
                {
                    CategoriesController.ListCategoriesGroup = new ObservableCollection <Classes.Categories>(listGroup);
                }

                if (result.Config.GroupSubCategories?.SubCategoriesList?.Count > 0)
                {
                    //Sub Categories Group
                    foreach (var sub in result.Config.GroupSubCategories?.SubCategoriesList)
                    {
                        var subCategories = result.Config.GroupSubCategories?.SubCategoriesList?.FirstOrDefault(a => a.Key == sub.Key).Value;
                        if (subCategories?.Count > 0)
                        {
                            var cat = CategoriesController.ListCategoriesGroup.FirstOrDefault(a => a.CategoriesId == sub.Key);
                            if (cat != null)
                            {
                                foreach (var pairs in subCategories)
                                {
                                    cat.SubList.Add(pairs);
                                }
                            }
                        }
                    }
                }

                if (CategoriesController.ListCategoriesGroup.Count == 0 && CategoriesController.ListCategoriesPage.Count > 0)
                {
                    CategoriesController.ListCategoriesGroup = new ObservableCollection <Classes.Categories>(CategoriesController.ListCategoriesPage);
                }

                //Blog Categories
                var listBlog = result.Config.BlogCategories?.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = Methods.FunString.DecodeString(cat.Value),
                    CategoriesColor = "#ffffff",
                    SubList         = new List <SubCategories>()
                }).ToList();

                CategoriesController.ListCategoriesBlog.Clear();
                if (listBlog?.Count > 0)
                {
                    CategoriesController.ListCategoriesBlog = new ObservableCollection <Classes.Categories>(listBlog);
                }

                //Products Categories
                var listProducts = result.Config.ProductsCategories?.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = Methods.FunString.DecodeString(cat.Value),
                    CategoriesColor = "#ffffff",
                    SubList         = new List <SubCategories>()
                }).ToList();

                CategoriesController.ListCategoriesProducts.Clear();
                if (listProducts?.Count > 0)
                {
                    CategoriesController.ListCategoriesProducts = new ObservableCollection <Classes.Categories>(listProducts);
                }

                if (result.Config.ProductsSubCategories?.SubCategoriesList?.Count > 0)
                {
                    //Sub Categories Products
                    foreach (var sub in result.Config.ProductsSubCategories?.SubCategoriesList)
                    {
                        var subCategories = result.Config.ProductsSubCategories?.SubCategoriesList?.FirstOrDefault(a => a.Key == sub.Key).Value;
                        if (subCategories?.Count > 0)
                        {
                            var cat = CategoriesController.ListCategoriesProducts.FirstOrDefault(a => a.CategoriesId == sub.Key);
                            if (cat != null)
                            {
                                foreach (var pairs in subCategories)
                                {
                                    cat.SubList.Add(pairs);
                                }
                            }
                        }
                    }
                }

                //Job Categories
                var listJob = result.Config.JobCategories?.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = Methods.FunString.DecodeString(cat.Value),
                    CategoriesColor = "#ffffff",
                    SubList         = new List <SubCategories>()
                }).ToList();

                CategoriesController.ListCategoriesJob.Clear();
                if (listJob?.Count > 0)
                {
                    CategoriesController.ListCategoriesJob = new ObservableCollection <Classes.Categories>(listJob);
                }

                //Family
                var listFamily = result.Config.Family?.Select(cat => new Classes.Family
                {
                    FamilyId   = cat.Key,
                    FamilyName = Methods.FunString.DecodeString(cat.Value),
                }).ToList();

                ListUtils.FamilyList.Clear();
                if (listFamily?.Count > 0)
                {
                    ListUtils.FamilyList = new ObservableCollection <Classes.Family>(listFamily);
                }

                //Movie Category
                var listMovie = result.Config.MovieCategory?.Select(cat => new Classes.Categories
                {
                    CategoriesId    = cat.Key,
                    CategoriesName  = Methods.FunString.DecodeString(cat.Value),
                    CategoriesColor = "#ffffff",
                    SubList         = new List <SubCategories>()
                }).ToList();

                CategoriesController.ListCategoriesMovies.Clear();
                if (listMovie?.Count > 0)
                {
                    CategoriesController.ListCategoriesMovies = new ObservableCollection <Classes.Categories>(listMovie);
                }

                try
                {
                    if (AppSettings.SetApisReportMode)
                    {
                        if (CategoriesController.ListCategoriesPage.Count == 0)
                        {
                            Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "List Categories Page Not Found, Please check api get_site_settings ", "Close");
                        }

                        if (CategoriesController.ListCategoriesGroup.Count == 0)
                        {
                            Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "List Categories Group Not Found, Please check api get_site_settings ", "Close");
                        }

                        if (CategoriesController.ListCategoriesProducts.Count == 0)
                        {
                            Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "List Categories Products Not Found, Please check api get_site_settings ", "Close");
                        }

                        if (ListUtils.FamilyList.Count == 0)
                        {
                            Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "Family List Not Found, Please check api get_site_settings ", "Close");
                        }

                        if (AppSettings.SetApisReportMode && AppSettings.ShowColor)
                        {
                            if (ListUtils.SettingsSiteList?.PostColors != null && ListUtils.SettingsSiteList?.PostColors.Value.PostColorsList != null && ListUtils.SettingsSiteList?.PostColors.Value.PostColorsList.Count == 0)
                            {
                                Methods.DialogPopup.InvokeAndShowDialog(context, "ReportMode", "PostColors Not Found, Please check api get_site_settings ", "Close");
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Methods.DisplayReportResultTrack(e);
                }

                return(result.Config);
            }
            else
            {
                Toast.MakeText(Application.Context, Application.Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                return(null !);
            }
        }
        private async void RegisterButtonOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    if (!string.IsNullOrEmpty(UsernameEditext.Text) || !string.IsNullOrEmpty(PasswordEditext.Text) ||
                        !string.IsNullOrEmpty(PasswordRepeatEditext.Text) || !string.IsNullOrEmpty(EmailEditext.Text))
                    {
                        Settings st = new Settings();

                        Current.CurrentInstance.SetWebsiteURL(st.WebsiteUrl, st.ServerKey);

                        var check = IMethods.Fun_String.IsEmailValid(EmailEditext.Text);
                        if (!check)
                        {
                            IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                     GetText(Resource.String.Lbl_VerificationFailed),
                                                                     GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok));
                        }
                        else
                        {
                            if (PasswordRepeatEditext.Text == PasswordEditext.Text)
                            {
                                progressBar.Visibility = ViewStates.Visible;

                                var settingsResult = await Current.GetWoWonder_Settings(st, "WoWonder_Native_Android");

                                if (settingsResult != null)
                                {
                                    string PushID = "";
                                    try
                                    {
                                        PushID = settingsResult["push_id_2"].ToString();
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine(e);
                                    }
                                    if (OneSignalNotification.OneSignalAPP_ID == "")
                                    {
                                        OneSignalNotification.OneSignalAPP_ID = PushID;
                                        if (Settings.ShowNotification)
                                        {
                                            OneSignalNotification.RegisterNotificationDevice();
                                        }
                                    }

                                    var(Api_status, Respond) =
                                        await Client.Global.Get_Create_Account(UsernameEditext.Text,
                                                                               PasswordEditext.Text, PasswordRepeatEditext.Text, EmailEditext.Text, UserDetails.Device_ID);

                                    if (Respond.Api_status == 220)
                                    {
                                        var obj = new IMethods.DialogPopup(this);

                                        var x = await obj.ShowDialog("Success",
                                                                     "Registration successful! We have sent you an email, Please check your inbox/spam to verify your email.");

                                        //var data = "";
                                        StartActivity(new Intent(this, typeof(First_Activity)));
                                    }
                                    else if (Api_status == 200)
                                    {
                                        if (Respond is Creat_Account_Object result)
                                        {
                                            WoWonder_API.Client.WebsiteUrl       = st.WebsiteUrl;
                                            Current.CurrentInstance.ServerKey    = st.ServerKey;
                                            Current.CurrentInstance.Access_token = result.access_token;

                                            UserDetails.Username     = UsernameEditext.Text;
                                            UserDetails.Full_name    = UsernameEditext.Text;
                                            UserDetails.Password     = PasswordEditext.Text;
                                            UserDetails.access_token = result.access_token;
                                            UserDetails.User_id      = result.user_id;
                                            UserDetails.Status       = "Active";
                                            UserDetails.Cookie       = result.access_token;
                                            UserDetails.Email        = EmailEditext.Text;

                                            //Insert user data to database
                                            var user = new DataTables.LoginTB
                                            {
                                                UserID       = UserDetails.User_id,
                                                access_token = UserDetails.access_token,
                                                Cookie       = UserDetails.Cookie,
                                                Username     = UsernameEditext.Text,
                                                Password     = PasswordEditext.Text,
                                                Status       = "Active",
                                                Lang         = "",
                                                Device_ID    = UserDetails.Device_ID,
                                            };

                                            Classes.DataUserLoginList.Add(user);

                                            var dbDatabase = new SqLiteDatabase();
                                            dbDatabase.InsertRow(user);
                                            dbDatabase.Dispose();

                                            if (Settings.Show_WalkTroutPage)
                                            {
                                                StartActivity(new Intent(this, typeof(AppIntroWalkTroutPage)));
                                            }
                                            else
                                            {
                                                StartActivity(new Intent(this, typeof(Tabbed_Main_Activity)));

                                                //Get data profile
                                                var data = API_Request.Get_MyProfileData_Api(this).ConfigureAwait(false);
                                            }
                                        }

                                        progressBar.Visibility = ViewStates.Invisible;
                                        Finish();
                                    }
                                    else if (Api_status == 400)
                                    {
                                        var error = Respond as Error_Object;
                                        if (error != null)
                                        {
                                            var errortext = error._errors.Error_text;

                                            var errorid = error._errors.Error_id;

                                            if (errorid == "3")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_3),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "4")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_4),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "5")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_something_went_wrong),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "6")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_6),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "7")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_7),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "8")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_8),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "9")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_9),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "10")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_10),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "11")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_11),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security), errortext,
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                        }

                                        progressBar.Visibility = ViewStates.Invisible;
                                    }
                                    else if (Api_status == 404)
                                    {
                                        //var Error = Respond.ToString();
                                        progressBar.Visibility = ViewStates.Invisible;
                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Security),
                                                                                 GetText(Resource.String.Lbl_Error_Login), GetText(Resource.String.Lbl_Ok));
                                    }
                                }
                            }
                            else
                            {
                                progressBar.Visibility = ViewStates.Invisible;

                                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                         GetText(Resource.String.Lbl_Error_Register_password),
                                                                         GetText(Resource.String.Lbl_Ok));
                            }
                        }
                    }
                    else
                    {
                        progressBar.Visibility = ViewStates.Invisible;

                        IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                 GetText(Resource.String.Lbl_Please_enter_your_data), GetText(Resource.String.Lbl_Ok));
                    }
                }
                else
                {
                    progressBar.Visibility = ViewStates.Invisible;
                    //IMethods.DialogPopup.Hide_Loading_Dialog(this);
                    IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                             GetText(Resource.String.Lbl_CheckYourInternetConnection), GetText(Resource.String.Lbl_Ok));
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
                progressBar.Visibility = ViewStates.Invisible;
                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), exception.Message,
                                                         GetText(Resource.String.Lbl_Ok));
            }
        }
Пример #27
0
        //Get Settings Api
        public static async Task GetSettings_Api(Activity activity)
        {
            if (Methods.CheckConnectivity())
            {
                if (UserDetails.IsLogin)
                {
                    await SetLangUserAsync();
                }

                //site_settings
                var(apiStatus, respond) = await Current.Get_Settings_Http();

                if (apiStatus == 200)
                {
                    if (respond is GetSettingsObject result)
                    {
                        var settings = result.Data.SiteSettings;

                        ListUtils.MySettingsList = settings;

                        AppSettings.OneSignalAppId   = settings.PushId;
                        AppSettings.ShowButtonImport = string.IsNullOrWhiteSpace(settings.ImportSystem) ? AppSettings.ShowButtonImport : settings.ImportSystem == "on";
                        AppSettings.ShowButtonUpload = string.IsNullOrWhiteSpace(settings.UploadSystem) ? AppSettings.ShowButtonUpload : settings.UploadSystem == "on";

                        OneSignalNotification.RegisterNotificationDevice();

                        if (settings.Categories?.Count > 0)
                        {
                            //Categories >> New V.1.6
                            var listCategories = settings.Categories.Select(cat => new Classes.Category
                            {
                                Id      = cat.Key,
                                Name    = Methods.FunString.DecodeString(cat.Value),
                                Color   = "#212121",
                                Image   = CategoriesController.GetImageCategory(cat.Value),
                                SubList = new List <Classes.Category>()
                            }).ToList();

                            CategoriesController.ListCategories.Clear();
                            CategoriesController.ListCategories = new ObservableCollection <Classes.Category>(listCategories);
                        }
                        else
                        {
                            //Categories >> Old V.1.5
                            var listCategories = result.Data.Categories.Select(cat => new Classes.Category
                            {
                                Id      = cat.Key,
                                Name    = Methods.FunString.DecodeString(cat.Value),
                                Color   = "#212121",
                                Image   = CategoriesController.GetImageCategory(cat.Value),
                                SubList = new List <Classes.Category>()
                            }).ToList();

                            CategoriesController.ListCategories.Clear();
                            CategoriesController.ListCategories = new ObservableCollection <Classes.Category>(listCategories);
                        }

                        if (settings.SubCategories?.SubCategoriessList?.Count > 0)
                        {
                            //Sub Categories
                            foreach (var sub in settings.SubCategories?.SubCategoriessList)
                            {
                                var subCategories = ListUtils.MySettingsList?.SubCategories?.SubCategoriessList?.FirstOrDefault(a => a.Key == sub.Key).Value;
                                if (subCategories?.Count > 0)
                                {
                                    var cat = CategoriesController.ListCategories.FirstOrDefault(a => a.Id == sub.Key);
                                    if (cat != null)
                                    {
                                        foreach (var pairs in subCategories.SelectMany(pairs => pairs))
                                        {
                                            cat.SubList.Add(new Classes.Category()
                                            {
                                                Id    = pairs.Key,
                                                Name  = Methods.FunString.DecodeString(pairs.Value),
                                                Color = "#212121",
                                            });
                                        }
                                    }
                                }
                            }
                        }

                        if (settings.MoviesCategories?.Count > 0)
                        {
                            //Movies Categories
                            var listMovies = settings.MoviesCategories.Select(cat => new Classes.Category
                            {
                                Id      = cat.Key,
                                Name    = Methods.FunString.DecodeString(cat.Value),
                                Color   = "#212121",
                                SubList = new List <Classes.Category>()
                            }).ToList();

                            CategoriesController.ListCategoriesMovies.Clear();
                            CategoriesController.ListCategoriesMovies = new ObservableCollection <Classes.Category>(listMovies);
                        }

                        //Insert MySettings in Database
                        var sqlEntity = new SqLiteDatabase();
                        sqlEntity.InsertOrUpdate_Settings(settings);
                        sqlEntity.Dispose();
                    }
                }
                else
                {
                    Methods.DisplayReportResult(activity, respond);
                }
            }
        }
Пример #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Methods.App.FullScreenApp(this);

                SetContentView(Resource.Layout.First_Layout);

                LoginButton               = FindViewById <Button>(Resource.Id.LoginButton);
                RegisterButton            = FindViewById <Button>(Resource.Id.RegisterButton);
                ContinueButton            = FindViewById <Button>(Resource.Id.ContinueButton);
                IncludeLayout             = FindViewById <View>(Resource.Id.IncludeLayout);
                VideoViewer               = FindViewById <VideoView>(Resource.Id.videoView);
                LayoutBase                = FindViewById <RelativeLayout>(Resource.Id.Layout_Base);
                ContinueButton.Visibility = ViewStates.Invisible;


                switch (AppSettings.BackgroundScreenWelcomeType)
                {
                //Set Theme
                case "Image":
                    LayoutBase.SetBackgroundResource(Resource.Drawable.loginBackground);
                    IncludeLayout.Visibility = ViewStates.Gone;
                    break;

                case "Video":
                {
                    var uri = Uri.Parse("android.resource://" + PackageName + "/" + Resource.Raw.MainVideo);
                    VideoViewer.SetVideoURI(uri);
                    VideoViewer.Start();
                    break;
                }

                case "Gradient":
                    IncludeLayout.Visibility = ViewStates.Gone;
                    LayoutBase.SetBackgroundResource(Resource.Xml.login_background_shape);
                    break;
                }

                if (!AppSettings.EnableRegisterSystem)
                {
                    RegisterButton.Visibility = ViewStates.Gone;
                }

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                    LoadConfigSettings();
                    CheckCrossAppAuthentication();
                }
                else
                {
                    if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted)
                    {
                        LoadConfigSettings();
                        CheckCrossAppAuthentication();
                    }
                    else
                    {
                        RequestPermissions(new[]
                        {
                            Manifest.Permission.ReadExternalStorage,
                            Manifest.Permission.WriteExternalStorage
                        }, 101);
                    }
                }

                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Пример #29
0
        private async void RegisterButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (Chk_agree.Checked)
                {
                    if (IMethods.CheckConnectivity())
                    {
                        if (!String.IsNullOrEmpty(UsernameEditext.Text) ||
                            !String.IsNullOrEmpty(PasswordEditext.Text) ||
                            !String.IsNullOrEmpty(PasswordRepeatEditext.Text) ||
                            !String.IsNullOrEmpty(EmailEditext.Text))
                        {
                            var check = IMethods.Fun_String.IsEmailValid(EmailEditext.Text);
                            if (!check)
                            {
                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                         GetText(Resource.String.Lbl_VerificationFailed),
                                                                         GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok));
                            }
                            else
                            {
                                if (PasswordRepeatEditext.Text == PasswordEditext.Text)
                                {
                                    progressBar.Visibility    = ViewStates.Visible;
                                    RegisterButton.Visibility = ViewStates.Gone;

                                    var settingsResult = await Current.GetSettings();

                                    if (settingsResult.Item1 == 200)
                                    {
                                        var PushID = settingsResult.Item2.PushId.ToString();
                                        if (OneSignalNotification.OneSignalAPP_ID == "")
                                        {
                                            OneSignalNotification.OneSignalAPP_ID = PushID;
                                            if (AppSettings.ShowNotification)
                                            {
                                                OneSignalNotification.RegisterNotificationDevice();
                                            }
                                        }

                                        var(Api_status, Respond) =
                                            await WoWonder_API.Requests.RequestsAsync.Global.Get_Create_Account(
                                                UsernameEditext.Text,
                                                PasswordEditext.Text, PasswordRepeatEditext.Text, EmailEditext.Text);

                                        if (Api_status == 200)
                                        {
                                            if (Respond is CreatAccountObject result)
                                            {
                                                Current.AccessToken = result.access_token;

                                                UserDetails.Username     = UsernameEditext.Text;
                                                UserDetails.Full_name    = UsernameEditext.Text;
                                                UserDetails.Password     = PasswordEditext.Text;
                                                UserDetails.access_token = result.access_token;
                                                UserDetails.User_id      = result.user_id;
                                                UserDetails.Status       = "Active";
                                                UserDetails.Cookie       = result.access_token;
                                                UserDetails.Email        = EmailEditext.Text;

                                                //Insert user data to database
                                                var user = new DataTables.LoginTB
                                                {
                                                    UserID       = UserDetails.User_id,
                                                    access_token = UserDetails.access_token,
                                                    Cookie       = UserDetails.Cookie,
                                                    Username     = UsernameEditext.Text,
                                                    Password     = PasswordEditext.Text,
                                                    Status       = "Active",
                                                    Lang         = ""
                                                };

                                                Classes.DataUserLoginList.Add(user);

                                                var dbDatabase = new SqLiteDatabase();
                                                dbDatabase.InsertRow(user);
                                                dbDatabase.Dispose();

                                                StartActivity(new Intent(this, typeof(AppIntroWalkTroutPage)));
                                            }

                                            progressBar.Visibility    = ViewStates.Gone;
                                            RegisterButton.Visibility = ViewStates.Visible;
                                            Finish();
                                        }
                                        else if (Api_status == 220)
                                        {
                                            //var dialog = new MaterialDialog.Builder(this);

                                            //dialog.Title(GetText(Resource.String.Lbl_ActivationSent));
                                            //dialog.Content(GetText(Resource.String.Lbl_ActivationDetails)
                                            //    .Replace("@", EmailEditext.Text));
                                            //dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(this);

                                            //dialog.AlwaysCallSingleChoiceCallback();
                                            // dialog.Build().Show();
                                            var obj = new IMethods.DialogPopup(this);

                                            var x = await obj.ShowDialog("Success",
                                                                         "Registration successful! We have sent you an email, Please check your inbox/spam to verify your email.");

                                            StartActivity(new Intent(this, typeof(MainActivity)));
                                        }
                                        else if (Api_status == 400)
                                        {
                                            var error = Respond as ErrorObject;
                                            if (error != null)
                                            {
                                                var errortext = error._errors.Error_text;

                                                var errorid = error._errors.Error_id;

                                                if (errorid == "3")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_3),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "4")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_4),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "5")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_Something_went_wrong),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "6")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_6),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "7")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_7),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "8")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_8),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "9")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_9),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "10")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_10),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else if (errorid == "11")
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security),
                                                                                             GetText(Resource.String.Lbl_ErrorRegister_11),
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                                else
                                                {
                                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                             GetText(Resource.String.Lbl_Security), errortext,
                                                                                             GetText(Resource.String.Lbl_Ok));
                                                }
                                            }

                                            progressBar.Visibility    = ViewStates.Gone;
                                            RegisterButton.Visibility = ViewStates.Visible;
                                        }
                                        else if (Api_status == 404)
                                        {
                                            progressBar.Visibility    = ViewStates.Gone;
                                            RegisterButton.Visibility = ViewStates.Visible;
                                            IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                     GetText(Resource.String.Lbl_Security),
                                                                                     GetText(Resource.String.Lbl_Error_Login),
                                                                                     GetText(Resource.String.Lbl_Ok));
                                        }
                                    }
                                }
                                else
                                {
                                    progressBar.Visibility    = ViewStates.Gone;
                                    RegisterButton.Visibility = ViewStates.Visible;

                                    IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                             GetText(Resource.String.Lbl_Security),
                                                                             GetText(Resource.String.Lbl_Error_Register_password),
                                                                             GetText(Resource.String.Lbl_Ok));
                                }
                            }
                        }
                        else
                        {
                            progressBar.Visibility    = ViewStates.Gone;
                            RegisterButton.Visibility = ViewStates.Visible;
                            IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                     GetText(Resource.String.Lbl_Please_enter_your_data), GetText(Resource.String.Lbl_Ok));
                        }
                    }
                    else
                    {
                        progressBar.Visibility    = ViewStates.Gone;
                        RegisterButton.Visibility = ViewStates.Visible;

                        IMethods.DialogPopup.InvokeAndShowDialog(this, this.GetText(Resource.String.Lbl_Security),
                                                                 this.GetText(Resource.String.Lbl_Error_check_internet_connection),
                                                                 this.GetText(Resource.String.Lbl_Ok));
                        return;
                    }
                }
                else
                {
                    IMethods.DialogPopup.InvokeAndShowDialog(this, this.GetText(Resource.String.Lbl_Warning),
                                                             this.GetText(Resource.String.Lbl_Error_Terms), this.GetText(Resource.String.Lbl_Ok));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                progressBar.Visibility    = ViewStates.Gone;
                RegisterButton.Visibility = ViewStates.Visible;
                IMethods.DialogPopup.InvokeAndShowDialog(this, this.GetText(Resource.String.Lbl_Authentication_failed),
                                                         ex.Message, this.GetText(Resource.String.Lbl_Ok));
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                AddSlide(new AnimFragment1());
                AddSlide(new AnimFragment2());
                AddSlide(new AnimFragment4());
                AddSlide(new AnimFragment3());

                if (AppSettings.WalkThroughSetFlowAnimation)
                {
                    SetFlowAnimation();
                }
                else if (AppSettings.WalkThroughSetZoomAnimation)
                {
                    SetZoomAnimation();
                }
                else if (AppSettings.WalkThroughSetSlideOverAnimation)
                {
                    SetSlideOverAnimation();
                }
                else if (AppSettings.WalkThroughSetDepthAnimation)
                {
                    SetDepthAnimation();
                }
                else if (AppSettings.WalkThroughSetFadeAnimation)
                {
                    SetFadeAnimation();
                }

                ShowStatusBar(false);

                //SetNavBarColor(Color.ParseColor(AppSettings.MainColor));
                SetIndicatorColor(Color.ParseColor(AppSettings.MainColor), Color.ParseColor("#888888"));
                //SetBarColor(Color.ParseColor("#3F51B5"));
                // SetSeparatorColor(Color.ParseColor("#2196f3"));

                Caller = Intent.GetStringExtra("class") ?? "";

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                }
                else
                {
                    RequestPermissions(new[]
                    {
                        Manifest.Permission.AccessFineLocation,
                        Manifest.Permission.AccessCoarseLocation,
                        Manifest.Permission.Camera
                    }, 208);
                }

                //OneSignal Notification
                //======================================
                if (string.IsNullOrEmpty(UserDetails.DeviceId))
                {
                    OneSignalNotification.RegisterNotificationDevice();
                }

                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                    () => ApiRequest.Get_MyProfileData_Api(this)
                });

                FullGlideRequestBuilder = Glide.With(this).AsDrawable().SetDiskCacheStrategy(DiskCacheStrategy.Automatic).SkipMemoryCache(true).Override(200);

                List <string> stickerList = new List <string>();
                stickerList.AddRange(Stickers.StickerList1);
                stickerList.AddRange(Stickers.StickerList2);
                stickerList.AddRange(Stickers.StickerList3);
                stickerList.AddRange(Stickers.StickerList4);
                stickerList.AddRange(Stickers.StickerList5);
                stickerList.AddRange(Stickers.StickerList6);

                Task.Factory.StartNew(() =>
                {
                    try
                    {
                        foreach (var item in stickerList)
                        {
                            FullGlideRequestBuilder.Load(item).Preload();
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }