private void MouseDoubleClick(object arg)
 {
     if (_subItems.Count == 0)
     {
         ItemAction?.Invoke(this, UserTreeViewItemEventEnum.Open);
     }
 }
 private void Item_Action(TreeViewItemVM sender, UserTreeViewItemEventEnum action) => ItemAction?.Invoke(sender, action);
Exemple #3
0
 public void Drop()
 {
     coordinates -= new Vector2(0, fallingSteps);
     fallingSteps = 0;
     dropped?.Invoke();
 }
Exemple #4
0
 public void MoveTo(Vector2 coord)
 {
     coordinates = coord;
     movedTo?.Invoke(coordinates);
     moved?.Invoke(); //for some reason this doesn't work
 }
Exemple #5
0
        private void ContextMenu_Replace()
        {
            FormatEnum fileType = PersonaFile.GameData.Type;

            OpenFileDialog OFD  = new OpenFileDialog();
            string         name = PersonaFile.Name.Replace('/', '+');

            OFD.Filter          = $"RAW(*{Path.GetExtension(name)})|*{Path.GetExtension(name)}";
            OFD.CheckFileExists = true;
            OFD.CheckPathExists = true;
            OFD.Multiselect     = false;

            if (PersonaFile.GameData is IImage)
            {
                OFD.Filter += $"|PNG (*.png)|*.png";
            }
            if (PersonaFile.GameData is ITable)
            {
                OFD.Filter += $"|XML data table (*.xml)|*.xml";
            }
            if (PersonaFile.GameData is BMD)
            {
                OFD.Filter += $"|Persona Text Project (*.ptp)|*.ptp";
            }

            if (OFD.ShowDialog() == true)
            {
                if (OFD.FilterIndex == 1)
                {
                    var item = GameFormatHelper.OpenFile(PersonaFile.Name, File.ReadAllBytes(OFD.FileName), fileType);

                    if (item != null)
                    {
                        PersonaFile.GameData = item.GameData;
                    }
                }
                else
                {
                    string ext = Path.GetExtension(OFD.FileName);
                    if (ext.Equals(".png", StringComparison.CurrentCultureIgnoreCase))
                    {
                        PersonaEditorTools.OpenImageFile(PersonaFile, OFD.FileName);
                    }
                    else if (ext.Equals(".xml", StringComparison.CurrentCultureIgnoreCase))
                    {
                        PersonaEditorTools.OpenTableFile(PersonaFile, OFD.FileName);
                    }
                    else if (ext.Equals(".ptp", StringComparison.CurrentCultureIgnoreCase))
                    {
                        var result = ToolBox.Show(ToolBoxType.OpenPTP);
                        if (result == ToolBoxResult.Ok)
                        {
                            PersonaEditorTools.OpenPTPFile(PersonaFile, OFD.FileName, Static.EncodingManager.GetPersonaEncoding(ApplicationSettings.AppSetting.Default.OpenPTP_Font));
                        }
                    }
                    else
                    {
                        throw new Exception("OpenPersonaFileDialog");
                    }
                }

                Update(_personaFile);
                if (_isSelected)
                {
                    ItemAction?.Invoke(this, UserTreeViewItemEventEnum.Selected);
                }
            }
        }
Exemple #6
0
 private void ContextMenu_Edit()
 {
     ItemAction?.Invoke(this, UserTreeViewItemEventEnum.Open);
 }