예제 #1
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     ViewModelsController.Init();
     while (!_isShutdowned)
     {
         using (var scope = ViewModelsController.GetScope())
         {
             var scopeProvider = scope.ServiceProvider;
             var auth          = new Authorization();
             auth.ShowDialog();
             DataService ds = scopeProvider.GetRequiredService <DataService>();
             if (auth.file == null)
             {
                 this.Shutdown(3);
                 return;
             }
             else
             {
                 var res = ds.Init(auth.file, auth.password);
                 if (!res)
                 {
                     MessageBox.Show("Bad password!");
                     continue;
                 }
                 else
                 {
                     var vm = scopeProvider.GetRequiredService <EncoderWindowVM>();
                     vm.AccountName = new string(auth.file.Name.Take(auth.file.Name.LastIndexOf(auth.file.Extension)).ToArray());
                     new EncoderWindow(vm).ShowDialog();
                 }
             }
         }
     }
 }
예제 #2
0
 private void Application_Exit(object sender, ExitEventArgs e)
 {
     _isShutdowned = true;
     ViewModelsController.Unload();
 }