public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.DialogRating, null); Button buttonEasy = view.FindViewById<Button>(Resource.Id.buttonEasy); Button buttonYester = view.FindViewById<Button>(Resource.Id.buttonYester); Button buttonNo = view.FindViewById<Button>(Resource.Id.buttonNo); var preferences = Activity.GetPreferences(FileCreationMode.Private); _editor = preferences.Edit(); buttonEasy.Click += (object sender, EventArgs e) => { var url = Android.Net.Uri.Parse("https://itunes.apple.com/ua/app/ers/id604886527?mt=8"); var intent = new Intent(Intent.ActionView, url); StartActivity(intent); _editor.PutBoolean("isShow", false); this.Dismiss(); }; buttonYester.Click += (object sender, EventArgs e) => { _editor.PutBoolean("isShow", true); this.Dismiss(); }; buttonNo.Click += (object sender, EventArgs e) => { _editor.PutBoolean("isShow", false); this.Dismiss(); }; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.ChooseRegistration); listview = FindViewById<ListView> (Resource.Id.Choose_Registration_List); prefsEditor = prefs.Edit (); ICollection<string> regColl; try{ regColl=prefs.GetStringSet("MyRegistrationTextPrefs", null); foreach (String reg in regColl) { Log.Debug ("regtext",reg); regText.Add (reg); } }catch(Exception e){ //Log.Debug ("Ucitavanje registracijske oznake neuspijelo.Nema nijedne ponudene",e.ToString ()); } try{ listview.Adapter = new BaseAdapterKlasa (this, regText.ToArray ()); listview.ItemClick += OnListItemClick; listview.ItemLongClick += OnLongListItemClick; }catch(Exception e){ Log.Debug ("Nije upisana nijedna registracija.",e.ToString ()); } }
public void Dispose() { if (_isDisposed) return; Editor.Commit(); _sharedPreferencesEditor = null; _isDisposed = true; }
protected override void OnCreate(Bundle bundle) { Delegate.InstallViewFactory(); Delegate.OnCreate(bundle); base.OnCreate(bundle); SetContentView(Resource.Layout.settings); var toolbar = FindViewById<Toolbar>(Resource.Id.settings_toolbar); SetSupportActionBar(toolbar); AddPreferencesFromResource(Resource.Xml.settings); SupportActionBar.Title = "Impostazioni"; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.NavigationClick += delegate (object sender, Toolbar.NavigationClickEventArgs e) { Finish(); }; prefs = Application.Context.GetSharedPreferences ("AndroidReport", FileCreationMode.Private); prefsEdit = prefs.Edit(); Preference deleteCache = (Preference)FindPreference("delete_cache"); deleteCache.PreferenceClick += DeleteCache_PreferenceClick; if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) { SwitchPreference cacheSwitch = (SwitchPreference)FindPreference("allow_cache"); cacheSwitch.PreferenceChange += CacheSwitch_PreferenceChange; SwitchPreference notificationSwitch = (SwitchPreference)FindPreference("allow_notifications"); notificationSwitch.PreferenceChange += NotificationSwitch_PreferenceChange; SwitchPreference animationSwitch = (SwitchPreference)FindPreference("allow_animations"); animationSwitch.PreferenceChange += AnimationSwitch_PreferenceChange; } else { CheckBoxPreference cacheSwitch = (CheckBoxPreference)FindPreference("allow_cache"); cacheSwitch.PreferenceChange += CacheSwitch_PreferenceChange; CheckBoxPreference notificationSwitch = (CheckBoxPreference)FindPreference("allow_notifications"); notificationSwitch.PreferenceChange += NotificationSwitch_PreferenceChange; CheckBoxPreference animationSwitch = (CheckBoxPreference)FindPreference("allow_animations"); animationSwitch.PreferenceChange += AnimationSwitch_PreferenceChange; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Login); // Shared preferences file for storing bearer token for whole app - initialization: preferences = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); editor = preferences.Edit(); mEmailField = base.FindViewById<EditText>(Resource.Id.emailField); mPassField = base.FindViewById<EditText>(Resource.Id.passField); mLoginButton = base.FindViewById<Button>(Resource.Id.loginButton); mRegisterButton = base.FindViewById<Button>(Resource.Id.registerButton); mForgottenPwButton = base.FindViewById<Button>(Resource.Id.forgottenPwButton); mLoginButton.Click += MLoginButton_Click; mRegisterButton.Click += MRegisterButton_Click; mForgottenPwButton.Click += MForgottenPwButton_Click; }
// metoda wywo³ania na stworzenie widoku protected override void OnCreate(Bundle bundle) { //przypisanie widoku AXML do klasy base.OnCreate(bundle); SetContentView(Resource.Layout.Main); // Shared preferences file for storing bearer token for whole app - initialization: preferences = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); editor = preferences.Edit(); //przypisanie kontrolek widoku do zmiennych mMyMessagesButton = base.FindViewById<ImageButton>(Resource.Id.msgImageButton); mFriendsMessagesButton = base.FindViewById<ImageButton>(Resource.Id.friendsMsgImageButton); mMyFriendsButton = base.FindViewById<ImageButton>(Resource.Id.friendsImageButton); mOtherTravelersButton = base.FindViewById<ImageButton>(Resource.Id.travelersImageButton); //metody dla zdarzenia klikniêcia na przycisk mMyMessagesButton.Click += MMyMessagesButton_Click; mFriendsMessagesButton.Click += MFriendsMessagesButton_Click; mMyFriendsButton.Click += MMyFriendsButton_Click; mOtherTravelersButton.Click += MOtherTravelersButton_Click; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.welcome); prefs = GetPreferences (FileCreationMode.Append); firstTime = prefs.GetBoolean (FIRST, true); if (firstTime) { MakeQuestionDB (); MakeScoreDB (); editor = prefs.Edit (); editor.PutBoolean (FIRST, false); editor.Commit (); } Button button = FindViewById<Button> (Resource.Id.btnStarQuiz); button.Click += delegate { StartActivity (typeof(QuizActivity)); Finish (); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.DialogRating, null); var buttonEasy = view.FindViewById<Button>(Resource.Id.buttonEasy); var buttonYester = view.FindViewById<Button>(Resource.Id.buttonYester); var buttonNo = view.FindViewById<Button>(Resource.Id.buttonNo); var preferences = Activity.GetPreferences(FileCreationMode.Private); _editor = preferences.Edit(); buttonEasy.Click += (object sender, EventArgs e) => { var uri = Android.Net.Uri.Parse("market://details?id=" + Activity.PackageName); var goToMarket = new Intent(Intent.ActionView, uri); try { StartActivity(goToMarket); } catch (ActivityNotFoundException) { StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse(@"http://play.google.com/store/apps/details?id=" + Activity.PackageName))); } PutEditor(false); this.Dismiss(); }; buttonYester.Click += (object sender, EventArgs e) => { PutEditor(true); this.Dismiss(); }; buttonNo.Click += (object sender, EventArgs e) => { PutEditor(false); this.Dismiss(); }; return view; }
public ApplicationPreferences(Context context) { _context = context; _prefs = _context.GetSharedPreferences(PREFS_NAME, FileCreationMode.Private); _prefsEditor = _prefs.Edit(); }
protected async override void OnCreate(Bundle savedInstanceState) { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("OTg5ODlAMzEzNzJlMzEyZTMwUG5ONWFZZmdORDJldFd2ZUFIM0QzVWxjWWdGSFlkWW9TMTBZTytvbElzND0="); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); if (prefs.GetString("locale", "") == "") { editor.PutString("locale", "en"); editor.Apply(); } string loc = prefs.GetString("locale", ""); var locale = new Java.Util.Locale(loc); Java.Util.Locale.Default = locale; var config = new Android.Content.Res.Configuration { Locale = locale }; #pragma warning disable CS0618 // Type or member is obsolete BaseContext.Resources.UpdateConfiguration(config, metrics: BaseContext.Resources.DisplayMetrics); #pragma warning restore CS0618 // Type or member is obsolete base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; //ObservableCollection<Client> lst = await apiClient.GetClientsListAsync(); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); //Button loginSendButton = FindViewById<Button>(Resource.Id.loginSendButton); //loginSendButton.Click += async (s, arg) => //{ // CredentialsViewModel credentialViewModel = new CredentialsViewModel(); // var loginEditText = FindViewById<EditText>(Resource.Id.loginEditText); // credentialViewModel.UserName = loginEditText.Text; // var passwordEditText = FindViewById<EditText>(Resource.Id.passwordEditText); // credentialViewModel.Password = passwordEditText.Text; // apiClient = new APIClient(); // string token = await apiClient.Post2Async(credentialViewModel); // ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); // ISharedPreferencesEditor editor = prefs.Edit(); // editor.PutString("auth_token", token); // editor.Apply(); // // var intent = new Intent(this, typeof(HomeActivity)); // //StartActivity(intent); // TextView loginTextView = FindViewById<TextView>(Resource.Id.loginTextView); // loginTextView.Text = token; //}; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); OnImagePicked += (sender, image) => { if (image == null) { return; } AppPreference appPreference = new AppPreference(); CvInvoke.UseOpenCL = appPreference.UseOpenCL; String oclDeviceName = appPreference.OpenClDeviceName; if (!String.IsNullOrEmpty(oclDeviceName)) { CvInvoke.OclSetDefaultDevice(oclDeviceName); } ISharedPreferences preference = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); String appVersion = PackageManager.GetPackageInfo(PackageName, Android.Content.PM.PackageInfoFlags.Activities).VersionName; if (!preference.Contains("cascade-data-version") || !preference.GetString("cascade-data-version", null).Equals(appVersion) || !(preference.Contains("cascade-eye-data-path") || preference.Contains("cascade-face-data-path"))) { AndroidFileAsset.OverwriteMethod overwriteMethod = AndroidFileAsset.OverwriteMethod.AlwaysOverwrite; FileInfo eyeFile = AndroidFileAsset.WritePermanantFileAsset(this, "haarcascade_eye.xml", "cascade", overwriteMethod); FileInfo faceFile = AndroidFileAsset.WritePermanantFileAsset(this, "haarcascade_frontalface_default.xml", "cascade", overwriteMethod); //save tesseract data path ISharedPreferencesEditor editor = preference.Edit(); editor.PutString("cascade-data-version", appVersion); editor.PutString("cascade-eye-data-path", eyeFile.FullName); editor.PutString("cascade-face-data-path", faceFile.FullName); editor.Commit(); } string eyeXml = preference.GetString("cascade-eye-data-path", null); string faceXml = preference.GetString("cascade-face-data-path", null); long time; List <Rectangle> faces = new List <Rectangle>(); List <Rectangle> eyes = new List <Rectangle>(); DetectFace.Detect(image, faceXml, eyeXml, faces, eyes, out time); String computeDevice = CvInvoke.UseOpenCL ? "OpenCL: " + Emgu.CV.Ocl.Device.Default.Name : "CPU"; SetMessage(String.Format("Detected with {1} in {0} milliseconds.", time, computeDevice)); foreach (Rectangle rect in faces) { CvInvoke.Rectangle(image, rect, new Bgr(System.Drawing.Color.Red).MCvScalar, 2); } foreach (Rectangle rect in eyes) { CvInvoke.Rectangle(image, rect, new Bgr(System.Drawing.Color.Blue).MCvScalar, 2); } SetImageBitmap(image.ToBitmap()); image.Dispose(); if (CvInvoke.UseOpenCL) { CvInvoke.OclFinish(); } }; OnButtonClick += (sender, args) => { PickImage("lena.jpg"); }; }
public Settings(Context c) { _sCont = c.GetSharedPreferences(File, 0); _sEdit = _sCont.Edit(); }
void Stations_Downloaded(object sender, DownloadStringCompletedEventArgs e) { SaveStations (e.Result); editor = prefs.Edit (); editor.PutBoolean (FIRST, false); editor.Commit (); }
public void SetPreference <T>(string key, T value) { SharedPreferencesEditor = sharedPreferences.Edit(); SharedPreferencesEditor.PutString(key, value.ToString()); SharedPreferencesEditor.Commit(); }
private void RequestRegister(uint registrationId, IdentityKeyPair identityKeyPair, SignedPreKeyRecord signedPreKey, List <PreKeyRecord> preKeys) { //Send the login username and password to the server and get response string apiUrl = "https://ycandgap.me/api_server2.php"; string apiMethod = "registerUser"; // Login_Request has two properties: username and password Login_Request myLogin_Request = new Login_Request(); myLogin_Request.Username = username.Text; myLogin_Request.Password = password.Text.GetHashCode(); myLogin_Request.RegistrationID = registrationId; myLogin_Request.PublicIdentityKey = JsonConvert.SerializeObject(identityKeyPair.getPublicKey().serialize()); myLogin_Request.PublicSignedPreKeyID = signedPreKey.getId(); myLogin_Request.PublicSignedPreKeySignature = JsonConvert.SerializeObject(signedPreKey.getSignature()); myLogin_Request.PublicSignedPreKey = JsonConvert.SerializeObject(signedPreKey.getKeyPair().getPublicKey().serialize()); // Save in local Database ISharedPreferences sharedprefs = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editor = sharedprefs.Edit(); // Store identityKeyPair somewhere durable and safe. editor.PutString("IdentityKeyPair", JsonConvert.SerializeObject(identityKeyPair.serialize())); editor.PutString("SignedPreKey", JsonConvert.SerializeObject(signedPreKey.serialize())); editor.PutString("Username", username.Text); editor.PutInt("Password", password.Text.GetHashCode()); // Store registrationId somewhere durable and safe. editor.PutString("RegistrationId", registrationId.ToString()); editor.Apply(); // make http post request string response = Http.Post(apiUrl, new NameValueCollection() { { "api_method", apiMethod }, { "api_data", JsonConvert.SerializeObject(myLogin_Request) } }); // decode json string to dto object API_Response r = JsonConvert.DeserializeObject <API_Response>(response); if (r != null) { if (!r.IsError) { foreach (PreKeyRecord preKey in preKeys) { Prekey_Request preKey_Request = new Prekey_Request(); preKey_Request.PublicSignedPreKeyID = signedPreKey.getId(); preKey_Request.PublicPreKeyID = preKey.getId(); preKey_Request.PublicPreKey = JsonConvert.SerializeObject(preKey.getKeyPair().getPublicKey().serialize()); apiMethod = "storePreKeys"; // make http post request string preKeyResponse = Http.Post(apiUrl, new NameValueCollection() { { "api_method", apiMethod }, { "api_data", JsonConvert.SerializeObject(preKey_Request) } }); // decode json string to dto object API_Response preKeyR = JsonConvert.DeserializeObject <API_Response>(preKeyResponse); if (preKeyR == null) { break; } } } } }
public FloatListPreference(Context context, IAttributeSet attrs) : base(context, attrs) { _sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); _sharedPreferencesEditor = _sharedPreferences.Edit(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); userID = Intent.GetStringExtra ("id") ?? "-1"; mainPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); mainEditor = mainPrefs.Edit (); serviceNumer = mainPrefs.GetInt ("service_size", -1); SetContentView (Resource.Layout.Main); tabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); tabHost.Setup (); for (int i = 1; i <= 2; i++) { TabHost.TabSpec tabSpec; tabSpec = tabHost.NewTabSpec("Tab " + i); tabSpec.SetIndicator("Tab " + i); tabSpec.SetContent(new FakeContent(this)); tabHost.AddTab(tabSpec); } tabHost.SetOnTabChangedListener(this); viewPager = FindViewById<ViewPager> (Resource.Id.view); var adaptor = new ServiceBeaconAdapter (SupportFragmentManager); adaptor.addFragmentView ((i, v, b) => { var view = i.Inflate (Resource.Layout.Page, v, false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = myText.Text + "1"; return view; }); adaptor.addFragmentView((i,v,b) => { var view = i.Inflate(Resource.Layout.Page,v,false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = myText.Text + "2"; return view; }); viewPager.Adapter = adaptor;//new ServiceBeaconAdapter (SupportFragmentManager); viewPager.SetOnPageChangeListener(this); beaconStatusLabel = FindViewById<TextView> (Resource.Id.beaconStatusLabel); beaconMgr.Bind (this); //myProcessedBeacons = new JavaDictionary<string,string>(); monitorNotifier.EnterRegionComplete += EnteredRegion; monitorNotifier.ExitRegionComplete += ExitedRegion; rangeNotifier.DidRangeBeaconsInRegionComplete += HandleBeaconsInRegion; }
public Settings(Context c) { _sCont = c.GetSharedPreferences (File, 0); _sEdit = _sCont.Edit (); }
private void UpdateSettings() { sound.sound_settings["Push"] = soundPushCheck.Checked.ToString(); sound.sound_settings["Vibrate"] = soundVibrateCheck.Checked.ToString(); sound.sound_settings["ShowMessage"] = soundshowMessageCheck.Checked.ToString(); var loading = Acr.UserDialogs.UserDialogs.Instance.Loading("Updating Settings..."); string hwid = Android.OS.Build.Serial; var SharedSettings = new Dictionary <String, String>(); var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); String gcmID = prefs.GetString("GCMID", ""); var soundInfo = JsonConvert.SerializeObject(sound); try { if (string.IsNullOrEmpty(micId)) { loading.Hide(); Acr.UserDialogs.UserDialogs.Instance.ErrorToast("Error: Missing ID"); return; } var client = new RestClient(Shared.SERVERURL); var request = new RestRequest("resource/{id}", Method.POST); var parameters = new Dictionary <string, string>(); parameters.Add(Shared.ParamType.REQUEST_CODE, Shared.RequestCode.EDIT_SOUND.ToString()); parameters.Add(Shared.ParamType.WAVIO_ID, micId); parameters.Add(Shared.ParamType.GCM_ID, gcmID); parameters.Add(Shared.ParamType.HWID, hwid); parameters.Add(Shared.ParamType.SOUND_INFO, soundInfo); string requestJson = JsonConvert.SerializeObject(parameters); request.AddParameter(Shared.ParamType.REQUEST, requestJson); Console.WriteLine("Waiting for response"); client.ExecuteAsync(request, response => { ServerResponse serverResponse = JsonConvert.DeserializeObject <ServerResponse>(response.Content); if (serverResponse == null) { loading.Hide(); return; } if (serverResponse.error == Shared.ServerResponsecode.OK) { loading.Hide(); Acr.UserDialogs.UserDialogs.Instance.ShowSuccess("Updated Successfully"); } else if (serverResponse.error == Shared.ServerResponsecode.DATABASE_ERROR) { loading.Hide(); Acr.UserDialogs.UserDialogs.Instance.ShowError("Server error!"); } else { if (serverResponse.request != Shared.RequestCode.EDIT_SOUND) { loading.Hide(); Acr.UserDialogs.UserDialogs.Instance.ShowError("Request type mismatch!"); return; } loading.Hide(); Acr.UserDialogs.UserDialogs.Instance.ShowError("Unknown error!"); } return; }); } catch (WebException ex) { string _exception = ex.ToString(); loading.Hide(); Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); Console.WriteLine("--->" + _exception); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ScrollView scrollView = new ScrollView(this); TextView CALDGStatsView = new TextView(this); scrollView.AddView(CALDGStatsView); SetContentView(scrollView); ISharedPreferences CALDGPref = GetSharedPreferences(CALDG_DATA, FileCreationMode.Private); ISharedPreferencesEditor CALDGEditor = CALDGPref.Edit(); String userInputOne = CALDGPref.GetString("CALDGStatsString0", "0"); String latestAmountOne = CALDGPref.GetString("CALDGStatsString1", "0"); String latestBetOne = CALDGPref.GetString("CALDGStatsString2", "0"); String totalLostOne = CALDGPref.GetString("CALDGStatsString3", "0"); String totalWonOne = CALDGPref.GetString("CALDGStatsString4", "0"); String totalMatchesOne = CALDGPref.GetString("CALDGStatsString5", "0"); String userInputTwo = CALDGPref.GetString("CALDGStatsString6", "0"); String latestAmountTwo = CALDGPref.GetString("CALDGStatsString7", "0"); String latestBetTwo = CALDGPref.GetString("CALDGStatsString8", "0"); String totalLostTwo = CALDGPref.GetString("CALDGStatsString9", "0"); String totalWonTwo = CALDGPref.GetString("CALDGStatsString10", "0"); String totalMatchesTwo = CALDGPref.GetString("CALDGStatsString11", "0"); String userInputThree = CALDGPref.GetString("CALDGStatsString12", "0"); String latestAmountThree = CALDGPref.GetString("CALDGStatsString13", "0"); String latestBetThree = CALDGPref.GetString("CALDGStatsString14", "0"); String totalLostThree = CALDGPref.GetString("CALDGStatsString15", "0"); String totalWonThree = CALDGPref.GetString("CALDGStatsString16", "0"); String totalMatchesThree = CALDGPref.GetString("CALDGStatsString17", "0"); String userInputFour = CALDGPref.GetString("CALDGStatsString18", "0"); String latestAmountFour = CALDGPref.GetString("CALDGStatsString19", "0"); String latestBetFour = CALDGPref.GetString("CALDGStatsString20", "0"); String totalLostFour = CALDGPref.GetString("CALDGStatsString21", "0"); String totalWonFour = CALDGPref.GetString("CALDGStatsString22", "0"); String totalMatchesFour = CALDGPref.GetString("CALDGStatsString23", "0"); String userInputFive = CALDGPref.GetString("CALDGStatsString24", "0"); String latestAmountFive = CALDGPref.GetString("CALDGStatsString25", "0"); String latestBetFive = CALDGPref.GetString("CALDGStatsString26", "0"); String totalLostFive = CALDGPref.GetString("CALDGStatsString27", "0"); String totalWonFive = CALDGPref.GetString("CALDGStatsString28", "0"); String totalMatchesFive = CALDGPref.GetString("CALDGStatsString29", "0"); String userInputSix = CALDGPref.GetString("CALDGStatsString30", "0"); String latestAmountSix = CALDGPref.GetString("CALDGStatsString31", "0"); String latestBetSix = CALDGPref.GetString("CALDGStatsString32", "0"); String totalLostSix = CALDGPref.GetString("CALDGStatsString33", "0"); String totalWonSix = CALDGPref.GetString("CALDGStatsString34", "0"); String totalMatchesSix = CALDGPref.GetString("CALDGStatsString35", "0"); CALDGStatsView.Text = "CHUCK-A-LUCK LATEST GAME SCORES:\n" + "User Input: " + userInputOne + "\n" + "Latest Amount: " + latestAmountOne + "\n" + "Latest Bet: " + latestBetOne + "\n" + "Total Lost: " + totalLostOne + "\n" + "Total Won: " + totalWonOne + "\n" + "Total Matches: " + totalMatchesOne + "\n\n" + "User Input: " + userInputTwo + "\n" + "Latest Amount: " + latestAmountTwo + "\n" + "Latest Bet: " + latestBetTwo + "\n" + "Total Lost: " + totalLostTwo + "\n" + "Total Won: " + totalWonTwo + "\n" + "Total Matches: " + totalMatchesTwo + "\n\n" + "User Input: " + userInputThree + "\n" + "Latest Amount: " + latestAmountThree + "\n" + "Latest Bet: " + latestBetThree + "\n" + "Total Lost: " + totalLostThree + "\n" + "Total Won: " + totalWonThree + "\n" + "Total Matches: " + totalMatchesThree + "\n\n" + "User Input: " + userInputFour + "\n" + "Latest Amount: " + latestAmountFour + "\n" + "Latest Bet: " + latestBetFour + "\n" + "Total Lost: " + totalLostFour + "\n" + "Total Won: " + totalWonFour + "\n" + "Total Matches: " + totalMatchesFour + "\n\n" + "User Input: " + userInputFive + "\n" + "Latest Amount: " + latestAmountFive + "\n" + "Latest Bet: " + latestBetFive + "\n" + "Total Lost: " + totalLostFive + "\n" + "Total Won: " + totalWonFive + "\n" + "Total Matches: " + totalMatchesFive + "\n\n" + "User Input: " + userInputSix + "\n" + "Latest Amount: " + latestAmountSix + "\n" + "Latest Bet: " + latestBetSix + "\n" + "Total Lost: " + totalLostSix + "\n" + "Total Won: " + totalWonSix + "\n" + "Total Matches: " + totalMatchesSix + "\n"; }
public override void OnCreatePreferences(Bundle savedInstanceState, string rootKey) { AddPreferencesFromResource(Resource.Xml.sound_preferences); mRegistrationBroadcastReceiver = new Shared.BroadcastReceiver(); mRegistrationBroadcastReceiver.Receive += (sender, e) => { var reply_error = e.Intent.GetStringExtra("reply_error"); var reply_data = e.Intent.GetStringExtra("reply_data"); if (reply_data == Shared.QueuedDeviceRequestType.NEW_SOUND) { if (reply_error == Shared.ServerResponsecode.OK.ToString()) { if (loading != null) { loading.Hide(); } var intent = new Intent(parent, typeof(MicSoundsActivity)); parent.NavigateUpTo(intent); } else { if (loading != null) { loading.Hide(); } var intent = new Intent(parent, typeof(MicSoundsActivity)); parent.NavigateUpTo(intent); } } if (reply_data == Shared.QueuedDeviceRequestType.DELETE_SOUND) { if (reply_error == Shared.ServerResponsecode.OK.ToString()) { if (loading != null) { loading.Hide(); } var intent = new Intent(parent, typeof(MicSoundsActivity)); parent.NavigateUpTo(intent); } else { if (loading != null) { loading.Hide(); } var intent = new Intent(parent, typeof(MicSoundsActivity)); parent.NavigateUpTo(intent); } } }; LocalBroadcastManager.GetInstance(base.Activity).RegisterReceiver(mRegistrationBroadcastReceiver, new IntentFilter("reply_error")); if (sound.sound_settings == null) { sound.sound_settings = new Dictionary <string, string>(); } //Preference var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); soundPushCheck = FindPreference("sound_push") as Android.Support.V7.Preferences.CheckBoxPreference; soundPushCheck.PreferenceClick += settingsClicked; if (sound.sound_settings.ContainsKey("Push")) { soundPushCheck.Checked = Boolean.Parse(sound.sound_settings["Push"]); } else { sound.sound_settings.Add("Push", true.ToString()); soundPushCheck.Checked = true; } soundVibrateCheck = FindPreference("sound_vibrate") as Android.Support.V7.Preferences.CheckBoxPreference; soundVibrateCheck.PreferenceClick += settingsClicked; if (sound.sound_settings.ContainsKey("Vibrate")) { soundVibrateCheck.Checked = Boolean.Parse(sound.sound_settings["Vibrate"]); } else { sound.sound_settings.Add("Vibrate", true.ToString()); soundVibrateCheck.Checked = true; } soundshowMessageCheck = FindPreference("sound_open") as Android.Support.V7.Preferences.CheckBoxPreference; soundshowMessageCheck.PreferenceClick += settingsClicked; if (sound.sound_settings.ContainsKey("ShowMessage")) { soundshowMessageCheck.Checked = Boolean.Parse(sound.sound_settings["ShowMessage"]); } else { sound.sound_settings.Add("ShowMessage", false.ToString()); soundshowMessageCheck.Checked = false; } deleteSoundButton = FindPreference("sound_delete") as Android.Support.V7.Preferences.PreferenceScreen; deleteSoundButton.PreferenceClick += deleteSound; changeIconButton = FindPreference("sound_icon") as Android.Support.V7.Preferences.PreferenceScreen; changeIconButton.PreferenceClick += changeIcon; }
private void LoadTabs() { try { string json = prefs.GetString("tabs", ""); tabs = Tab.DeSerialize(json); foreach (var tab in tabs) { if (tab.name == "All") { CreateTab("All", "", "0", "1", tab); tab.items = new List <ListElement>(); } else { ActionBar.Tab aTab = ActionBar.NewTab(); aTab.SetText(tab.name); tab.ActionBarTab = aTab; Value[] temp = new Value[tab.include.Count]; tab.include.CopyTo(temp); tab.include.Clear(); foreach (var t in temp) { try { tab.items = new List <ListElement>(); tab.include.Add( parser .GetAllValues() .Where(x => x.name == t.name) .First()); } catch (Exception) { } } ; if (tab.name.Contains("Trip")) { trip = tab.trip == null ? tab.trip = new Trip(false) : tab.trip; } aTab.TabSelected += (sender, args) => { currentTab = tab; if (bluetoothHandler.active) { bluetoothHandler.ChangeFilter(currentTab.include); } ladapter.items = currentTab.GetItems(parser); ladapter.items.Any(x => x.selected = false); gridView1.NumColumns = currentTab.style == 0 ? 1 : currentTab.size; gridView1.Invalidate(); ladapter.NotifyChange(); if (!starting) { editor = prefs.Edit(); editor.PutString("currentTab", currentTab.name); editor.Commit(); } }; ActionBar.AddTab(aTab); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public ConfigurationManager() { sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(Application.Context); sharedPreferencesEditor = sharedPreferences.Edit(); }
private void Menu_MenuItemClick(object sender, PopupMenu.MenuItemClickEventArgs e) { switch (e.Item.ItemId) { /*case Resource.Id.selectionMode: * e.Item.SetChecked( * selectSingle = !e.Item.IsChecked); * return;*/ case Resource.Id.logFast: bool logfast; e.Item.SetChecked( logfast = !e.Item.IsChecked); verifyStoragePermissions(); parser.LogFast(logfast, filePath); bluetoothHandler.ChangeFilter(currentTab.include); if (logfast) { ActionBar.NavigationMode = ActionBarNavigationMode.Standard; } else { ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; } return; //case Resource.Id.logSlow: //e.Item.SetChecked( //selectSingle = !e.Item.IsChecked); //return; case Resource.Id.debugLog: bool l; e.Item.SetChecked( l = !e.Item.IsChecked); verifyStoragePermissions(); bluetoothHandler.Log(l, filePath); return; /*case Resource.Id.hang: * e.Item.SetChecked(!e.Item.IsChecked); * bluetoothHandler.createHangup=!bluetoothHandler.createHangup; * return;*/ /*case Resource.Id.verbose: * e.Item.SetChecked( * bluetoothHandler.verbose = !e.Item.IsChecked); * return;*/ case Resource.Id.metric: e.Item.SetChecked( !(convertToImperial = e.Item.IsChecked)); editor = prefs.Edit(); editor.PutBoolean("convertToImperial", convertToImperial); editor.Commit(); return; case Resource.Id.viewType: currentTab.style++; if (currentTab.style > 2) { currentTab.style = 0; } gridView1.NumColumns = currentTab.style == 0 ? 1 : currentTab.size; gridView1.InvalidateViews(); SaveTabs(); return; case Resource.Id.bigger: if (currentTab.style == 0) { currentTab.size++; } else { currentTab.size--; } if (currentTab.size < 1) { currentTab.size = 1; } gridView1.NumColumns = currentTab.style == 0 ? 1 : currentTab.size; SaveTabs(); return; case Resource.Id.smaller: if (currentTab.style == 0) { currentTab.size--; } else { currentTab.size++; } if (currentTab.size < 1) { currentTab.size = 1; } gridView1.NumColumns = currentTab.style == 0 ? 1 : currentTab.size; SaveTabs(); return; case Resource.Id.bluetoothEnabled: bool bt; e.Item.SetChecked( bt = !e.Item.IsChecked); if (bt) { bluetoothHandler.Initialize(); //bluetoothHandler.ChangeFilter(new string(parser.tagFilter)); } else { bluetoothHandler.Stop(); } return; case Resource.Id.resettrip: parser.ResetTrip(); flagNewTrip = true; bluetoothHandler.ChangeFilter(currentTab.include); //SaveTabs(); return; case Resource.Id.newtrip: //parser.LoadTrip(filePath+ "/TripStart 2017-03-02 21-31-36.xml"); trip = new Trip(false); char c = 'A'; for (int i = 0; i < ActionBar.TabCount; i++) { if (ActionBar.GetTabAt(i).Text.Contains("Trip")) { c++; } } var newTab = CreateTab("Trip " + c, "t", "2", "2"); flagNewTrip = true; ActionBar.SelectTab(newTab.ActionBarTab); //SaveTabs(); return; case Resource.Id.newtab: PopupMenu menu = new PopupMenu(this, menuIcon); menu.Inflate(Resource.Menu.TabsMenu); for (int i = 0; i < tabTitle.GetLength(0); i++) { if (tabTitle[i, 0] != "Trip") { menu.Menu.Add(tabTitle[i, 0]); } } menu.MenuItemClick += (s1, arg1) => { if (arg1.Item.TitleFormatted.ToString() == "Blank") { newTab = CreateTab("New", "0", "0", "1"); ActionBar.SelectTab(newTab.ActionBarTab); } else { for (int i = 0; i < tabTitle.GetLength(0); i++) { if (tabTitle[i, 0] == arg1.Item.TitleFormatted.ToString()) { newTab = CreateTab(tabTitle[i, 0], tabTitle[i, 1], tabTitle[i, 2], tabTitle[i, 3]); ActionBar.SelectTab(newTab.ActionBarTab); break; } } } }; menu.Show(); SaveTabs(); return; case Resource.Id.deletetab: //var pos = tabs.IndexOf(currentTab); tabs.Remove(currentTab); ActionBar.RemoveTab(currentTab.ActionBarTab); /*if (pos >= ActionBar.TabCount) * pos = ActionBar.TabCount-1; * if (pos < 0) * pos = 0; * currentTab = tabs.ElementAtOrDefault(pos); * ActionBar.SelectTab(currentTab.ActionBarTab);*/ SaveTabs(); return; case Resource.Id.paste: currentTab.include.AddRange( from inc in parser.GetAllValues() where clipboard.Any(x => x.name == inc.name) select inc); ladapter.items = currentTab.GetItems(parser); ladapter.NotifyChange(); if (bluetoothHandler.active) { bluetoothHandler.ChangeFilter(currentTab.include); } SaveTabs(); return; case Resource.Id.browse: //ShowDlg("Logs are stored in\n\n"+filePath); Intent intent = new Intent(Intent.ActionGetContent); Android.Net.Uri uri = Android.Net.Uri.Parse(filePath); //intent.PutExtra(Intent.ExtraAllowMultiple,true); intent.SetDataAndType(uri, "*/*"); //StartActivity(Intent.CreateChooser(intent, "Logs")); /*Intent intent = new Intent(Intent.ActionOpenDocumentTree);*/ StartActivityForResult(intent, PICKFILE_REQUEST_CODE); return; case Resource.Id.device: StartActivityForResult(typeof(DeviceListActivity), 1); return; case Resource.Id.resettabs: editor = prefs.Edit(); editor.Remove("tabs"); editor.Commit(); Toast.MakeText(this, "Tabs will be reset on app restart.\nTo undo, edit any tab now", ToastLength.Long).Show(); return; case Resource.Id.resetthrow: ladapter.limits.Clear(); foreach (var item in ladapter.items) { item.UpdateLimits(item.GetValue(false)); } return; case Resource.Id.help: uri = Android.Net.Uri.Parse("https://sites.google.com/view/scanmytesla/changelog"); intent = new Intent(Intent.ActionView, uri); StartActivity(intent); return; } }
// Parse the user data, then permits , user accessing the app private void ParseAndProcess (JsonValue json) { // Extract the array of name/value results for the field name "weatherObservation". JsonValue authResults = json; if (json["idUser"] == null) { AlertDialog.Builder alert = new AlertDialog.Builder (this); /*editLogin.SetError ("",errorIcon); editPassword.SetError ("",errorIcon);*/ alert.SetTitle ("Login Error"); alert.SetMessage ("Mismatched Login and Password"); alert.SetPositiveButton ("Retry", (senderAlert, args) => { //change value write your own set of instructions //you can also create an event for the same in xamarin //instead of writing things here } ); alert.Show (); } else { var userInfo = new UserInfo (); String stringValue = authResults.ToString(); userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo> (stringValue); loginPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); loginEditor = loginPrefs.Edit (); accounts.Add (userInfo.userEmail+"|"+editPassword.Text); foreach (PrivateService pService in userInfo.privateServices) { services.Add (userInfo.idUser+"|"+pService.serviceName+" "+pService.serviceDescription+"|" +pService.locations[0].idLocation); } foreach (Bdp bdp in userInfo.bdps) { devicesBDP.Add (bdp.uuId + "|" + bdp.location.idLocation); } foreach (ServiceCategory serviceCategory in userInfo.serviceCategories) { serviceCategories.Add (serviceCategory.idServiceCategory + "|" + serviceCategory.categoryName); } saveArray (); loginIntent = new Intent (this, typeof(MainActivity)); loginIntent.PutExtra ("id",editPassword.Text.ToString () ); StartActivity (loginIntent); } // Extract the "stationName" (location string) and write it to the location TextBox: //location.Text = weatherResults["stationName"]; }
public PreferenceManager() { pref = App.CurrentActivity.GetPreferences(FileCreationMode.Private); editor = pref.Edit(); }
private void EditCurrentCustomer(int position, ViewHolder holder) { string rowName = holder.FullName.Text; //AlertDialog.Builder alertDialog = new AlertDialog.Builder(_mContex); //alertDialog.SetTitle("Потвърждавате ли редакцията ? "); //alertDialog.SetMessage($"Редактирай клиент {holder.FullName.Text}"); //alertDialog.SetCancelable(false); // may click outside the dialog FragmentTransaction trans = ((Activity)_mContex).FragmentManager.BeginTransaction(); EditFragment editFragmentDialog = new EditFragment(position, _customers.Count, holder.NewCharge, holder.LateBil, holder.Report); //new EditFragment(position, _customers.Count, holder.ReceiveNotifyNewInvoiceToday, holder.ReceiveNotifyInvoiceOverdueToday, holder.ReciveNotifyReadingToday); editFragmentDialog.Show(trans, "edit fragment"); editFragmentDialog.OnEditCustomerComplete += (object sender1, OnEditCustomerEventArgs e1) => { //countНotifyReadingustomers = GetNotifyReadingCustomers(); //countNewНotifyNewInvoiceCustomers = GetCountNewНotifyNewInvoiceCustomers(); //countНotifyInvoiceOverdueCustomers = GetCountНotifyInvoiceOverdueCustomers(); // mCustomerFromApi = GetCustomersFromApi(); holder.NewCharge = e1.IsThereANewCharge; holder.LateBil = e1.IsThereALateBill; holder.Report = e1.IsThereAReport; // save to json ISharedPreferences pref = Application.Context.GetSharedPreferences("PREFERENCE_NAME", FileCreationMode.Private); ISharedPreferencesEditor editor = pref.Edit(); //editor.Clear(); editor.Remove("Customers"); editor.Commit(); Customer updateCustomer = _customers[position]; updateCustomer.NotifyNewInvoice = e1.IsThereANewCharge; updateCustomer.NotifyInvoiceOverdue = e1.IsThereALateBill; updateCustomer.NotifyReading = e1.IsThereAReport; #region CheckPossition _customers.RemoveAt(position); //new count -1 _customers.Insert(e1.CurrentPossition, updateCustomer); // put in the same posstion NotifyDataSetChanged(); #endregion string edtListOfCustomers = JsonConvert.SerializeObject(_customers); editor.PutString("Customers", edtListOfCustomers); editor.Commit(); editor.Commit(); }; //alertDialog.SetPositiveButton("Да", delegate //{ // Android.Widget.Toast.MakeText(_mContex, "Редактиране " + rowName, Android.Widget.ToastLength.Long).Show(); //}); //alertDialog.SetNeutralButton("Не", delegate //{ // alertDialog.Dispose(); //}); // alertDialog.Show(); }
public SharedPreferencesService() { _prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); _editor = _prefs.Edit(); }
private PreferenceManager() { prefs = Application.Context.GetSharedPreferences("app-prefs", FileCreationMode.Private); editor = prefs.Edit(); }
public ISharedPreferencesEditor editor_preferencias; //Habilita la opcion para editar las preferencias public AppPersistence(Activity _activity) { this.activity = _activity; preferencias = activity.GetSharedPreferences("NOTEDROID_PREF", FileCreationMode.Private); editor_preferencias = preferencias.Edit(); }
protected override void OnCreate(Bundle savedInstanceState) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); long usageCount = prefs.GetLong(GetString(Resource.String.UsageCount_key), 0); ISharedPreferencesEditor edit = prefs.Edit(); edit.PutLong(GetString(Resource.String.UsageCount_key), usageCount + 1); edit.Commit(); _showPassword = !prefs.GetBoolean(GetString(Resource.String.maskpass_key), Resources.GetBoolean(Resource.Boolean.maskpass_default)); RequestWindowFeature(WindowFeatures.IndeterminateProgress); _activityDesign.ApplyTheme(); base.OnCreate(savedInstanceState); SetEntryView(); Database db = App.Kp2a.GetDb(); // Likely the app has been killed exit the activity if (!db.Loaded || (App.Kp2a.QuickLocked)) { Finish(); return; } SetResult(KeePass.ExitNormal); Intent i = Intent; PwUuid uuid = new PwUuid(MemUtil.HexStringToByteArray(i.GetStringExtra(KeyEntry))); _pos = i.GetIntExtra(KeyRefreshPos, -1); _appTask = AppTask.GetTaskInOnCreate(savedInstanceState, Intent); Entry = db.Entries[uuid]; // Refresh Menu contents in case onCreateMenuOptions was called before Entry was set ActivityCompat.InvalidateOptionsMenu(this); // Update last access time. Entry.Touch(false); if (PwDefs.IsTanEntry(Entry) && prefs.GetBoolean(GetString(Resource.String.TanExpiresOnUse_key), Resources.GetBoolean(Resource.Boolean.TanExpiresOnUse_default)) && ((Entry.Expires == false) || Entry.ExpiryTime > DateTime.Now)) { PwEntry backupEntry = Entry.CloneDeep(); Entry.ExpiryTime = DateTime.Now; Entry.Expires = true; Entry.Touch(true); RequiresRefresh(); UpdateEntry update = new UpdateEntry(this, App.Kp2a, backupEntry, Entry, null); ProgressTask pt = new ProgressTask(App.Kp2a, this, update); pt.Run(); } FillData(); SetupEditButtons(); App.Kp2a.GetDb().LastOpenedEntry = new PwEntryOutput(Entry, App.Kp2a.GetDb().KpDatabase); _pluginActionReceiver = new PluginActionReceiver(this); RegisterReceiver(_pluginActionReceiver, new IntentFilter(Strings.ActionAddEntryAction)); _pluginFieldReceiver = new PluginFieldReceiver(this); RegisterReceiver(_pluginFieldReceiver, new IntentFilter(Strings.ActionSetEntryField)); new Thread(NotifyPluginsOnOpen).Start(); //the rest of the things to do depends on the current app task: _appTask.CompleteOnCreateEntryActivity(this); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.fragment_nohin_kaisyu_matehan, container, false); prefs = PreferenceManager.GetDefaultSharedPreferences(Context); editor = prefs.Edit(); // DB helper nohinMateHelper = new SndNohinMateHelper(); mateFileHelper = new MateFileHelper(); // コンポーネント初期化 SetTitle("マテハン回収"); SetFooterText(""); _VendorNameTextView = view.FindViewById <TextView>(Resource.Id.txt_nohinKaisyuMatehan_vendorName); matehan1Nm = view.FindViewById <TextView>(Resource.Id.txt_nohinKaisyuMatehan_matehan1); matehan2Nm = view.FindViewById <TextView>(Resource.Id.txt_nohinKaisyuMatehan_matehan2); matehan3Nm = view.FindViewById <TextView>(Resource.Id.txt_nohinKaisyuMatehan_matehan3); matehan4Nm = view.FindViewById <TextView>(Resource.Id.txt_nohinKaisyuMatehan_matehan4); matehan1Su = view.FindViewById <BootstrapEditText>(Resource.Id.et_nohinKaisyuMatehan_matehan1); matehan2Su = view.FindViewById <BootstrapEditText>(Resource.Id.et_nohinKaisyuMatehan_matehan2); matehan3Su = view.FindViewById <BootstrapEditText>(Resource.Id.et_nohinKaisyuMatehan_matehan3); matehan4Su = view.FindViewById <BootstrapEditText>(Resource.Id.et_nohinKaisyuMatehan_matehan4); BootstrapButton _ConfirmButton = view.FindViewById <BootstrapButton>(Resource.Id.btn_nohinKaisyuMatehan_confirm); _ConfirmButton.Click += delegate { ConfirmMatehanKaisyu(); }; BootstrapButton _VendorSearchButton = view.FindViewById <BootstrapButton>(Resource.Id.vendorSearch); _VendorSearchButton.Click += delegate { editor.PutBoolean("kounaiFlag", false); editor.Apply(); StartFragment(FragmentManager, typeof(KosuVendorAllSearchFragment)); }; _VendorCdEditText = view.FindViewById <BootstrapEditText>(Resource.Id.et_nohinKaisyuMatehan_vendorCode); _VendorCdEditText.KeyPress += (sender, e) => { if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { e.Handled = true; matehanList = mateFileHelper.SelectByVendorCd(_VendorCdEditText.Text); if (matehanList.Count == 0) { ShowDialog("エラー", "ベンダーコードが存在しません。", () => { _VendorCdEditText.Text = motoVendorCd; _VendorCdEditText.RequestFocus(); }); return; } else { SetMateVendorInfo(_VendorCdEditText.Text); motoVendorCd = _VendorCdEditText.Text; _VendorNameTextView.Text = matehanList[0].vendor_nm; editor.PutString("mate_vendor_cd", _VendorCdEditText.Text); editor.PutString("mate_vendor_nm", matehanList[0].vendor_nm); editor.Apply(); } } else { e.Handled = false; } }; return(view); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); userID = Intent.GetStringExtra ("id") ?? "-1"; mainPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); mainEditor = mainPrefs.Edit (); serviceNumer = mainPrefs.GetInt ("service_size", -1); categoryNumber = mainPrefs.GetInt ("category_size", 0); SetContentView (Resource.Layout.Main); tabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); tabHost.Setup (); for (int i = 0; i < categoryNumber; i++) { TabHost.TabSpec tabSpec; tabSpec = tabHost.NewTabSpec(mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower()); tabSpec.SetIndicator(mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower()); tabSpec.SetContent(new FakeContent(this)); tabHost.AddTab(tabSpec); } tabHost.SetOnTabChangedListener(this); setSelectedTabColor (); /*for(int i = 0; i < tabHost.TabWidget.ChildCount; i++) { View v = tabHost.TabWidget.GetChildTabViewAt(i); // Look for the title view to ensure this is an indicator and not a divider. v.SetBackgroundResource(Resource.Drawable.apptheme_tab_indicator_holo); }*/ viewPager = FindViewById<ViewPager> (Resource.Id.view); var adaptor = new ServiceBeaconAdapter (SupportFragmentManager); for (int i = 0; i < categoryNumber; i++) { adaptor.addFragmentView ((k, v, b) => { var view = k.Inflate (Resource.Layout.Page, v, false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower(); return view; }); } viewPager.Adapter = adaptor;//new ServiceBeaconAdapter (SupportFragmentManager); viewPager.SetOnPageChangeListener(this); beaconStatusLabel = FindViewById<TextView> (Resource.Id.beaconStatusLabel); beaconMgr.Bind (this); //myProcessedBeacons = new JavaDictionary<string,string>(); monitorNotifier.EnterRegionComplete += EnteredRegion; monitorNotifier.ExitRegionComplete += ExitedRegion; rangeNotifier.DidRangeBeaconsInRegionComplete += HandleBeaconsInRegion; }
public AppPreferences() { sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); prefsEditor = sharedPrefs.Edit(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); Intent arrivalActivity = new Intent(this, typeof(ArrivalActivity)); btnSubmit = FindViewById <Button>(Resource.Id.btnSubmit); inputHours = FindViewById <EditText>(Resource.Id.inputHours); inputMinutes = FindViewById <EditText>(Resource.Id.inputMinutes); inputLength = FindViewById <EditText>(Resource.Id.inputLength); btnSubmit.Click += delegate { ISharedPreferencesEditor editor = prefs.Edit(); editor.PutString("hours", inputHours.Text); editor.PutString("minutes", inputMinutes.Text); editor.PutString("length", inputLength.Text); //write key pairs to SP editor.Apply(); StartActivity(arrivalActivity); }; inputHours.TextChanged += delegate { try { if (int.Parse(inputHours.Text.ToString()) > 23) { Toast.MakeText(this, "Hours must be equal to 23 or smaller", ToastLength.Short).Show(); } } catch (Exception e) { } }; inputMinutes.TextChanged += delegate { try { if (int.Parse(inputMinutes.Text.ToString()) > 59) { Toast.MakeText(this, "Minutes must be equal to 59 or smaller", ToastLength.Short).Show(); } } catch (Exception e) { } }; inputLength.TextChanged += delegate { try { if (int.Parse(inputLength.Text.ToString()) > 1500) { Toast.MakeText(this, "Length must be equal to 1500 or smaller", ToastLength.Short).Show(); } } catch (Exception e) { } }; }
/// <summary> /// Initializes a new instance of the <see cref="PortaPodder.ObscuredSharedPreferences+Editor"/> class. /// </summary> public EncryptedEditor(EncryptedPreferences parent) { this.childEditor = parent.child.Edit(); }
private void RequestCheckMicOnline(PostMicCheck post) { Acr.UserDialogs.UserDialogs.Instance.Loading("Checking mic status..."); string hwid = Android.OS.Build.Serial; var SharedSettings = new Dictionary <String, String>(); var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); String gcmID = prefs.GetString("GCMID", ""); var micTimeout = float.Parse(prefs.GetString("mic_timeout", "10000")); try { if (string.IsNullOrEmpty(micId)) { Acr.UserDialogs.UserDialogs.Instance.ErrorToast("Error: No ID given!"); //AndHUD.Shared.ShowError(_context, "Error: No ID given!", AndroidHUD.MaskType.Black, TimeSpan.FromSeconds(2)); return; } var client = new RestClient(Shared.SERVERURL); var request = new RestRequest("resource/{id}", Method.POST); var parameters = new Dictionary <string, string>(); parameters.Add(Shared.ParamType.REQUEST_CODE, Shared.RequestCode.GET_LAST_ALIVE.ToString()); parameters.Add(Shared.ParamType.WAVIO_ID, micId); parameters.Add(Shared.ParamType.GCM_ID, gcmID); parameters.Add(Shared.ParamType.HWID, hwid); string requestJson = JsonConvert.SerializeObject(parameters); request.AddParameter(Shared.ParamType.REQUEST, requestJson); Console.WriteLine("Waiting for response"); client.ExecuteAsync(request, response => { ServerResponse serverResponse = JsonConvert.DeserializeObject <ServerResponse>(response.Content); if (serverResponse == null) { Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); return; } if (serverResponse.error == Shared.ServerResponsecode.OK) { double nowInMs = DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; double micTime = double.Parse(serverResponse.data); double difference = nowInMs - micTime; if (Math.Abs(difference) < micTimeout) //time travel and whatnot { if (post == PostMicCheck.AddSound) { } else if (post == PostMicCheck.DeleteSound) { RequestDeleteSound(); } else if (post == PostMicCheck.EditSound) { } } else { Acr.UserDialogs.UserDialogs.Instance.ShowError("Mic is offline!"); } } else if (serverResponse.error == Shared.ServerResponsecode.DATABASE_ERROR) { Acr.UserDialogs.UserDialogs.Instance.ShowError("Server error!"); } else { if (serverResponse.request != Shared.RequestCode.GET_LAST_ALIVE) { Acr.UserDialogs.UserDialogs.Instance.ShowError("Request type mismatch!"); return; } Acr.UserDialogs.UserDialogs.Instance.ShowError("Unknown error!"); } Acr.UserDialogs.UserDialogs.Instance.HideLoading(); return; }); } catch (WebException ex) { string _exception = ex.ToString(); Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); Console.WriteLine("--->" + _exception); } }
public Security_Android() { _preferences = Forms.Context.GetSharedPreferences(_keyChainServiceName, FileCreationMode.Private); _preferenceEditor = _preferences.Edit(); }
//private ReportDataService reportDataService; public FormSignature(Context context, ReportElement element, string section, int userID, int ownerID, int verifierID, string formType, ReportStatus statusReport, List <ReportElement> elementList) : base(context) { contextx = context; ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor sharedPreferencesEditor = sharedPreferences.Edit(); cameraIndicatorView = new List <ImageView>(); cameraPreviewView = new List <GridView>(); //reportDataService = rds; RelativeLayout theme = new FormTheme(context, element.Title); LinearLayout btnLayer = new LinearLayout(context); btnLayer.Orientation = Orientation.Vertical; var sign = new ImageButton(context); sign.Id = element.Id; var line = new ImageView(context); line.SetBackgroundResource(Resource.Drawable.dottedlines); LayoutParams parmsofline = new LayoutParams( ViewGroup.LayoutParams.MatchParent, 1); line.LayoutParameters = parmsofline; LayoutParams parms = new LayoutParams(ViewGroup.LayoutParams.WrapContent, 300); sign.LayoutParameters = parms; string img = element.Value; string sdCardPath = Environment.ExternalStorageDirectory.AbsolutePath; string sigPath = Path.Combine(sdCardPath, "Checkd/" + img); File file = new File(sigPath); sign.SetBackgroundResource(Resource.Drawable.ic_signature); //sign.SetBackgroundResource(0); if (img == "empty" || string.IsNullOrEmpty(img)) { sign.Tag = ""; } else { sign.Tag = img; if (file.Exists()) { SetImage(sigPath, sign); } else { DownloadImage(img, sigPath, sign); } } ImageView indicatorImage = (ImageView)theme.GetChildAt(1); activateElementInfo(element, theme); int artificial_ID = SIGNATURE_INDICATOR_ID + element.Id; indicatorImage.Id = artificial_ID; cameraIndicatorView.Add(indicatorImage); cameraPreviewView.Add(new GridView(contextx)); if (!element.Value.Equals("")) { indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium); } if (ownerID == 0 || ownerID == userID) { if (verifierID != 0) { sign.Enabled = false; sign.Clickable = false; if (statusReport == ReportStatus.Rejected) { sign.Enabled = true; sign.Clickable = true; } } else { sign.Enabled = true; sign.Clickable = true; } } else { sign.Enabled = false; sign.Clickable = false; } sign.Click += (sender, e) => { sharedPreferencesEditor.PutString("ImageButtonID", element.Id + ""); sharedPreferencesEditor.PutString("ImageButtonType", section); sharedPreferencesEditor.Commit(); string filePath = Path.Combine(sdCardPath, "Checkd/signature_" + Guid.NewGuid() + ".jpg"); Intent intent = new Intent(context, typeof(SignatureActivity)); intent.PutExtra("URI", filePath); intent.PutExtra("ElementList", JsonConvert.SerializeObject(elementList)); ((Activity)contextx).StartActivityForResult(intent, 2); }; isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false); if (isArcheived) { sign.Clickable = false; } btnLayer.AddView(theme); btnLayer.AddView(sign); btnLayer.AddView(line); btnLayer.SetPadding(45, 10, 45, 20); AddView(btnLayer); }
public SettingsService() { _sharedPreferences = Application.Context.GetSharedPreferences(AppConstants.AppName, FileCreationMode.Private); _sharedPreferencesEditor = _sharedPreferences.Edit(); }
protected override void OnCreate(Bundle savedInstanceState) { try { ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editorDevis = sharedPreferences.Edit(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CreationClient2); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); //SupportActionBar.SetDisplayHomeAsUpEnabled(true); //SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); toolbar.Title = "Information Bancaire"; nombanque = FindViewById <EditText>(Resource.Id.textInputEditTextNombanque); Bic = FindViewById <EditText>(Resource.Id.textInputEditTextBIC); IBAN = FindViewById <EditText>(Resource.Id.textInputEditTextIBAN); ad1 = FindViewById <AdView>(Resource.Id.adView1banqe); ad2 = FindViewById <AdView>(Resource.Id.adView2banqe); devisespinner = FindViewById <Spinner>(Resource.Id.spinnerDevis); var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Devise, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); devisespinner.Adapter = adapter; devisespinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); buttonsuivantbanque = FindViewById <Button>(Resource.Id.buttonsuivantbbanque); var btnp = FindViewById <Button>(Resource.Id.buttonPrecedant); nombanque.Text = sharedPreferences.GetString("Nombanque", ""); Bic.Text = sharedPreferences.GetString("Bic", ""); IBAN.Text = sharedPreferences.GetString("IBAN", ""); int d = adapter.GetPosition(sharedPreferences.GetString("Devis", "")); devisespinner.SetSelection(d); btnp.Click += delegate { Intent intent = new Intent(this, typeof(CreationClient1)); editorDevis.PutString("Nom", sharedPreferences.GetString("Nom", "")); editorDevis.PutString("Email", sharedPreferences.GetString("Email", "")); editorDevis.PutString("Tel", sharedPreferences.GetString("Tel", "")); editorDevis.PutString("Adresse", sharedPreferences.GetString("Adresse", "")); editorDevis.PutString("CodePostal", sharedPreferences.GetString("CodePostal", "")); editorDevis.PutString("Ville", sharedPreferences.GetString("Ville", "")); editorDevis.PutString("Pays", sharedPreferences.GetString("Pays", "")); editorDevis.PutString("Nombanque", nombanque.Text); editorDevis.PutString("Bic", Bic.Text); editorDevis.PutString("IBAN", IBAN.Text); editorDevis.PutString("Devise", toast); editorDevis.Apply(); StartActivity(intent); }; buttonsuivantbanque.Click += delegate { editorDevis.PutString("Nom", sharedPreferences.GetString("Nom", "")); editorDevis.PutString("Email", sharedPreferences.GetString("Email", "")); editorDevis.PutString("Tel", sharedPreferences.GetString("Tel", "")); editorDevis.PutString("Adresse", sharedPreferences.GetString("Adresse", "")); editorDevis.PutString("CodePostal", sharedPreferences.GetString("CodePostal", "")); editorDevis.PutString("Ville", sharedPreferences.GetString("Ville", "")); editorDevis.PutString("Pays", sharedPreferences.GetString("Pays", "")); editorDevis.PutString("Nombanque", nombanque.Text); editorDevis.PutString("Bic", Bic.Text); editorDevis.PutString("IBAN", IBAN.Text); editorDevis.PutString("Devise", toast); editorDevis.Apply(); Intent intent = new Intent(this, typeof(CreationClient3)); StartActivity(intent); }; } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } // Create your application here }
static Settings() { SharedPreferences = Application.Context.GetSharedPreferences(PrefName, FileCreationMode.Private); SharedPreferencesEditor = SharedPreferences.Edit(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); ISharedPreferences prefs = Application.Context.GetSharedPreferences("TEST_PREF", FileCreationMode.Private); // Tracking Users EditText userIdEditText = FindViewById <EditText>(Resource.Id.userIdEditText); userId = prefs.GetString("userid", ""); userIdEditText.Text = userId; Button loginButton = FindViewById <Button>(Resource.Id.loginButton); if (userId.Equals("")) { loginButton.Text = "LOGIN"; } else { loginButton.Text = "LOGOUT"; } loginButton.Click += delegate { if (loginButton.Text.Equals("LOGIN")) { userId = userIdEditText.Text.ToString(); if (!userId.Equals("")) { ISharedPreferencesEditor editor = prefs.Edit(); editor.PutString("userid", userId); editor.Apply(); loginButton.Text = "LOGOUT"; // Login WebEngage.Get().User().Login(userId); } } else { ISharedPreferencesEditor editor = prefs.Edit(); editor.PutString("userid", ""); editor.Apply(); loginButton.Text = "LOGIN"; userIdEditText.Text = ""; // Logout WebEngage.Get().User().Logout(); } }; // System user attributes EditText emailEditText = FindViewById <EditText>(Resource.Id.emailEditText); Button emailButton = FindViewById <Button>(Resource.Id.emailButton); emailButton.Click += delegate { string email = emailEditText.Text.ToString(); if (!email.Equals("")) { WebEngage.Get().User().SetEmail(email); Toast.MakeText(this.ApplicationContext, "Email set successfully", ToastLength.Long).Show(); } }; Spinner genderSpinner = FindViewById <Spinner>(Resource.Id.genderSpinner); var adapter = ArrayAdapter.CreateFromResource( this, Resource.Array.gender_array, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); genderSpinner.Adapter = adapter; Button genderButton = FindViewById <Button>(Resource.Id.genderButton); genderButton.Click += delegate { int spinnerPosition = genderSpinner.SelectedItemPosition; Gender gender = Gender.Male; if (spinnerPosition == 0) { gender = Gender.Male; } else if (spinnerPosition == 1) { gender = Gender.Female; } else if (spinnerPosition == 2) { gender = Gender.Other; } WebEngage.Get().User().SetGender(gender); Toast.MakeText(this.BaseContext, "Gender set successfully", ToastLength.Long).Show(); }; //WebEngage.Get().User().SetBirthDate("1994-04-29"); //WebEngage.Get().User().SetFirstName("John"); //WebEngage.Get().User().SetLastName("Doe"); //WebEngage.Get().User().SetCompany("WebEngage"); //WebEngage.Get().User().SetPhoneNumber("+551155256325"); //WebEngage.Get().User().SetHashedPhoneNumber("e0ec043b3f9e198ec09041687e4d4e8d"); //WebEngage.Get().User().SetHashedEmail("144e0424883546e07dcd727057fd3b62"); // Channels //WebEngage.Get().User().SetOptIn(Channel.Whatsapp, true); //WebEngage.Get().User().SetOptIn(Channel.Email, true); //WebEngage.Get().User().SetOptIn(Channel.Sms, true); //WebEngage.Get().User().SetOptIn(Channel.Push, true); //WebEngage.Get().User().SetOptIn(Channel.InApp, true); // Custom user attributes //WebEngage.Get().User().SetAttribute("age", (Java.Lang.Integer)23); //WebEngage.Get().User().SetAttribute("premium", (Boolean)true); //WebEngage.Get().User().SetAttribute("last_seen", new Date("2018-12-25")); //IDictionary<string, Object> customAttributes = new Dictionary<string, Object>(); //customAttributes.Add("Twitter Email", "*****@*****.**"); //customAttributes.Add("Subscribed", true); //WebEngage.Get().User().SetAttributes(customAttributes); //WebEngage.Get().User().DeleteAttribute("age"); //WebEngage.Get().SetLocationTrackingStrategy(LocationTrackingStrategy.AccuracyCity); //WebEngage.Get().User().SetLocation(12.23, 12.45); //IList<Object> brandAffinity = new List<Object> //{ // "Hugo Boss", // "Armani Exchange", // "GAS", // "Brooks Brothers" //}; //WebEngage.Get().User().SetAttribute("Brand affinity", brandAffinity); //JavaDictionary<string, Object> address = new JavaDictionary<string, Object> //{ // { "Flat", "Z-62" }, // { "Building", "Pennant Court" }, // { "Locality", "Penn Road" }, // { "City", "Wolverhampton" }, // { "State", "West Midlands" }, // { "PIN", "WV30DT" } //}; //IDictionary<string, Object> customAttributes = new Dictionary<string, Object>(); //customAttributes.Add("Address", address); //WebEngage.Get().User().SetAttributes(customAttributes); // Tracking Events EditText eventEditText = FindViewById <EditText>(Resource.Id.eventEditText); Button trackButton = FindViewById <Button>(Resource.Id.trackButton); trackButton.Click += delegate { string eventName = eventEditText.Text; if (!eventName.Equals("")) { WebEngage.Get().Analytics().Track(eventName, new Analytics.Options().SetHighReportingPriority(false)); Toast.MakeText(this.BaseContext, "Event tracked successfully", ToastLength.Long).Show(); } }; // Tracking Event with Attributes //IDictionary<string, Object> attributes = new Dictionary<string, Object> //{ // { "id", "~123" }, // { "price", 100 }, // { "discount", true } //}; //WebEngage.Get().Analytics().Track("Product Viewed", attributes, new Analytics.Options().SetHighReportingPriority(false)); Button shopButton = FindViewById <Button>(Resource.Id.shopButton); shopButton.Click += delegate { // Tracking Complex Events IDictionary <string, Object> product1 = new JavaDictionary <string, Object>(); product1.Add("SKU Code", "UHUH799"); product1.Add("Product Name", "Armani Jeans"); product1.Add("Price", 300.49); JavaDictionary <string, Object> detailsProduct1 = new JavaDictionary <string, Object>(); detailsProduct1.Add("Size", "L"); product1.Add("Details", detailsProduct1); IDictionary <string, Object> product2 = new JavaDictionary <string, Object>(); product2.Add("SKU Code", "FBHG746"); product2.Add("Product Name", "Hugo Boss Jacket"); product2.Add("Price", 507.99); JavaDictionary <string, Object> detailsProduct2 = new JavaDictionary <string, Object>(); detailsProduct2.Add("Size", "L"); product2.Add("Details", detailsProduct2); IDictionary <string, Object> deliveryAddress = new JavaDictionary <string, Object>(); deliveryAddress.Add("City", "San Francisco"); deliveryAddress.Add("ZIP", "94121"); JavaDictionary <string, Object> orderPlacedAttributes = new JavaDictionary <string, Object>(); JavaList <Object> products = new JavaList <Object>(); products.Add(product1); products.Add(product2); JavaList <string> coupons = new JavaList <string>(); coupons.Add("BOGO17"); orderPlacedAttributes.Add("Products", products); orderPlacedAttributes.Add("Delivery Address", deliveryAddress); orderPlacedAttributes.Add("Coupons Applied", coupons); WebEngage.Get().Analytics().Track("Order Placed", orderPlacedAttributes, new Analytics.Options().SetHighReportingPriority(false)); Toast.MakeText(this.BaseContext, "Order Placed successfully", ToastLength.Long).Show(); }; Button locationButton = FindViewById <Button>(Resource.Id.locationButton); locationButton.Click += delegate { requestLocationPermission(); }; Button nextButton = FindViewById <Button>(Resource.Id.nextButton); nextButton.Click += delegate { StartActivity(typeof(NextActivity)); }; }
void RadioButtonClick(object sender, EventArgs e) { var radio = sender as RadioButton; switch (radio.Id) { case Resource.Id.rbArrival: radio.Typeface = kalingab; rbDepart.Typeface = kalinga; tSel = false; break; default: radio.Typeface = kalingab; rbArrive.Typeface = kalinga; tSel = true; break; } rbDepart.Checked = tSel; rbArrive.Checked = !tSel; editor = prefs.Edit (); editor.PutBoolean (TIMESEL, tSel); editor.Commit (); }
public AppPreferences(Context context) { this.mContext = context; mSharedPrefs = PreferenceManager.GetDefaultSharedPreferences(mContext); mPrefsEditor = mSharedPrefs.Edit(); }
private void ListItemClicked(int position) { Android.Support.V4.App.Fragment fragment = null; switch (position) { case 0: fragment = new HomeFragment(); break; case 1: fragment = new ProfileFragment(); break; case 2: fragment = new PaymentFragment(); break; case 3: fragment = new FAQFragment(); break; case 4: fragment = new ContactUSFragment(); break; case 5: new Android.Support.V7.App.AlertDialog.Builder(this) .SetIcon(Resource.Drawable.ic_alert) .SetTitle("Closing Activity") .SetMessage("Are you sure you want to Log Out?") .SetPositiveButton("Yes", (c, ev) => { ISharedPreferences pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); edit.PutString("Username", String.Empty); edit.PutBoolean("SignedIn", false); edit.Apply(); var activity = (Activity)this; activity.FinishAffinity(); }) .SetNegativeButton("No", (c, ev) => { }) .Show(); break; case 6: fragment = new CurrentOrderFragment(); break; case 7: fragment = new MyOrdersFragment(); break; case 8: fragment = new MakeARequestFragment(); break; } if (fragment != null) { SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.content_frame, fragment) .Commit(); } }
private AppConfig() { m_Read=Android.App.Application.Context.GetSharedPreferences("AppSetting", FileCreationMode.Private); m_Edit=m_Read.Edit(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Cuestionario); opciones = GetSharedPreferences(Legalproprefs, 0); if (opciones.GetString("nm_opr", "").Length == 0) { Intent intent = new Intent(this.ApplicationContext, typeof(MainActivity)); StartActivity(intent); } anexos = true; anexo_seleccionado = 0; db = new sqlite_database_movements(); id_formato = Intent.GetIntExtra("id_formato", 0); lista = new List <lapregunta>(); if (id_formato == 0) { FindViewById <ImageView>(Resource.Id.g_nube).Visibility = ViewStates.Gone; FindViewById <TextView>(Resource.Id.terminado).Visibility = ViewStates.Gone; modelo = Intent.GetStringExtra("modelo") ?? ""; id_formato = Intent.GetIntExtra("id_formato", 0); id_modelo = Intent.GetIntExtra("id_modelo", 0); Cuestionarios actual = db.get_cuestionarioS(id_modelo, opciones.GetInt("instancia", 0), opciones.GetString("db", "")); imagen = FindViewById <ImageView>(Resource.Id.siguiente); imagen.Click += (s, e) => { if (anexos) { ListView listaaa = FindViewById <ListView>(Resource.Id.listaa); listaaa.Visibility = ViewStates.Visible; FindViewById <ListView>(Resource.Id.listam).Visibility = ViewStates.Gone; anexos = false; } else { ListView listaaa = FindViewById <ListView>(Resource.Id.listaa); listaaa.Visibility = ViewStates.Gone; FindViewById <ListView>(Resource.Id.listam).Visibility = ViewStates.Visible; anexos = true; } }; imagen = FindViewById <ImageView>(Resource.Id.guardar); imagen.Click += (s, e) => { Guardados guardar = new Guardados(); var builder = new AlertDialog.Builder(this); builder.SetTitle("Guardar en local"); LayoutInflater inflater = LayoutInflater.From(this); View dialogview = inflater.Inflate(Resource.Layout.lista2, null); TextView titulo; EditText editText = dialogview.FindViewById <EditText>(Resource.Id.resultado); editText.Text = ""; editText.SetTextColor(Color.White); editText.Focusable = true; editText.FocusableInTouchMode = true; dialogview.FindViewById <LinearLayout>(Resource.Id.templatt).SetBackgroundColor(Color.Transparent); titulo = dialogview.FindViewById <TextView>(Resource.Id.titulo); titulo.Text = "Nombre del tramite"; titulo.SetTextColor(Android.Graphics.Color.White); builder.SetView(dialogview); builder.SetPositiveButton("Aceptar", (sender2, args) => { if (editText.Text.Length == 0) { guardar.nombre = "Nuevo " + modelo; } else { guardar.nombre = modelo + " " + editText.Text; } guardar.guardado = 0; guardar.usuario = opciones.GetInt("id_opr", 0); guardar.xml = JsonConvert.SerializeObject(cuestionarioactual);//se guarda el cuestionario guardar.id_modelo = id_modelo; guardar.nm_modelo = modelo; guardar.container = "LegalPro Produccion/" + opciones.GetString("nm_str", "") + "/" + opciones.GetInt("instancia", 0) + "/"; guardar.containe2r = "LegalPro Produccion/"; guardar.id_instancia = opciones.GetInt("instancia", 0); WebReference1.preguntaDTO[] preguntas = new WebReference1.preguntaDTO[lista.Count]; for (int y = 0; y < preguntas.Length; y++) { preguntas[y] = lista[y].get_pregunta(); } guardar.preguntas = JsonConvert.SerializeObject(preguntas); db.insert_guardado(guardar, opciones.GetString("db", "")); Intent intent = new Intent(this.ApplicationContext, typeof(Activity1)); StartActivity(intent); Toast.MakeText(this.ApplicationContext, "Guardado local revisa en VER lISTA CUESTIONARIOS, para terminarlo", ToastLength.Long).Show(); click = true; }); builder.SetNegativeButton("Cancelar", (sender2, args) => { click = true; }); builder.Show(); }; if (modelo.Length > 0) { string json = opciones.GetString(modelo, ""); WebReference1.preguntaDTO[] preguntas = JsonConvert.DeserializeObject <WebReference1.preguntaDTO[]>(json); for (int y = 0; y < preguntas.Length; y++) { lapregunta temp = new lapregunta(); temp.pos_list = y; temp.set_pregunta(preguntas[y]); lista.Add(temp); } //lista = preguntas.OfType<WebReference1.preguntaDTO>().ToList(); cuestionarioactual = JsonConvert.DeserializeObject <Cuestionarioxml>(actual.xml); //cuestionarioactual.los_anexos= JsonConvert.DeserializeObject<List<anexos>>(actual.anexos); cuestionarioactual.variables = new Dictionary <string, string>(); for (int xx = 0; xx < preguntas.Length; xx++) { if (preguntas[xx].preguntaCerrada != null) { cuestionarioactual.variables[preguntas[xx].variable] = "1"; } else { cuestionarioactual.variables[preguntas[xx].variable] = ""; } } //variables del cuestionario listas para modificarse //fin del caso nuevo } } else { g = db.get_guardado(id_formato, opciones.GetInt("instancia", 0), opciones.GetString("db", "")); modelo = g.nm_modelo; int id_modelo = g.id_modelo; cuestionarioactual = JsonConvert.DeserializeObject <Cuestionarioxml>(g.xml); //lista = JsonConvert.DeserializeObject <List<lapregunta>>(g.preguntas); WebReference1.preguntaDTO[] preguntas = JsonConvert.DeserializeObject <WebReference1.preguntaDTO[]>(g.preguntas); for (int y = 0; y < preguntas.Length; y++) { lapregunta temp = new lapregunta(); temp.pos_list = y; temp.set_pregunta(preguntas[y]); lista.Add(temp); } imagen = FindViewById <ImageView>(Resource.Id.siguiente); imagen.Click += (s, e) => { if (anexos) { ListView listaaa = FindViewById <ListView>(Resource.Id.listaa);//oculta int cx = (listaaa.Left + listaaa.Right) / 2; int cy = (listaaa.Top + listaaa.Bottom) / 2; int finalRadius = Math.Max(listaaa.Width, listaaa.Height); Android.Animation.Animator anim = ViewAnimationUtils.CreateCircularReveal(listaaa, cx, cy, 0, finalRadius); listaaa.Visibility = ViewStates.Visible; anim.Start(); FindViewById <ListView>(Resource.Id.listam).Visibility = ViewStates.Gone; anexos = false; } else { ListView listaaa = FindViewById <ListView>(Resource.Id.listam);//oculta int cx = (listaaa.Left + listaaa.Right) / 2; int cy = (listaaa.Top + listaaa.Bottom) / 2; int finalRadius = Math.Max(listaaa.Width, listaaa.Height); Android.Animation.Animator anim = ViewAnimationUtils.CreateCircularReveal(listaaa, cx, cy, 0, finalRadius); listaaa.Visibility = ViewStates.Visible; anim.Start(); FindViewById <ListView>(Resource.Id.listaa).Visibility = ViewStates.Gone;; anexos = true; } }; imagen = FindViewById <ImageView>(Resource.Id.guardar); imagen.Click += (s, e) => { //Guardados guardar = new Guardados(); var builder = new AlertDialog.Builder(this); builder.SetTitle("Guardar en local"); LayoutInflater inflater = LayoutInflater.From(this); View dialogview = inflater.Inflate(Resource.Layout.lista2, null); TextView titulo; EditText editText = dialogview.FindViewById <EditText>(Resource.Id.resultado); editText.Text = ""; editText.SetTextColor(Android.Graphics.Color.White); editText.Focusable = false; editText.FocusableInTouchMode = false; dialogview.FindViewById <LinearLayout>(Resource.Id.templatt).SetBackgroundColor(Android.Graphics.Color.Transparent); titulo = dialogview.FindViewById <TextView>(Resource.Id.titulo); titulo.Text = "El archivo se sobreescribira"; titulo.SetTextColor(Android.Graphics.Color.White); builder.SetView(dialogview); builder.SetPositiveButton("Aceptar", (sender2, args) => { g.xml = JsonConvert.SerializeObject(cuestionarioactual); WebReference1.preguntaDTO[] p = new WebReference1.preguntaDTO[lista.Count]; for (int y = 0; y < p.Length; y++) { p[y] = lista[y].get_pregunta(); } g.preguntas = JsonConvert.SerializeObject(p); if (db.update_guardado(g, opciones.GetString("db", "")) > 0) { Toast.MakeText(this.ApplicationContext, "Guardado", ToastLength.Long).Show(); } else { Toast.MakeText(this.ApplicationContext, "Error al guardar, intentelo otra vez", ToastLength.Long).Show(); } }); builder.SetNegativeButton("Cancelar", (sender2, args) => { click = true; }); builder.Show(); }; } click = true; filtrar_lista(); pintar_lista(); var btnCamera = FindViewById <Button>(Resource.Id.buttonc); imageviewfoto = FindViewById <ImageView>(Resource.Id.imageViewfoto); btnCamera.Click += btnCamera_click; btnCamera = FindViewById <Button>(Resource.Id.buttona); btnCamera.Click += btnCamera_aceptar; btnCamera = FindViewById <Button>(Resource.Id.buttonx); btnCamera.Click += btnCamera_cancelar; FindViewById <ImageView>(Resource.Id.g_nube).Click += btnfinalizar; FindViewById <Button>(Resource.Id.buttonf).Click += btnfile_click; //btnCamera.Click += btnfinalizar; FindViewById <ImageView>(Resource.Id.imageView4).Click += (sender, e) => { var builder = new AlertDialog.Builder(this); builder.SetTitle("Aviso"); builder.SetMessage("Se cerrara la sesión ¿está seguro?"); builder.SetPositiveButton("Aceptar", (sender2, args) => { Toast.MakeText(this.ApplicationContext, "Adios", ToastLength.Long).Show(); //resultado.Text = respuesta.INSTANCIA.ID_INSTANCIA + " Operador: "+respuesta.id_Opr+" "+respuesta.nm_Oper; ISharedPreferencesEditor editor = opciones.Edit(); editor.PutString("nm_opr", ""); editor.PutInt("id_opr", 0); editor.PutString("nm_str", ""); editor.PutInt("instancia", 0); editor.Commit(); StartActivity(typeof(MainActivity)); }); builder.SetNegativeButton("Cancelar", (sender2, args) => { }); builder.Show(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Options); _bannerad = BannerAdWrapper.ConstructStandardBanner(this, AdSize.LargeBanner, "ca-app-pub-6665335742989505/9551542272"); _bannerad.Bottom = 0; _bannerad.CustomBuild(); var layout = FindViewById <LinearLayout>(Resource.Id.options_LinearLayout1); layout.AddView(_bannerad); pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); prefEdit = pref.Edit(); enableStops = pref.GetBoolean("enableStops", true); showKMs = pref.GetBoolean("showKMs", true); portraitView = pref.GetBoolean("portraitView", true); SetRadioButtons(); RadioButton kilometersRadioButton = FindViewById <RadioButton>(Resource.Id.options_KilometersRadioButton); RadioButton milesRadioButton = FindViewById <RadioButton>(Resource.Id.options_MilesRadioButton); RadioButton enableStopsRadioButton = FindViewById <RadioButton>(Resource.Id.options_EnableStopsRadioButton); RadioButton disableStopsRadioButton = FindViewById <RadioButton>(Resource.Id.options_DisableStopsRadioButton); RadioButton portraitRadioButton = FindViewById <RadioButton>(Resource.Id.options_PortraitRadioButton); RadioButton landscapeRadioButton = FindViewById <RadioButton>(Resource.Id.options_LandscapeRadioButton); kilometersRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("showKMs", true); prefEdit.Apply(); }; milesRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("showKMs", false); prefEdit.Apply(); }; enableStopsRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("enableStops", true); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Stops Will Only Affect New Trips", ToastLength.Short).Show(); }; disableStopsRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("enableStops", false); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Stops Will Only Affect New Trips", ToastLength.Short).Show(); }; portraitRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("portraitView", true); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Screen Orientation Won't Affect Started Trips", ToastLength.Short).Show(); prefEdit.PutBoolean("changeOrientation", true); prefEdit.Apply(); }; landscapeRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("portraitView", false); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Screen Orientation Won't Affect Started Trips", ToastLength.Short).Show(); prefEdit.PutBoolean("changeOrientation", true); prefEdit.Apply(); }; }//OnCreate()
public RefLayoutManager(Context context) { this.context = context; sharePref = this.context.GetSharedPreferences(pref_name, FileCreationMode.Private); editor = sharePref.Edit(); }
public DroidStorage(Context context, string sharedPreferencesName) { prefs = context.GetSharedPreferences(sharedPreferencesName, 0); editor = prefs.Edit(); }