Exemplo n.º 1
0
        private void Tree_ItemSelected(TreeViewItemVM sender)
        {
            Tab.SetPreview(sender.BitmapSource);

            statusBar = "";
            int size = sender.PersonaFile.GameData.GetSize();

            statusBar = "Size: " + String.Format("0x{0:X8}", size) + " (" + size + ")";
            Notify("StatusBar");
        }
Exemplo n.º 2
0
 private void Tree_ItemAction(TreeViewItemVM sender, UserTreeViewItemEventEnum action)
 {
     if (action == UserTreeViewItemEventEnum.Selected)
     {
         Tree_ItemSelected(sender);
     }
     else if (action == UserTreeViewItemEventEnum.Open)
     {
         Tree_ItemOpen(sender);
     }
 }
Exemplo n.º 3
0
        private void Update(GameFile newObject)
        {
            if (newObject.GameData is IGameData item)
            {
                UpdateContextMenu();

                _subItems.Clear();

                var list = item.SubFiles;
                foreach (var a in list)
                {
                    TreeViewItemVM temp = new TreeViewItemVM(a);
                    temp.ItemAction += SubFile_ItemAction;
                    _subItems.Add(temp);
                }
            }
            if (newObject.GameData is IImage image)
            {
                BitmapSource = image.GetBitmap().GetBitmapSource();
            }
        }
Exemplo n.º 4
0
        public void SetRoot(GameFile personaFile)
        {
            if (tree.Count > 0)
            {
                if (!tree[0].Close())
                {
                    return;
                }
            }

            tree.Clear();

            TreeViewItemVM item = new TreeViewItemVM(personaFile);

            item.ItemAction += Item_Action;
            tree.Add(item);

            if (personaFile.GameData.Type == FormatEnum.PTP)
            {
                ItemAction(item, UserTreeViewItemEventEnum.Open);
            }
        }
Exemplo n.º 5
0
 private void Item_Action(TreeViewItemVM sender, UserTreeViewItemEventEnum action) => ItemAction?.Invoke(sender, action);
Exemplo n.º 6
0
        public bool Open(TreeViewItemVM sender)
        {
            if (!sender.CanEdit())
            {
                MessageBox.Show(String.Format("Can't open {0}", sender.Header));
                return(false);
            }

            object DataContext;
            string Title = sender.PersonaFile.Name;

            switch (sender.PersonaFile.GameData.Type)
            {
            case FormatEnum.SPR:
                DataContext = new SPREditorVM(sender.PersonaFile.GameData as SPR);
                break;

            case FormatEnum.SPD:
                DataContext = new SPDEditorVM(sender.PersonaFile.GameData as SPD);
                break;

            case FormatEnum.PTP:
                DataContext = new PTPEditorVM(sender.PersonaFile.GameData as PTP);
                break;

            case FormatEnum.BMD:
                DataContext = new BMDEditorVM(sender.PersonaFile);
                break;

            case FormatEnum.FTD:
                DataContext = new FTDEditorVM(sender.PersonaFile.GameData as FTD);
                break;

            case FormatEnum.FNT:
                DataContext = new FNTEditorVM(sender.PersonaFile.GameData as FNT);
                break;

            case FormatEnum.FNT0:
                DataContext = new FNT0EditorVM(sender.PersonaFile.GameData as FNT0);
                break;

            case FormatEnum.DAT:
                DataContext = new HEXEditorVM(sender.PersonaFile.GameData as DAT);
                break;

            default:
                return(false);
            }

            ClosableTabItemVM closableTabItemVM = new ClosableTabItemVM();

            closableTabItemVM.DataContext      = DataContext;
            closableTabItemVM.TabTitle         = Title;
            closableTabItemVM.PropertyChanged += ClosableTabItemVM_PropertyChanged;
            closableTabItemVM.PersonaFile      = sender;

            tabCollection.Add(closableTabItemVM);
            SelectedTabIndex = tabCollection.IndexOf(closableTabItemVM);

            sender.UnEnable();
            return(true);
        }
Exemplo n.º 7
0
 private void Tree_ItemSaveAs(TreeViewItemVM sender)
 {
 }
Exemplo n.º 8
0
 private void Tree_ItemOpen(TreeViewItemVM sender)
 {
     MainWindowType = "Single";
     Tab.Open(sender);
 }