Example #1
0
 private void Notification_Page_OnDisappearing(object sender, EventArgs e)
 {
     try
     {
         var SettingsNotify = SQL_Commander.GetLoginCredentialsByUserID(Settings.User_id);
         var Coler          = LedListItems.First();
         if (SettingsNotify != null)
         {
             Settings.NotificationPopup              = NotifyPopup.IsToggled;
             SettingsNotify.NotificationPopup        = NotifyPopup.IsToggled;
             Settings.NotificationSound              = NotifySound.IsToggled;
             SettingsNotify.NotificationSound        = NotifySound.IsToggled;
             Settings.NotificationVibrate            = NotifyVibrate.IsToggled;
             SettingsNotify.NotificationVibrate      = NotifyVibrate.IsToggled;
             SettingsNotify.NotificationLedColor     = Coler.CheckiconColor;
             SettingsNotify.NotificationLedColorName = Coler.ColorText;
             Settings.NotificationLedColor           = Coler.CheckiconColor;
             Settings.NotificationLedColorName       = Coler.ColorText;
             SQL_Commander.UpdateLoginCredentials(SettingsNotify);
         }
     }
     catch (Exception)
     {
     }
 }
        public PrivacyPage()
        {
            InitializeComponent();

            Save.BackgroundColor          = Color.FromHex(Settings.PR_SaveButton_Color);
            Save.TextColor                = Color.FromHex(Settings.PR_SaveButtonText_Color);
            FolowOrFriendLabel.Text       = AppResources.Label_WhoCan_Follow_me;
            WhoCanSeemybirthdaylabel.Text = AppResources.Label_WhoCan_See_my_Birthday;
            WhoCanmessgamelabel.Text      = AppResources.Label_WhoCan_Message_me;

            if (Settings.ConnectivitySystem == "0")
            {
                FolowOrFriendLabel.Text = AppResources.Label_WhoCan_Add_me;
            }



            var data = SQL_Commander.GetPrivacyDBCredentialsById(Settings.User_id);

            if (data != null)
            {
                WhocamessagemePicker.SelectedIndex = data.WhoCanMessageMe;
                Whocanfollowme.SelectedIndex       = data.WhoCanFollowMe;
                Whocanseemybirthday.SelectedIndex  = data.WhoCanSeeMyBirday;
            }
            else
            {
                WhocamessagemePicker.SelectedIndex = 0;
                Whocanfollowme.SelectedIndex       = 0;
                Whocanseemybirthday.SelectedIndex  = 0;
            }



            var Status = SQL_Commander.GetLoginCredentialsByUserID(Settings.User_id);

            if (Status != null)
            {
                if (Status.MyConnectionStatus == "0")
                {
                    SwitchCellOnline.On = true;
                }
                else
                {
                    SwitchCellOnline.On = false;
                }
            }
            else
            {
                SwitchCellOnline.On = true;
            }
        }
Example #3
0
        public Notification_Page()
        {
            InitializeComponent();
            LedListItems.Clear();

            //Data.ClearLoginCredentialsList();
            var SettingsNotify = SQL_Commander.GetLoginCredentialsByUserID(Settings.User_id);

            if (SettingsNotify != null)
            {
                if (SettingsNotify.NotificationLedColor == null)
                {
                    SettingsNotify.NotificationLedColor     = Settings.MainColor;
                    SettingsNotify.NotificationLedColorName = AppResources.Label_Led_Color;


                    LedListItems.Add(new Ledtems()
                    {
                        Checkicon      = "\uf111",
                        ColorText      = AppResources.Label_Led_Color,
                        CheckiconColor = Settings.MainColor
                    });
                }
                else
                {
                    LedListItems.Add(new Ledtems()
                    {
                        Checkicon      = "\uf111",
                        ColorText      = AppResources.Label_Led_Color,
                        CheckiconColor = SettingsNotify.NotificationLedColor
                    });
                }

                NotifyVibrate.IsToggled = Settings.NotificationVibrate;
                NotifyPopup.IsToggled   = Settings.NotificationPopup;
                NotifySound.IsToggled   = Settings.NotificationSound;
            }



            LedList.ItemsSource = LedListItems;
        }
        private async void SwitchCellOnline_OnOnChanged(object sender, ToggledEventArgs e)
        {
            try
            {
                var device   = Resolver.Resolve <IDevice>();
                var oNetwork = device.Network;
                var xx       = oNetwork.InternetConnectionStatus() == NetworkStatus.NotReachable;
                if (xx == true)
                {
                    await DisplayAlert(AppResources.Label_Error, AppResources.Label_CheckYourInternetConnection, AppResources.Label_OK);
                }
                else
                {
                    var StatusNumber = "0";
                    if (SwitchCellOnline.On)
                    {
                        StatusNumber          = "0";
                        SwitchCellOnline.Text = AppResources.Label_Online;
                    }
                    else
                    {
                        StatusNumber          = "1";
                        SwitchCellOnline.Text = AppResources.Label_Offline;
                    }
                    try
                    {
                        using (var client = new HttpClient())
                        {
                            var Status = new Dictionary <string, string> {
                                { "status", StatusNumber }
                            };
                            string StatusActive = JsonConvert.SerializeObject(Status);
                            var    formContent  = new FormUrlEncodedContent(new[]
                            {
                                new KeyValuePair <string, string>("user_id", Settings.User_id),
                                new KeyValuePair <string, string>("type", "online_status"),
                                new KeyValuePair <string, string>("s", Settings.Session),
                                new KeyValuePair <string, string>("user_data", StatusActive)
                            });

                            var response = await client.PostAsync(Settings.Website + "/app_api.php?application=phone&type=update_user_data", formContent);

                            response.EnsureSuccessStatusCode();
                            string json = await response.Content.ReadAsStringAsync();

                            var    data      = JsonConvert.DeserializeObject <Dictionary <string, object> >(json);
                            string apiStatus = data["api_status"].ToString();
                            if (apiStatus == "200")
                            {
                                var StatusConnection = SQL_Commander.GetLoginCredentialsByUserID(Settings.User_id);
                                StatusConnection.MyConnectionStatus = StatusNumber;

                                SQL_Commander.UpdateLoginCredentials(StatusConnection);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception)
            {
            }
        }