コード例 #1
0
        public void Initialize(IGoogleSpreadsheetClient client)
        {
            Reset();

            _client          = client;
            _spreadsheetData = client.SpreadsheetData;

            foreach (var importer in importers.Concat <ISpreadsheetTriggerAssetsHandler>(serializabledImporters))
            {
                importer.Initialize(client);
                importer.ExportCommand.
                Where(x => x.CanExport).
                Do(x => ExportSheets(Export(_spreadsheetData, x))).
                Subscribe().
                AddTo(LifeTime);

                importer.ImportCommand.
                Where(x => x.CanImport).
                Do(x => {
                    if (autoReloadSpreadsheetOnImport)
                    {
                        _client.ReloadAll();
                    }
                }).
                Do(x => Import(_spreadsheetData, x)).
                Subscribe().
                AddTo(LifeTime);
            }

            LifeTime.AddCleanUpAction(() => _client          = null);
            LifeTime.AddCleanUpAction(() => _spreadsheetData = null);
        }
        public void Initialize(IGoogleSpreadsheetClient client)
        {
            Reset();

            _client        = client;
            _status        = client.Status;
            _importCommand = new Subject <ISpreadsheetAssetsHandler>();
            _exportCommand = new Subject <ISpreadsheetAssetsHandler>();
        }
        public void Reset()
        {
            _client = null;
            _status = null;

            _importCommand?.Dispose();
            _exportCommand?.Dispose();

            _importCommand = null;
            _exportCommand = null;
        }
        public void Reset()
        {
            _client = null;
            _status = null;

            _importCommand?.Dispose();
            _exportCommand?.Dispose();

            _importCommand = null;
            _exportCommand = null;

            _lifeTimeDefinition.Release();
        }
        public override void Initialize(IGoogleSpreadsheetClient client)
        {
            base.Initialize(client);

            foreach (var importer in importers)
            {
                importer.Initialize(client);
                importer.ExportCommand.
                Where(x => x.CanExport).
                Do(x =>
                {
                    ExportObjects(new[] { x }, client.SpreadsheetData);
                }).
                Subscribe().
                AddTo(LifeTime);

                importer.ImportCommand.
                Where(x => x.CanImport).
                Do(x => ImportObjects(new [] { x }, client.SpreadsheetData)).
                Subscribe().
                AddTo(LifeTime);
            }
        }