Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Globalization;
- using System.Net.Http.Headers;
- using System.Windows.Input;
- using Xamarin.Forms;
- using XamarinTest.Models;
- namespace XamarinTest.ViewModel
- {
- class ReportVM : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- ProjectModel projectModel;
- List<Tuple<int, string, string, string, string, bool, string>> report;
- internal int CurrentRow = -1;
- public List<Tuple<int, string, string, string, string, bool, string>> Report
- {
- get => report;
- private set
- {
- report = value;
- OnPropertyChanged("Report");
- }
- }
- public ICommand verificateRow { private set; get; }
- public ReportVM()
- {
- projectModel = new ProjectModel();
- Report = new List<Tuple<int, string, string, string, string, bool, string>>()
- {
- new Tuple<int, string, string, string, string, bool, string> (1, "324", "123", "1", "111",true,"-"),
- new Tuple<int,string, string, string, string, bool, string> (2, "324", "123", "1", "111",false,"-"),
- new Tuple<int,string, string, string, string, bool, string> (3, "324", "123", "1", "111",false,"-")
- };
- MessagingCenter.Subscribe(this, "Data", (SummaryVM sender, Tuple<ProjectModel, string> pSummaryData) =>
- {
- pSummaryData.Item1.calculateCoverage();
- projectModel = pSummaryData.Item1;
- Report = projectModel.getDataForGrid(pSummaryData.Item2);
- });
- verificateRow = new Command(
- execute: (object o) =>
- {
- var array = o.ToString().Trim(new char[] { ' ', '(', ')' }).Split(new char[] { ',' });
- if(array[5].Trim().Equals("True"))
- {
- CurrentRow = int.Parse(array[0].Trim());
- }
- },
- canExecute: (object o) =>
- {
- return true;
- });
- }
- internal void verificateStatusChange(string pStatus)
- {
- var tempReport = Report;
- tempReport[CurrentRow - 1] = new Tuple<int, string, string, string, string, bool, string>
- (
- Report[CurrentRow - 1].Item1,
- Report[CurrentRow - 1].Item2,
- Report[CurrentRow - 1].Item3,
- Report[CurrentRow - 1].Item4,
- "asdasd",
- Report[CurrentRow - 1].Item6,
- pStatus
- );
- Report = tempReport;
- OnPropertyChanged("Report");
- }
- protected void OnPropertyChanged(string propName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
- }
- }
- }
Add Comment
Please, Sign In to add comment