// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddTransient <ILieferant, BillaService>(); services.AddTransient <IWarenFormatter, WarenFormatter>(); services.Configure <AzureAesKeyOptions>(Configuration); services.AddTransient <IAESKeyProvider, AzureAESKeyProvider>(); services.AddTransient <ICredentialEncryption, AesCredentialEncryption>(); if (UseCosmosDb) { services.Configure <DbConnectionOptions>(Configuration); new DbAccess(new DbConnectionOptions() { DB_KEY = Configuration["DB_KEY"], DB_URI = Configuration["DB_URI"] }).InitializeDb().Wait(); services.AddTransient <IDbAccess, DbAccess>(); services.AddTransient <IWarenkorbRepository, WarenkorbRepository>(); services.AddTransient <ISucheRepository, SucheRepository>(); } else { var path = Path.Combine(HostingEnvironment.WebRootPath, "App_Data"); new FileStore.FileStore(null, path).InitializeAsync().Wait(); var provider = new PhysicalFileProvider(path); var access = new FileStore.FileStore(provider, path); services.AddSingleton <IFileProvider>(provider); services.AddSingleton <IFileStore>(access); services.AddTransient <ISucheRepository, FileStoreSucheRepository>(); services.AddTransient <IWarenkorbRepository, FileStoreWarenkorbRepository>(); services.AddTransient <IUserRepository, FileStoreUserRepository>(); } }
private void toolStripButton3_Click(object sender, EventArgs e) { StoreInfo dialog = new StoreInfo(); dialog.Store = store; dialog.ShowDialog(); store = dialog.Store; treeView1.Nodes.Clear(); BuildTreeList(null, null); }
private void LoadStore(string file) { store = new FileStore(); store.Load(file); storePath = file; if(store.Encrypt) { // show password window Password dialog = new Password(); if(dialog.ShowDialog() == DialogResult.OK) { SHA256Managed passwordHash = new SHA256Managed(); store.EncryptionKey = passwordHash.ComputeHash(Encoding.ASCII.GetBytes(dialog.textBox1.Text)); store.Load(file); } } treeView1.Nodes.Clear(); BuildTreeList(null, null); }
private void Form1_Load(object sender, EventArgs e) { toolStripStatusLabel3.Text = ""; if(store == null) { store = new FileStore(); BuildTreeList(null, null); } }