Ejemplo n.º 1
0
        internal static async Task <Saturns5DashboardRepository> GetAsync(DataRepository dataRepository, string spreadsheetId)
        {
            //
            Saturns5DashboardRepository saturns5DashboardRepository = new Saturns5DashboardRepository(spreadsheetId);

            // Assign provided data repository.
            saturns5DashboardRepository._dataRepository = dataRepository;

            // Get live spreadsheets database reference.
            LiveSpreadsheetsDb db = saturns5DashboardRepository._dataRepository.GoogleService.SpreadsheetsDb;

            // Load spreadsheet containing saturns dashboard.
            await db.LoadSpreadsheetAsync(saturns5DashboardRepository.Saturns5Dashboard_SpreadsheetId);

            // Get and assign reference to Saturn5_Dashboard spreadsheet and sheet
            saturns5DashboardRepository._dashboardSpreadsheet = db[saturns5DashboardRepository.Saturns5Dashboard_SpreadsheetId];
            saturns5DashboardRepository._dashboardSheet       = saturns5DashboardRepository._dashboardSpreadsheet[Saturns5DashboardRepository.Saturns5Dashboard_SheetId];

            // Re build serialNumber-rowIndex association index
            saturns5DashboardRepository.ReBuildDashboardSerialNumberIndex();

            saturns5DashboardRepository._dataRepository.UsersDB.UserSpreadsheetLoaded   += saturns5DashboardRepository.OnUserSpreadsheetLoaded;
            saturns5DashboardRepository._dataRepository.UsersDB.UserSpreadsheetAdded    += saturns5DashboardRepository.OnUserSpreadsheetAdded;
            saturns5DashboardRepository._dataRepository.UsersDB.UserSpreadsheetReplaced += saturns5DashboardRepository.OnUserSpreadsheetReplaced;
            saturns5DashboardRepository._dataRepository.UsersDB.UserSpreadsheetRemoved  += saturns5DashboardRepository.OnUserSpreadsheetRemoved;

            //
            return(saturns5DashboardRepository);
        }
        internal static async Task <Saturns5MovementRepository> GetAsync(DataRepository dataRepository, string spreadsheetId)
        {
            //
            Saturns5MovementRepository saturns5MovementRepository = new Saturns5MovementRepository(spreadsheetId);

            // Assign provided data repository.
            saturns5MovementRepository._dataRepository = dataRepository;

            // Get live spreadsheets database reference.
            LiveSpreadsheetsDb db = saturns5MovementRepository._dataRepository.GoogleService.SpreadsheetsDb;

            // Load spreadsheet containing saturns dashboard.
            await db.LoadSpreadsheetAsync(saturns5MovementRepository.Saturns5Movement_SpreadsheetId);

            // Get and assign reference to Movement spreadsheet and sheet
            saturns5MovementRepository._dashboardSpreadsheet = db[saturns5MovementRepository.Saturns5Movement_SpreadsheetId];
            saturns5MovementRepository._movementSheet        = saturns5MovementRepository._dashboardSpreadsheet[Saturns5MovementRepository.Saturns5Movement_SheetId];

            return(saturns5MovementRepository);
        }