//Taking care of bussiness, verifyifing if the information received of the transaction history is correct private async Task Takingcareofbussiness() { //trying to get information online if some error occurs this is caught and taken care of, a message is displayed in this case try { //indicates the activity indicator to start IsBusy = true; var rest = new ManagerRESTService(new RESTService()); Debug.WriteLine("Clicked transaction button"); var uri = String.Format(Constants.MovementUrl, AccountsPage.Bankid, AccountsPage.Accountid); //getting information from the online location await rest.GetWithToken(uri).ContinueWith(t => { //Problem occured a message is displayed to the user if (t.IsFaulted) { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Alert", "Something went wrong sorry :(", "OK"); }); } //everything went fine, information should be displayed else { Device.BeginInvokeOnMainThread(() => { var result = t.Result; transactionList = JsonConvert.DeserializeObject <TransactionList>(result); dateAscending = true; amountAscending = true; valueAscending = true; //used to take out the t and z out of the date information received from OpenBank for (int i = 0; i < transactionList.transactions.Count; i++) { char[] delimiters = new char[] { 'T', 'Z' }; var date = transactionList.transactions[i].details.completed.Split(delimiters); var test = string.Join(" ", date); transactionList.transactions[i].details.completed = test; } _listView = new ListView { HasUnevenRows = true, Margin = 10, SeparatorColor = Color.Teal, ItemsSource = transactionList.transactions, ItemTemplate = new DataTemplate(typeof(TransactionCell)) }; _listView.ItemSelected += (sender, e) => NavigateTo(e.SelectedItem as Transaction); }); } }); //indicates the activity indicator that all the information is loaded and ready IsBusy = false; Button graphbutton = new Button() { Text = "Graphs" }; graphbutton.Clicked += async(sender, args) => await Navigation.PushAsync(new ChartsPage()); Content = new StackLayout { BackgroundColor = Color.Teal, Spacing = 10, Children = { menuLayout, labelLayout, _listView, graphbutton } }; } catch (Exception err) { IsBusy = false; await DisplayAlert("Alert", "Internet problems cant receive information", "OK"); Debug.WriteLine("Caught error: {0}.", err); } }
//This function is used to take care of bussiness, receiving the information requseted going through the REST service used to receive information private async Task Takingcareofbussiness() { //trying to get information online if some error occurs this is caught and taken care of, a message is displayed in this case try { //indicates the activity indicator to start IsBusy = true; var rest = new ManagerRESTService(new RESTService()); var uri = String.Format(Constants.AccountUrl); //getting information from the online location await rest.GetWithToken(uri).ContinueWith(t => { //Problem occured a message is displayed to the user if (t.IsFaulted) { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Alert", "Something went wrong sorry :(", "OK"); }); } //everything went fine, information should be displayed else { Device.BeginInvokeOnMainThread(() => { ListAccounts = JsonConvert.DeserializeObject <Accounts.Account[]>(t.Result); //List used to list information received from the REST service _listView = new ListView { HasUnevenRows = true, Margin = 10, SeparatorColor = Color.Teal, ItemsSource = ListAccounts, ItemTemplate = new DataTemplate(typeof(AllAccountsCell)) }; _listView.ItemSelected += (sender, e) => NavigateTo(e.SelectedItem as Accounts.Account); }); } }); //indicates the activity indicator that all the information is loaded and ready IsBusy = false; searchBar.TextChanged += (sender, e) => FilterBanks(searchBar.Text); searchBar.SearchButtonPressed += (sender, e) => { FilterBanks(searchBar.Text); }; //Determinig the new layout containg the information received Content = new StackLayout { BackgroundColor = Color.Teal, Spacing = 10, Children = { menuLayout, searchBar, labelLayout, _listView } }; } catch (Exception err) { IsBusy = false; await DisplayAlert("Alert", "Internet problems cant receive information", "OK"); Debug.WriteLine("Caught error: {0}.", err); } }
//Used to take care of bussiness, to show the accounts detailed information private async Task Takingcareofbussiness() { //trying to get information online if some error occurs this is caught and taken care of, a message is displayed in this case try { //indicates the activity indicator to start IsBusy = true; var rest = new ManagerRESTService(new RESTService()); var uri = string.Format(AccountsPage.Href); Debug.WriteLine("uri principalpage {0}", uri); if (string.IsNullOrWhiteSpace(uri)) { Debug.WriteLine("Response contained empty body..."); } else { //getting information from the online location about the users detailed account info //in this case it can only get information from one selected account await rest.GetWithToken(uri).ContinueWith(task => { //Problem occured a message is displayed to the user if (task.IsFaulted) { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Alert", "Something went wrong sorry with your detailed information :(", "OK"); }); } //everything went fine, information should be displayed else { Device.BeginInvokeOnMainThread(() => { AccountInfo.AccountInfoDetailed Information = JsonConvert.DeserializeObject <AccountInfo.AccountInfoDetailed>(task.Result); //label for the number of this account used numberLabel = new Label() { Text = "id: " + Information.id, Margin = 2, HorizontalTextAlignment = TextAlignment.Center }; //this is your balances amount shown amountLabel = new Label() { Text = "Balance amount: " + Information.balance.amount, HorizontalTextAlignment = TextAlignment.Center, BackgroundColor = Color.Black, Margin = 2, }; //this contains the currency used currencyLabel = new Label() { Text = "Currency: " + Information.balance.currency, HorizontalTextAlignment = TextAlignment.Center, Margin = 2, }; //this is the specified bank id bankLabel = new Label() { Text = "bank: " + Information.bank_id, HorizontalTextAlignment = TextAlignment.Center, Margin = 2, BackgroundColor = Color.Black }; //this is your iban may be empty in some cases ibanLabel = new Label() { Text = "IBAN: " + Information.IBAN, Margin = 2, HorizontalTextAlignment = TextAlignment.Center }; //this is your swift/bic numbers used, may be empty in some cases swiftLabel = new Label() { Text = "swift/bic: " + Information.swift_bic, HorizontalTextAlignment = TextAlignment.Center, Margin = 2, BackgroundColor = Color.Black }; //this is the type of account that you have, in some cases may be empty typeLabel = new Label() { Text = "type: " + Information.type, Margin = 2, HorizontalTextAlignment = TextAlignment.Center }; //Layout of the accounts detailed information AccountLayout = new StackLayout() { BackgroundColor = Color.Gray, Margin = 10, Children = { numberLabel, amountLabel, currencyLabel, bankLabel, ibanLabel, swiftLabel, typeLabel } }; }); } }); } //indicates the activity indicator that all the information is loaded and ready IsBusy = false; Content = new StackLayout { BackgroundColor = Color.Teal, Spacing = 10, Children = { menuLayout, AccountLayout, ButtonLayout } }; } catch (Exception err) { IsBusy = false; await DisplayAlert("Alert", "There was a problem sorry :(", "OK"); Debug.WriteLine("Caught error principalpage: {0}.", err); } }
//Taking care of bussiness, verifyifing if the information received of the transaction history is correct private async Task Takingcareofbussiness() { //trying to get information online if some error occurs this is caught and taken care of, a message is displayed in this case try { //indicates the activity indicator to start IsBusy = true; var rest = new ManagerRESTService(new RESTService()); Debug.WriteLine("Clicked transaction button"); var uri = String.Format(Constants.MovementUrl, AccountsPage.Bankid, AccountsPage.Accountid); //getting information from the online location await rest.GetWithToken(uri).ContinueWith(t => { //Problem occured a message is displayed to the user if (t.IsFaulted) { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Alert", "Something went wrong sorry :(", "OK"); }); } //everything went fine, information should be displayed else { Device.BeginInvokeOnMainThread(() => { var result = t.Result; Transactions.TransactionList jsonObject = JsonConvert.DeserializeObject <Transactions.TransactionList>(result); foreach (Transactions.Transaction t1 in jsonObject.transactions) { var changevalue = t1.details.value.amount.Replace(".", ","); Debug.WriteLine("changevalue {0}", changevalue); var changebalance = t1.details.new_balance.amount.Replace(".", ","); Debug.WriteLine("changebalance {0}", changebalance); t1.details.value.amount = changevalue; t1.details.new_balance.amount = changebalance; } List <double> newBalanceList = jsonObject.transactions.Select(x => double.Parse(x.details.new_balance.amount)) .ToList(); List <double> valueList = jsonObject.transactions.Select(x => double.Parse(x.details.value.amount)).ToList(); List <String> completedDateList = jsonObject.transactions.Select(x => x.details.completed).ToList(); //Collection of the value amount and the dates of the transactions made ObservableCollection <ChartDataPoint> chartsvalue = new ObservableCollection <ChartDataPoint>(); //Collection of the users new balance amounts and the dates of the changes that may have occured ObservableCollection <ChartDataPoint> chartsnewbalance = new ObservableCollection <ChartDataPoint>(); //adding the information to each of the charts collections for (var i = 0; i < jsonObject.transactions.Count; i++) { chartsvalue.Add(new ChartDataPoint(completedDateList[i], valueList[i])); Debug.WriteLine("Date :: {0} amount ::{1}", completedDateList[i], valueList[i]); chartsnewbalance.Add(new ChartDataPoint(completedDateList[i], newBalanceList[i])); Debug.WriteLine("Date :: {0} newbalance ::{1}", completedDateList[i], newBalanceList[i]); } Debug.WriteLine("chartsvalue::{0}", chartsvalue.Count); Debug.WriteLine("chartsnewbalance :: {0}", chartsnewbalance.Count); //creates a column series allowing for some animation and for the user to select and see inforamtion chart.Series.Add(new ColumnSeries() { ItemsSource = chartsnewbalance, Label = "NewBalance", Color = Color.Teal, EnableAnimation = true, AnimationDuration = 0.8, EnableTooltip = true }); //Creates a line series allowing for some animation and for the user to select and see inforamtion chart.Series.Add(new ColumnSeries() { ItemsSource = chartsvalue, Label = "Value", Color = Color.Blue, EnableAnimation = true, AnimationDuration = 0.8, EnableTooltip = true }); //To show the items used creating a chart legend chart.Legend = new ChartLegend(); }); } }); //indicates the activity indicator that all the information is loaded and ready IsBusy = false; Content = chart; } catch (Exception err) { IsBusy = false; await DisplayAlert("Alert", "Internet problems cant receive information", "OK"); Debug.WriteLine("Caught error: {0}.", err); } }
//used to take care of bussines to receive the card information of the user// OpenBank contains no known information on this private async Task Takingcareofbussiness() { //trying to get information online if some error occurs this is caught and taken care of, a message is displayed in this case try { //indicates the activity indicator to start IsBusy = true; var rest = new ManagerRESTService(new RESTService()); Debug.WriteLine("Clicked transaction button"); var uri = String.Format(Constants.CardsUrl, AccountsPage.Bankid); //getting information from the online location await rest.GetWithToken(uri).ContinueWith(t => { //Problem occured a message is displayed to the user if (t.IsFaulted) { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Alert", "Something went wrong sorry :(", "OK"); }); } //everything went fine, information should be displayed else { Device.BeginInvokeOnMainThread(() => { _listView = new ListView { BackgroundColor = Color.Gray, HasUnevenRows = true }; //Must change this _listView.ItemsSource = t.Result; _listView.ItemTemplate = new DataTemplate(typeof(Cells)); }); } }); //indicates the activity indicator that all the information is loaded and ready IsBusy = false; Content = new StackLayout { BackgroundColor = Color.Teal, Spacing = 10, Children = { new Label { Text = "Card list go up and down", HorizontalTextAlignment = TextAlignment.Center }, _listView } }; } catch (Exception err) { IsBusy = false; await DisplayAlert("Alert", "Internet problems cant receive information", "OK"); Debug.WriteLine("Caught error: {0}.", err); } }