Пример #1
0
        public void AddObject <T>(T obj)
        {
            Type genType = typeof(T);

            if (genType == typeof(ConnectionConfiguration))
            {
                Connections.Add(obj as ConnectionConfiguration);
            }
            else if (genType == typeof(StorageConfiguration))
            {
                Storages.Add(obj as StorageConfiguration);
            }
        }
        private async Task LoadData()
        {
            if (this.isDataLoaded)
            {
                return;
            }

            this.isDataLoaded = true;

            var storageTypes = await this.storageStore.GetStorageAsync();

            foreach (var c in storageTypes)
            {
                Storages.Add(new StorageViewModel(c));
            }
        }
        private async Task AddStorage()
        {
            var viewModel = new StorageTypeDetailViewModel(new StorageViewModel(), this.storageStore, this.pageService);

            viewModel.StorageAdded += (source, storageType) =>
            {
                //try
                //{
                Storages.Add(new StorageViewModel(storageType));
                //}
                //catch (Exception e)
                //{
                //    Debugger.Break();
                //}
            };

            await this.pageService.PushAsync(new StorageTypeDetailView(viewModel));
        }
Пример #4
0
        //internal DocumentTransaction(DocumentEngine engine, bool isInternalTransaction)
        //{
        //    Engine = engine;
        //    TypeOf = new ConcurrentDictionary<string, List<DocumentContext>>();
        //    Storages = new List<DocumentStorage>();
        //    IsInternalTransaction = isInternalTransaction;
        //}

        internal DocumentStorage GetTransactionalStorage(string typeOf, int partition, bool isBeginOperation)
        {
            var storage = Storages.Where(s => s.TypeOf == typeOf && s.Partition == partition)
                          .FirstOrDefault();

            if (storage == null)
            {
                storage = new DocumentStorage(typeOf, Engine.Provider.BaseDirectory, partition);

                if (isBeginOperation)
                {
                    storage.BeginOperation();
                }

                Storages.Add(storage);
            }

            return(storage);
        }
Пример #5
0
        private void LoadStorages()
        {
            foreach (var storage in Settings.GlobalSettings.Data.Storages)
            {
                Storages.Add(new NetworkStorage(storage.UploadURL, storage.DownloadURL));
            }

            Storages.Add(new GDriveStorage());

            var targetStorage = Settings.GlobalSettings.Data.ActiveStorage;

            if (!String.IsNullOrEmpty(targetStorage))
            {
                Storage = Storages.FirstOrDefault(s => (s.DisplayName == targetStorage));
            }

            if (Storage == null && Storages.Count > 0)
            {
                Storage = Storages[0];
            }
        }
        private void OnStorageCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (var item in e.NewItems)
                {
                    var model = item as NetworksStorageModel;
                    Storages.Add(model.GetViewModel());
                }
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (var item in e.OldItems)
                {
                    var model = item as NetworksStorageModel;
                    Storages.Remove(Storages.First(s => s.Id == model.Id.ToString()));
                }
                break;
            }
        }
Пример #7
0
 public void ReportStorageRead(StorageCell storageCell)
 {
     // implicit knowledge here that if we read storage then for sure we have at least asked for the account's balance
     // and so we do not need to add account to Accounts
     Storages.Add(storageCell);
 }