Exemplo n.º 1
0
        public void DeleteCharacterFile(string characterName)
        {
            if (!CharacterFiles.ContainsKey(characterName))
            {
                return;
            }
            var path = CharacterFiles[characterName];

            CharacterFiles.Remove(characterName);
            File.Delete(path);
        }
Exemplo n.º 2
0
        public void RefreshCharacterList()
        {
            CharacterFiles.Clear();
            Directory.CreateDirectory(CharacterFolderPath);
            var charFiles = Directory.GetFiles(CharacterFolderPath, "*.d4c");

            foreach (var file in charFiles)
            {
                var charName = Path.GetFileNameWithoutExtension(file);
                CharacterFiles.Add(charName, file);
            }
        }
Exemplo n.º 3
0
        private async void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var version = Assembly.GetExecutingAssembly().GetName().Version;

            Debug.Assert(version != null, nameof(version) + " != null");
            Title = $"{Title} v{version.Major}.{version.Minor}";

            try
            {
                CharacterFiles = await Task.Run(CharacterFile.LoadCharacterFiles);

                SelectedCharacterFile = CharacterFiles.FirstOrDefault();
                CommandManager.InvalidateRequerySuggested();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }