/// <summary> /// Initialise la vue pour mettre à jour un seekios /// </summary> private void SetSeekiosDataToView() { if (App.Locator.AddSeekios.SeekiosImage != null) { // Seekios image var bitmap = BitmapFactory.DecodeByteArray( App.Locator.AddSeekios.SeekiosImage, 0, App.Locator.AddSeekios.SeekiosImage.Length); if (bitmap != null) { SeekiosImageView.SetImageBitmap(bitmap); bitmap.Dispose(); } } // Seekios name SeekiosNameEditText.Text = App.Locator.AddSeekios.SeekiosName; // Seekios imei and pin IMEIEditText.Text = App.Locator.AddSeekios.SeekiosIMEI; PINEditText.SetHint(Resource.String.addSeekios_versionEmbedded); PINEditText.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(150) }); PINEditText.Enabled = false; PINEditText.InputType = InputTypes.Null; var pinCodeLayout = FindViewById <TextInputLayout>(Resource.Id.seekios_pinLayout); pinCodeLayout.CounterEnabled = false; pinCodeLayout.Hint = Resources.GetString(Resource.String.addSeekios_versionEmbedded); IMEIEditText.Enabled = false; SaveButton.Enabled = false; // Seekios version embedded if (App.CurrentUserEnvironment.LastVersionEmbedded != null && App.Locator.DetailSeekios.SeekiosSelected.VersionEmbedded_idversionEmbedded != App.CurrentUserEnvironment.LastVersionEmbedded.IdVersionEmbedded && !App.CurrentUserEnvironment.LastVersionEmbedded.IsBetaVersion) { PINEditText.Text = string.Format("{0} {1}" , App.Locator.DetailSeekios.SeekiosEmbeddedVersion , string.Format(Resources.GetString(Resource.String.addSeekios_versionEmbeddedUpdate) , App.CurrentUserEnvironment.LastVersionEmbedded.VersionName)); FirmwareUpdateImageView.Visibility = ViewStates.Visible; } else { PINEditText.Text = App.Locator.DetailSeekios.SeekiosEmbeddedVersion; } }
/// <summary> /// Take a picture from the camera or the library /// </summary> private void PickImageFromCameraOrGallery_Click(object sender, EventArgs e) { var options = new[] { Resources.GetString(Resource.String.addSeekios_takePicture), Resources.GetString(Resource.String.addSeekios_gallery), Resources.GetString(Resource.String.addSeekios_clearImage) }; AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.Theme_AppCompat_Light_Dialog); builder.SetTitle(Resource.String.addSeekios_modifyPicture); builder.SetItems(options, (innersender, innerargs) => { if (innerargs.Which == 0) { _isFromGallery = false; _cameraService.TakePictureFromCamera(); } else if (innerargs.Which == 1) { _isFromGallery = true; _cameraService.TakePictureFromGallery(Resources.GetString(Resource.String.addSeekios_addPicture)); } else if (innerargs.Which == 2) { var image = Resource.Drawable.DefaultSeekios; var drawable = Resources.GetDrawable(image); Bitmap bitmap = ((BitmapDrawable)drawable).Bitmap; using (var stream = new System.IO.MemoryStream()) { bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, stream); byte[] bitMapData = stream.ToArray(); App.Locator.AddSeekios.SeekiosImage = bitMapData; } SeekiosImageView.SetImageResource(Resource.Drawable.DefaultSeekios); SaveButton.Enabled = true; } }); builder.Show(); }
public override void ViewDidUnload() { base.ViewDidUnload(); App.SeekiosChanged -= App_SeekiosChanged; App.RemainingRequestChanged -= OnRemainingRequestChanged; App.Locator.ModeDontMove.SeekiosMovedNotified -= ModeDontMove_SeekiosMovedNotified; App.Locator.ModeZone.OnSeekiosOutOfZoneNotified -= ModeZone_OnSeekiosOutOfZoneNotified; RefreshBatteryButton.TouchUpInside -= RefreshBatteryButton_TouchUpInside; HelpCreditCostButton.TouchDown -= HelpCreditCostButton_TouchDown; NeedUpdateButton.TouchDown -= NeedUpdateButton_TouchDown; SeekiosImageView.Dispose(); CreditsTitleLabel.Dispose(); NextRefillLabel.Dispose(); LastRefreshBatteryLabel.Dispose(); RefreshBatteryButton.Dispose(); BatteryLabel.Dispose(); BatteryIndicator.Dispose(); RefreshBatteryButton.Dispose(); //Tableview.Dispose(); _seekiosSelected = null; }
/// <summary> /// CallBack du Picker de la sélection d'une image Seekios /// </summary> protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); Bitmap bitmap = null; if (resultCode == Result.Ok && _isFromGallery && data != null && data.Data != null) { // service qui récupère et resize l'image bitmap = _cameraService.GetPictureFromGallery(data.Data); } else if (resultCode == Result.Ok) { // service qui récupère et resize l'image bitmap = _cameraService.GetPictureFromCamera(); } // met à jour l'image du seekios if (bitmap != null) { SeekiosImageView.SetImageBitmap(bitmap); bitmap.Dispose(); // transfère l'image dans le ViewModel pour l'update en bdd App.Locator.AddSeekios.SeekiosImage = _cameraService.PictureBinary; GC.Collect(); } if (!App.Locator.AddSeekios.IsAdding && !SaveButton.Enabled) { SaveButton.Enabled = true; } }
void ReleaseDesignerOutlets() { if (AlertImage != null) { AlertImage.Dispose(); AlertImage = null; } if (AlertLabel != null) { AlertLabel.Dispose(); AlertLabel = null; } if (BatteryBackgroundImage != null) { BatteryBackgroundImage.Dispose(); BatteryBackgroundImage = null; } if (BatteryIndicator != null) { BatteryIndicator.Dispose(); BatteryIndicator = null; } if (BatteryLabel != null) { BatteryLabel.Dispose(); BatteryLabel = null; } if (CreditsFreeLabel != null) { CreditsFreeLabel.Dispose(); CreditsFreeLabel = null; } if (CreditsLabel != null) { CreditsLabel.Dispose(); CreditsLabel = null; } if (CreditsTitleLabel != null) { CreditsTitleLabel.Dispose(); CreditsTitleLabel = null; } if (DateReloadSeekiosCredit != null) { DateReloadSeekiosCredit.Dispose(); DateReloadSeekiosCredit = null; } if (HeadView != null) { HeadView.Dispose(); HeadView = null; } if (HelpCreditCostButton != null) { HelpCreditCostButton.Dispose(); HelpCreditCostButton = null; } if (LastRefreshBatteryLabel != null) { LastRefreshBatteryLabel.Dispose(); LastRefreshBatteryLabel = null; } if (ModeImage != null) { ModeImage.Dispose(); ModeImage = null; } if (ModeLabel != null) { ModeLabel.Dispose(); ModeLabel = null; } if (NeedUpdateButton != null) { NeedUpdateButton.Dispose(); NeedUpdateButton = null; } if (NextRefillLabel != null) { NextRefillLabel.Dispose(); NextRefillLabel = null; } if (PowerSavingImage != null) { PowerSavingImage.Dispose(); PowerSavingImage = null; } if (RefreshBatteryButton != null) { RefreshBatteryButton.Dispose(); RefreshBatteryButton = null; } if (SeekiosImageView != null) { SeekiosImageView.Dispose(); SeekiosImageView = null; } if (SeekiosLastPositionLabel != null) { SeekiosLastPositionLabel.Dispose(); SeekiosLastPositionLabel = null; } if (SeekiosNameLabel != null) { SeekiosNameLabel.Dispose(); SeekiosNameLabel = null; } if (Tableview != null) { Tableview.Dispose(); Tableview = null; } }
void ReleaseDesignerOutlets() { if (BuySeekiosButton != null) { BuySeekiosButton.Dispose(); BuySeekiosButton = null; } if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (IMEILabel != null) { IMEILabel.Dispose(); IMEILabel = null; } if (MaxSizeSeekiosIMEILabel != null) { MaxSizeSeekiosIMEILabel.Dispose(); MaxSizeSeekiosIMEILabel = null; } if (MaxSizeSeekiosNameLabel != null) { MaxSizeSeekiosNameLabel.Dispose(); MaxSizeSeekiosNameLabel = null; } if (MaxSizeSeekiosPinCodeLabel != null) { MaxSizeSeekiosPinCodeLabel.Dispose(); MaxSizeSeekiosPinCodeLabel = null; } if (ModifySeekiosImageButton != null) { ModifySeekiosImageButton.Dispose(); ModifySeekiosImageButton = null; } if (NeedUpdateButton != null) { NeedUpdateButton.Dispose(); NeedUpdateButton = null; } if (NotificationDontMoveLabel != null) { NotificationDontMoveLabel.Dispose(); NotificationDontMoveLabel = null; } if (NotificationDontMoveSwitch != null) { NotificationDontMoveSwitch.Dispose(); NotificationDontMoveSwitch = null; } if (NotificationTrackingLabel != null) { NotificationTrackingLabel.Dispose(); NotificationTrackingLabel = null; } if (NotificationTrackingSwitch != null) { NotificationTrackingSwitch.Dispose(); NotificationTrackingSwitch = null; } if (NotificationZoneLabel != null) { NotificationZoneLabel.Dispose(); NotificationZoneLabel = null; } if (NotificationZoneSwitch != null) { NotificationZoneSwitch.Dispose(); NotificationZoneSwitch = null; } if (PinLabel != null) { PinLabel.Dispose(); PinLabel = null; } if (SaveButton != null) { SaveButton.Dispose(); SaveButton = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (SeekiosImageView != null) { SeekiosImageView.Dispose(); SeekiosImageView = null; } if (SeekiosIMEITextField != null) { SeekiosIMEITextField.Dispose(); SeekiosIMEITextField = null; } if (SeekiosNameLabel != null) { SeekiosNameLabel.Dispose(); SeekiosNameLabel = null; } if (SeekiosNameTextField != null) { SeekiosNameTextField.Dispose(); SeekiosNameTextField = null; } if (SeekiosPinCodeTextField != null) { SeekiosPinCodeTextField.Dispose(); SeekiosPinCodeTextField = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Keyboard popup _observer1 = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, KeyBoardUpNotification); // Keyboard Down _observer2 = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, KeyBoardDownNotification); if (App.Locator.AddSeekios.IsAdding) { // Seekios Name Toolbar (next -> go to IMEI) var toolbarName = new UIToolbar(); toolbarName.BarStyle = UIBarStyle.Default; toolbarName.Translucent = true; toolbarName.SizeToFit(); var nextNameButton = new UIBarButtonItem(Application.LocalizedString("Next"), UIBarButtonItemStyle.Done, (s, e) => { SeekiosNameTextField.ResignFirstResponder(); SeekiosIMEITextField.BecomeFirstResponder(); }); toolbarName.SetItems(new UIBarButtonItem[] { nextNameButton }, true); SeekiosNameTextField.InputAccessoryView = toolbarName; // Seekios IMEI Toolbar (next -> go to Pin Code) var toolbarIMEI = new UIToolbar(); toolbarIMEI.BarStyle = UIBarStyle.Default; toolbarIMEI.Translucent = true; toolbarIMEI.SizeToFit(); var nextIMEIButton = new UIBarButtonItem(Application.LocalizedString("Next"), UIBarButtonItemStyle.Done, (s, e) => { SeekiosIMEITextField.ResignFirstResponder(); SeekiosPinCodeTextField.BecomeFirstResponder(); }); toolbarIMEI.SetItems(new UIBarButtonItem[] { nextIMEIButton }, true); SeekiosIMEITextField.InputAccessoryView = toolbarIMEI; // Seekios Pin Code Toolbar (Done -> save the seekios) var toolbarPinCode = new UIToolbar(); toolbarPinCode.BarStyle = UIBarStyle.Default; toolbarPinCode.Translucent = true; toolbarPinCode.SizeToFit(); var nextPinCodeButton = new UIBarButtonItem(Application.LocalizedString("DoneButton"), UIBarButtonItemStyle.Done, (s, e) => { SeekiosPinCodeTextField.ResignFirstResponder(); SaveButton_TouchUpInside(null, null); }); toolbarPinCode.SetItems(new UIBarButtonItem[] { nextPinCodeButton }, true); SeekiosPinCodeTextField.InputAccessoryView = toolbarPinCode; } SeekiosImageView.AddGestureRecognizer(new UITapGestureRecognizer(() => { ModifySeekiosImageButton_TouchDown(null, null); })); ModifySeekiosImageButton.TouchDown += ModifySeekiosImageButton_TouchDown; DeleteButton.TouchUpInside += DeleteButton_TouchUpInside; BuySeekiosButton.TouchDown += BuySeekiosButton_TouchDown; SaveButton.TouchUpInside += SaveButton_TouchUpInside; NeedUpdateButton.TouchDown += NeedUpdateButton_TouchDown; }