Exemplo n.º 1
0
        void onOpen(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "TMF files (*.tmc)|*.tmc";

            if (openFileDialog.ShowDialog() == true)
            {
                FileCreature = openFileDialog.FileName;

                if (!File.Exists(FileCreature))
                {
                    return;
                }

                creature = TMCreature.Load(FileCreature);

                if (creature == null)
                {
                    MessageBox.Show(this, "No se pudo cargar el archivo.\nFormato desconocido.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                Title = $"{creature.name} - [{FileCreature}]";
                onLoadCreature();
            }
        }
Exemplo n.º 2
0
        void onLoaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(App.file))
            {
                FileCreature = App.file;
                creature     = TMCreature.Load(FileCreature);

                if (creature == null)
                {
                    MessageBox.Show(this, "No se pudo cargar el archivo.\nFormato desconocido.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                Title = $"{creature.name} - [{FileCreature}]";
                onLoadCreature();
                return;
            }
            onNew(sender, e);
        }