Пример #1
0
        private async void Login(object sender, EventArgs e)
        {
            if (TextUtils.IsEmpty(userID.Text) || TextUtils.IsEmpty(userPassword.Text))
            {
                Toast.MakeText(this, "Don't Leave Fields Empty", ToastLength.Long).Show();
            }
            else
            {
                try
                {
                    progressBar.Visibility = ViewStates.Visible;
                    HttpClient client = new HttpClient();
                    string     pw     = EncryptionDecryption.ComputeSha256Hash(userPassword.Text);
                    var        uri    = new Uri(string.Format("http://apupay.azurewebsites.net/api/Login?username="******"&password="******"application/json"));
                    response = await client.GetAsync(uri);

                    if (response.StatusCode == System.Net.HttpStatusCode.Accepted)
                    {
                        var json = await response.Content.ReadAsStringAsync();

                        progressBar.Visibility = ViewStates.Gone;
                        user = JsonConvert.DeserializeObject <User>(json);
                        Toast.MakeText(this, "Welcome", ToastLength.Short).Show();
                        Intent i = new Intent(this, typeof(MainMenu));
                        i.PutExtra("user", JsonConvert.SerializeObject(user));
                        this.StartActivity(i);
                    }
                    else
                    {
                        var errorMessage1 = response.Content.ReadAsStringAsync().Result.Replace("\\", "").Trim(new char[1]
                        {
                            '"'
                        });
                        Toast.MakeText(this, errorMessage1, ToastLength.Long).Show();
                        userID.Enabled       = true;
                        userPassword.Enabled = true;
                        btnLogin.Enabled     = true;
                        userID.Dispose();
                        userPassword.Dispose();
                        progressBar.Visibility = ViewStates.Gone;
                    }
                }
                catch
                {
                    Toast.MakeText(this, "Something Went Wrong", ToastLength.Long).Show();
                    userID.Enabled       = true;
                    userPassword.Enabled = true;
                    btnLogin.Enabled     = true;
                    userID.Dispose();
                    userPassword.Dispose();
                    progressBar.Visibility = ViewStates.Gone;
                }
            }
        }
Пример #2
0
 private void DisposeItems()
 {
     _content?.Dispose();
     _content = null;
     _close?.Dispose();
     _close = null;
     _resultsView?.Dispose();
     _resultsView = null;
     _resultsTxv?.Dispose();
     _resultsTxv = null;
     _orderId?.Dispose();
     _orderId = null;
     _checkBtn?.Dispose();
     _checkBtn      = null;
     _presenter     = null;
     _servicePoints = null;
     _spRecyclerView?.Dispose();
     _spRecyclerView = null;
     _mapFragment?.Dispose();
     _mapFragment = null;
     _viewIcon?.SetImageDrawable(null);
     _viewIcon.Dispose();
     _animationView?.Dispose();
     _receiver?.Dispose();
     _receiver = null;
     _connection?.Dispose();
     _connection = null;
 }
Пример #3
0
        public override void OnDestroy()
        {
            emailInput?.Dispose();
            passwordInput?.Dispose();

            base.OnDestroy();
        }
Пример #4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         entry.Dispose();
         entry = null;
     }
 }
        protected override void OnDestroy()
        {
            base.OnDestroy();
            configurationManager.SaveAValue(ConfigurationParameters.WeatherCity, city.Text); //Save before exit, because it might be possible that the EditText never loses focus.

            city.FocusChange -= City_FocusChange;
            useimperialsystem.CheckedChange -= Useimperialsystem_CheckedChange;
            city.Dispose();
            useimperialsystem.Dispose();
            configurationManager.Dispose();
        }
Пример #6
0
        public override void OnDestroy()
        {
            emailInput?.Dispose();
            firstNameInput?.Dispose();
            lastNameInput?.Dispose();
            passwordInput?.Dispose();

            //System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
            birthDateInput?.Dispose();

            base.OnDestroy();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window.RequestFeature(WindowFeatures.NoTitle);
                SetContentView(Resource.Layout.ConversationLayout);
                ServiceWrapper svc = new ServiceWrapper();
                InsertMessages ins = new InsertMessages();
                SenderList   = FindViewById <ListView>(Resource.Id.senderList);
                ReceiverList = FindViewById <ListView>(Resource.Id.receiverList);

                ConversationResponse cvr = new ConversationResponse();
                cvr   = svc.GetConversationList(1, 2).Result;
                myArr = cvr.ConversationList.ToList <RetriveMessages>();
                SenderListAdapter adapter = new SenderListAdapter(this, myArr);
                SenderList.Adapter = adapter;
                ConversationResponse cvr1 = new ConversationResponse();
                cvr1   = svc.GetConversationList(2, 1).Result;
                myArr1 = cvr1.ConversationList.ToList <RetriveMessages>();
                ReceiverListAdapter adapter1 = new ReceiverListAdapter(this, myArr1);
                ReceiverList.Adapter = adapter1;

                EditText    ed      = FindViewById <EditText>(Resource.Id.txtmsg);
                ImageButton btnsend = FindViewById <ImageButton>(Resource.Id.btnSend);
                btnsend.Click += async delegate
                {
                    ins.InsertMessage = ed.Text;
                    ins.sender_id     = 2;//Convert.ToInt32(CurrentUser.getUserId());
                    ins.receiver_id   = 1;
                    int i = await svc.InsertMessage(ins);

                    try
                    {
                        RefreshParent();
                    }
                    catch (Exception e)
                    {
                    }
                    ed.Dispose();
                };
            }
            catch (Exception e)
            {
            }
        }
Пример #8
0
        public override void OnDestroy()
        {
            base.OnDestroy();

            WebView?.Dispose();
            WebView = null;

            ProgressButton?.Dispose();
            ProgressButton = null;

            ProgressBar?.Dispose();
            ProgressBar = null;

            TextField?.Dispose();
            TextField = null;

            URL = null;
        }
Пример #9
0
        public override void OnDestroy()
        {
            nameInput?.Dispose();

            base.OnDestroy();
        }
Пример #10
0
        public void Dispose()
        {
            if (scrollView != null)
            {
                scrollView.Dispose();
                scrollView = null;
            }

            if (formulaEdit != null)
            {
                formulaEdit.Dispose();
                formulaEdit = null;
            }

            if (computedValueEdit != null)
            {
                computedValueEdit.Dispose();
                computedValueEdit = null;
            }

            if (txtA1 != null)
            {
                txtA1.Dispose();
                txtA1 = null;
            }

            if (txtA2 != null)
            {
                txtA2.Dispose();
                txtA2 = null;
            }

            if (txtA3 != null)
            {
                txtA3.Dispose();
                txtA3 = null;
            }

            if (txtA4 != null)
            {
                txtA4.Dispose();
                txtA4 = null;
            }

            if (txtA5 != null)
            {
                txtA5.Dispose();
                txtA5 = null;
            }

            if (txtB1 != null)
            {
                txtB1.Dispose();
                txtB1 = null;
            }

            if (txtB2 != null)
            {
                txtB2.Dispose();
                txtB2 = null;
            }

            if (txtB3 != null)
            {
                txtB3.Dispose();
                txtB3 = null;
            }

            if (txtB4 != null)
            {
                txtB4.Dispose();
                txtB4 = null;
            }

            if (txtB5 != null)
            {
                txtB5.Dispose();
                txtB5 = null;
            }

            if (txtC1 != null)
            {
                txtC1.Dispose();
                txtC1 = null;
            }

            if (txtC2 != null)
            {
                txtC2.Dispose();
                txtC2 = null;
            }

            if (txtC3 != null)
            {
                txtC3.Dispose();
                txtC3 = null;
            }

            if (txtC4 != null)
            {
                txtC4.Dispose();
                txtC4 = null;
            }

            if (txtC5 != null)
            {
                txtC5.Dispose();
                txtC5 = null;
            }

            if (engine != null)
            {
                engine.Dispose();
                engine = null;
            }
        }
Пример #11
0
        public void Dispose()
        {
            if (subjectInput != null)
            {
                subjectInput.Dispose();
                subjectInput = null;
            }

            if (locationInput != null)
            {
                locationInput.Dispose();
                locationInput = null;
            }

            if (allDaySwitch != null)
            {
                allDaySwitch.CheckedChange -= AllDaySwitch_CheckedChange;
                allDaySwitch.Dispose();
                allDaySwitch = null;
            }

            if (endTimeZonePicker != null)
            {
                endTimeZonePicker.ItemSelected -= EndTimeZone_Spinner_ItemSelected;
                endTimeZonePicker.Dispose();
                endTimeZonePicker = null;
            }

            if (startTimeZonePicker != null)
            {
                startTimeZonePicker.ItemSelected -= StartTimeZone_Spinner_ItemSelected;
                startTimeZonePicker.Dispose();
                startTimeZonePicker = null;
            }

            if (startDateName != null)
            {
                startDateName.Click -= StartDateName_Click;
                startDateName.Dispose();
                startDateName = null;
            }

            if (startTimeName != null)
            {
                startTimeName.Click -= StartTimeName_Click;
                startTimeName.Dispose();
                startTimeName = null;
            }

            if (endDateName != null)
            {
                endDateName.Click -= EndDateName_Click;
                endDateName.Dispose();
                endDateName = null;
            }

            if (endTimeName != null)
            {
                endTimeName.Click -= EndTimeName_Click;
                endTimeName.Dispose();
                endTimeName = null;
            }

            if (dateFormat != null)
            {
                dateFormat.Dispose();
                dateFormat = null;
            }

            if (timeFormat != null)
            {
                timeFormat.Dispose();
                timeFormat = null;
            }
        }
Пример #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_file_browser);

            //Toolbar will now take on default actionbar characteristics
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = string.Empty;

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            try
            {
                _showCreateFolderMenu = false;
                _orderBy = FileDocumentItemSortOrders.Default;

                // documents provider
                _documentsProvider = new FileDocumentsProvider();
                _documentsProvider.AttachInfo(this,
                                              CreateProviderInfo(string.Format("{0}.{1}", AppSettings.AppPackageName,
                                                                               _documentsProvider.GetType().Name.ToLower()))); //HARDCODE:

                // root
                GetRoot();
                if (string.IsNullOrEmpty(_root?.DocumentId))
                {
                    throw new ArgumentNullException(nameof(_root));
                }

                // stack
                _previousParents = new Stack <string>();

                // start parameters
                var displayName        = Intent.GetStringExtra(Intent.ExtraTitle);
                var mimeType           = Intent.Type;
                var isCategoryOpenable = Intent.Categories?.Contains(Intent.CategoryOpenable) == true;
                var action             = Intent?.Action;
                // end parameters

                var statusBar = FindViewById(Resource.Id.statusBar);
                _imgNewFileName  = FindViewById <ImageView>(Resource.Id.imgNewFileName);
                _txtNewFileName  = FindViewById <EditText>(Resource.Id.txtNewFileName);
                _btnAction       = FindViewById <Button>(Resource.Id.btnAction);
                _viewProgressbar = FindViewById(Resource.Id.toolbarProgress);

                switch (action)
                {
                case Intent.ActionCreateDocument:
                    _showCreateFolderMenu = true;
                    if (_imgNewFileName != null)
                    {
                        _imgNewFileName.SetImageResource(Resource.Drawable.ic_file);
                        _imgNewFileName.Visibility = ViewStates.Visible;
                    }

                    if (_txtNewFileName != null)
                    {
                        _txtNewFileName.Text       = displayName ?? string.Empty;
                        _txtNewFileName.Visibility = ViewStates.Visible;
                    }

                    if (_btnAction != null)
                    {
                        _btnAction.SetText(Resource.String.Save);
                        _btnAction.LayoutParameters.Width = ViewGroup.LayoutParams.WrapContent;
                    }

                    _mimeType           = mimeType;
                    _isCategoryOpenable = isCategoryOpenable;
                    break;

                case Intent.ActionOpenDocumentTree:
                    _isActionOpenDocumentTree = true;
                    _showCreateFolderMenu     = true;

                    if (_imgNewFileName != null)
                    {
                        _imgNewFileName.Visibility = ViewStates.Gone;
                    }

                    if (_txtNewFileName != null)
                    {
                        _txtNewFileName.Visibility = ViewStates.Gone;
                    }

                    if (_btnAction != null)
                    {
                        _btnAction.LayoutParameters.Width = ViewGroup.LayoutParams.MatchParent;
                    }
                    break;

                default:
                    if (statusBar != null)
                    {
                        statusBar.Visibility = ViewStates.Gone;
                    }

                    _imgNewFileName?.Dispose();
                    _imgNewFileName = null;

                    _txtNewFileName?.Dispose();
                    _txtNewFileName = null;

                    _btnAction?.Dispose();
                    _btnAction = null;

                    _mimeType           = mimeType;
                    _isCategoryOpenable = isCategoryOpenable;
                    break;
                }

                if (savedInstanceState == null)
                {
                    var searchQuery = Intent.GetStringExtra(ExtraSearchQuery);
                    var taskType    = string.IsNullOrEmpty(searchQuery)
                        ? FileBrowserFragment.DocumentTaskTypes.QueryChildDocuments
                        : FileBrowserFragment.DocumentTaskTypes.QuerySearchDocuments;
                    ReplaceFragment(isAdd: true, useCustomAnimation: false, taskType: taskType, query: searchQuery);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                Toast.MakeText(this, GetString(Resource.String.InternalError),
                               AppSettings.ToastLength).Show();
            }
        }
Пример #13
0
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (existingImageWrapper != null)
                    {
                        existingImageWrapper.Dispose();
                    }
                    if (existingImage != null)
                    {
                        existingImage.Dispose();
                    }
                    if (progressBar != null)
                    {
                        progressBar.Dispose();
                    }
                    if (cropViewWrapper != null)
                    {
                        cropViewWrapper.Dispose();
                    }
                    if (cropView != null)
                    {
                        cropView.Dispose();
                    }
                    if (imageWrapper != null)
                    {
                        imageWrapper.Dispose();
                    }
                    if (missingImageButton != null)
                    {
                        missingImageButton.Dispose();
                    }
                    if (coordinatorLayout != null)
                    {
                        coordinatorLayout.Dispose();
                    }
                    if (selector != null)
                    {
                        selector.Dispose();
                    }
                    if (imageBtn != null)
                    {
                        imageBtn.Dispose();
                    }
                    if (dateBtn != null)
                    {
                        dateBtn.Dispose();
                    }
                    if (editName != null)
                    {
                        editName.Dispose();
                    }
                    if (fab != null)
                    {
                        fab.Dispose();
                    }
                    if (editAmount != null)
                    {
                        editAmount.Dispose();
                    }
                    if (toolbar != null)
                    {
                        toolbar.Dispose();
                    }
                }

                disposed = true;
            }
            base.Dispose(disposing);
        }
Пример #14
0
        public void Dispose()
        {
            if (scrollView != null)
            {
                scrollView.Dispose();
                scrollView = null;
            }

            if (calcQuickBase != null)
            {
                calcQuickBase.Dispose();
                calcQuickBase = null;
            }

            if (editTextA != null)
            {
                editTextA.Dispose();
                editTextA = null;
            }

            if (editTextB != null)
            {
                editTextB.Dispose();
                editTextB = null;
            }

            if (editTextC != null)
            {
                editTextC.Dispose();
                editTextC = null;
            }

            if (result1 != null)
            {
                result1.Dispose();
                result1 = null;
            }

            if (result2 != null)
            {
                result2.Dispose();
                result2 = null;
            }

            if (result3 != null)
            {
                result3.Dispose();
                result3 = null;
            }

            if (textA != null)
            {
                textA.Dispose();
                textA = null;
            }

            if (textB != null)
            {
                textB.Dispose();
                textB = null;
            }

            if (textC != null)
            {
                textC.Dispose();
                textC = null;
            }
        }
        private void StartSearch()
        {
#pragma warning disable CA2000 // Dispose objects before losing scope
            EditText codeInput = new EditText(this);
#pragma warning restore CA2000 // Dispose objects before losing scope

            using (global::Android.Support.V7.App.AlertDialog.Builder builder = new global::Android.Support.V7.App.AlertDialog.Builder(this))
                using (TextView message = new TextView(this))
                    using (LinearLayout dialogLayout = new LinearLayout(this)
                    {
                        Orientation = Orientation.Vertical
                    })
                    {
                        builder.SetTitle(Resource.String.searchAlertTitle);
                        int px = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 16, Resources.DisplayMetrics);
                        message.SetText(Resource.String.createCollectionAddActivityEnterCode);

                        dialogLayout.AddView(message);
                        dialogLayout.AddView(codeInput);
                        dialogLayout.SetPadding(px, px, px, px);

                        builder.SetView(dialogLayout);
                        builder.SetPositiveButton(Resource.String.MenuSearch, (a, b) => { GetAndReturnWithActivity(codeInput.Text); codeInput.Dispose(); });
                        builder.SetNeutralButton(Resource.String.dialog_cancel, (a, b) => { });
                        builder.Show();
                    }
        }