Example #1
0
 private void HandleSaveFileButtonItemRightClick(object sender, RoutedEventArgs e)
 {
     if (((TreeViewItem)sender).DataContext is SaveFile saveFile)
     {
         saveFile.ButtonMaps.Add(ActionElementMap.GenerateEmptyActionElementMap());
     }
 }
Example #2
0
        public ActionModifyWindow(ActionElementMap actionElementMap)
        {
            ActionElementMap = actionElementMap;

            InitializeComponent();
            DataContext = this;
        }
Example #3
0
 private void HandleSaveFileAxisItemRightClick(object sender, RoutedEventArgs e)
 {
     if (((TreeViewItem)sender).DataContext is SaveFile saveFile)
     {
         Console.WriteLine("test");
         saveFile.AxisMaps.Add(ActionElementMap.GenerateEmptyActionElementMap());
     }
 }
        private static XElement ActionElementMapToXElement(ActionElementMap actionElementMap, XNamespace xNamespace)
        {
            XElement actionElementMapXElem = new XElement(xNamespace + "ActionElementMap");

            actionElementMapXElem.Add(new XElement(xNamespace + "actionCategoryId", ((int)actionElementMap.ActionCategoryId).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "actionId", ((int)actionElementMap.ActionId).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "elementType", ((int)actionElementMap.ElementType).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "elementIdentifierId", ((int)actionElementMap.ElementIdentifierId).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "axisRange", ((int)actionElementMap.AxisRange).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "invert", Convert.ToBoolean(actionElementMap.Invert).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "axisContribution", ((int)actionElementMap.AxisContribution).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "keyboardKeyCode", ((int)actionElementMap.KeyboardKeyCode).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "modifierKey1", ((int)actionElementMap.ModifierKey1).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "modifierKey2", ((int)actionElementMap.ModifierKey2).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "modifierKey3", ((int)actionElementMap.ModifierKey3).ToString()));
            actionElementMapXElem.Add(new XElement(xNamespace + "enabled", Convert.ToBoolean(actionElementMap.Enabled).ToString()));

            return(actionElementMapXElem);
        }
        private static ActionElementMap ActionElementMapFromXElement(XElement actionElementMapXelement, XNamespace xNamespace)
        {
            ActionElementMap actionElementMap = new ActionElementMap()
            {
                ActionCategoryId    = Int32.Parse(actionElementMapXelement.Element(xNamespace + "actionCategoryId").Value),
                ActionId            = (ActionId)Int32.Parse(actionElementMapXelement.Element(xNamespace + "actionId").Value),
                ElementType         = Int32.Parse(actionElementMapXelement.Element(xNamespace + "elementType").Value),
                ElementIdentifierId = (ElementIdentifierId)Int32.Parse(actionElementMapXelement.Element(xNamespace + "elementIdentifierId").Value),
                AxisRange           = Int32.Parse(actionElementMapXelement.Element(xNamespace + "axisRange").Value),
                Invert           = Boolean.Parse(actionElementMapXelement.Element(xNamespace + "invert").Value),
                AxisContribution = Int32.Parse(actionElementMapXelement.Element(xNamespace + "axisContribution").Value),
                KeyboardKeyCode  = (KeyboardKeyCode)Int32.Parse(actionElementMapXelement.Element(xNamespace + "keyboardKeyCode").Value),
                ModifierKey1     = Int32.Parse(actionElementMapXelement.Element(xNamespace + "modifierKey1").Value),
                ModifierKey2     = Int32.Parse(actionElementMapXelement.Element(xNamespace + "modifierKey2").Value),
                ModifierKey3     = Int32.Parse(actionElementMapXelement.Element(xNamespace + "modifierKey3").Value),
                Enabled          = Boolean.Parse(actionElementMapXelement.Element(xNamespace + "enabled").Value),
            };

            return(actionElementMap);
        }