Ejemplo n.º 1
0
    public async Task SaveSettings(DomainSettings Settings) {
      string json = await Task.Run(() => JsonConvert.SerializeObject(Settings, Formatting.Indented));

      if (!await Task.Run(() => File.Exists(Filename))) await Task.Run(() => Directory.CreateDirectory(Path.GetDirectoryName(Filename)));

      await Task.Run(() => File.WriteAllText(Filename, json));
    }
Ejemplo n.º 2
0
    public UpkManagerController(UpkManagerViewModel ViewModel, MainMenuViewModel MenuViewModel, IMessenger Messenger, ISettingsRepository SettingsRepository, IExceptionRepository ExceptionRepository, IMapper Mapper) {
      if (Application.Current != null) Application.Current.DispatcherUnhandledException += onCurrentDispatcherUnhandledException;

      AppDomain.CurrentDomain.UnhandledException += onDomainUnhandledException;

      Dispatcher.CurrentDispatcher.UnhandledException += onCurrentDispatcherUnhandledException;

      TaskScheduler.UnobservedTaskException += onUnobservedTaskException;

      System.Windows.Forms.Application.ThreadException += onThreadException;

          viewModel =     ViewModel;
      menuViewModel = MenuViewModel;

      messenger = Messenger;

      settingsRepository  = SettingsRepository;
      exceptionRepository = ExceptionRepository;

      mapper = Mapper;

      settings = Task.Run(() => settingsRepository.LoadSettingsAsync()).Result;

      viewModel.Settings = mapper.Map<SettingsWindowViewEntity>(settings);

      registerMessages();
      registerCommands();
    }
Ejemplo n.º 3
0
    public async Task<DomainSettings> LoadSettingsAsync() {
      DomainSettings settings;

      if (await Task.Run(() => File.Exists(Filename))) {
        settings = await Task.Run(() => JsonConvert.DeserializeObject<DomainSettings>(File.ReadAllText(Filename)));

        if (settings.WindowW.EqualInPercentRange(0)) {
          settings.WindowW = 1280;
          settings.WindowH = 720;

          settings.WindowX = 100;
          settings.WindowY = 100;
        }
      }
      else settings = new DomainSettings {
        WindowW = 1280,
        WindowH = 720,

        WindowX = 100,
        WindowY = 100
      };

      return settings;
    }
Ejemplo n.º 4
0
    private async Task onApplicationLoaded(AppLoadedMessage message) {
      settings = message.Settings;

      oldPathToGame = settings.PathToGame;

      viewModel.SelectedType        = ObjectTypes.Texture2D.ToString();
      viewModel.IsShowFilesWithType = true;

      await loadAllFiles();
    }
Ejemplo n.º 5
0
    private void onApplicationLoaded(AppLoadedMessage message) {
      settings = message.Settings;

      loadExportFiles();

      setupWatchers();
    }
Ejemplo n.º 6
0
    private void onSettingsChanged(SettingsChangedMessage message) {
      settings = message.Settings;

      setupWatchers();
    }
Ejemplo n.º 7
0
 private void onSettingsChanged(SettingsChangedMessage message) {
   settings = message.Settings;
 }
Ejemplo n.º 8
0
 private void onApplicationLoaded(AppLoadedMessage message) {
   settings = message.Settings;
 }