void SaveReleationsEvent(object sender, EventArgs e) { if (CURRENTDISPLAYEDRELATION.Count < 1) { return; } SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "Relation Files (*.rl)|*.rl"; saveFileDialog1.Title = "Save Relations"; saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string filePath; saveFileDialog1.ShowDialog(); filePath = saveFileDialog1.FileName; string[] pathParts = filePath.Split('\\'); if (pathParts.Length > 0) { MainStructure.lastOpenedLocation = pathParts[0]; for (int i = 1; i < pathParts.Length - 1; ++i) { MainStructure.lastOpenedLocation = MainStructure.lastOpenedLocation + "\\" + pathParts[i]; } } MainStructure.SaveRelationsTo(filePath); }
void listenModBtn(object sender, EventArgs e) { Button b = (Button)sender; string[] modAndRelNumber = b.Name.Split('_'); if (modAndRelNumber.Length < 2) { return; } int indx = Convert.ToInt32(modAndRelNumber[1]); int modBtn = Convert.ToInt32(modAndRelNumber[0].Replace("modBtn", "")); Relation r = CURRENTDISPLAYEDRELATION[indx]; if (MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME) == null) { MessageBox.Show("Please do the main Bind first before adding modifiers."); return; } DisableInputs(); buttonSetting = indx; modToEdit = (string)b.Content; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(listenMod); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(modSet); bw.RunWorkerAsync(); }
void LoadProfileEvent(object sendder, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = false; ofd.Filter = "Pr0file Files (*.pr0file)|*.pr0file|All filed (*.*)|*.*"; ofd.Title = "Load Pr0file"; if (MainStructure.lastOpenedLocation.Length < 1 || !Directory.Exists(MainStructure.lastOpenedLocation)) { ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } else { ofd.InitialDirectory = MainStructure.lastOpenedLocation; } string fileToOpen; if (ofd.ShowDialog() == true) { Console.WriteLine(ofd.FileName); fileToOpen = ofd.FileName; string[] pathParts = fileToOpen.Split('\\'); if (pathParts.Length > 0) { MainStructure.lastOpenedLocation = pathParts[0]; for (int i = 1; i < pathParts.Length - 1; ++i) { MainStructure.lastOpenedLocation = MainStructure.lastOpenedLocation + "\\" + pathParts[i]; } } MainStructure.LoadProfile(fileToOpen); } }
public static Bind GetBindFromButtonElement(DCSButtonBind dab, string id, string joystick, string plane) { Relation r = new Relation(); Bind b = new Bind(r); r.ISAXIS = false; string shorten = MainStructure.ShortenDeviceName(joystick); string relationName = shorten + dab.key; if (dab.modifiers != null) { foreach (Modifier m in dab.modifiers) { relationName = m.name + relationName; string reform = m.name + "§" + m.device + "§" + m.key; if (!b.AllReformers.Contains(reform)) { b.AllReformers.Add(reform); } } } r.NAME = relationName; b.JButton = dab.key; b.Joystick = joystick; r.AddNode(id, plane); return(b); }
void SaturationYSelectionChanged(object sender, EventArgs e) { TextBox cx = (TextBox)sender; int indx = Convert.ToInt32(cx.Name.Replace("txrlsaty", "")); Bind cr = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME); if (cr == null) { if (cx.Text.Length > 0) { MessageBox.Show("Please set first the button or the axis."); } else { MainStructure.ResyncRelations(); } return; } if (cx.Text.Length < 1 || cx.Text.Replace(" ", "") == ".") { return; } string cleaned = cx.Text.Replace(',', '.'); try { cr.SaturationY = Convert.ToDouble(cleaned, System.Globalization.CultureInfo.InvariantCulture); } catch { MessageBox.Show("Given SaturationY not a valid double"); } }
public void AnalyzeRawModLua(string content) { Dictionary <object, object> dct = MainStructure.CreateAttributeDictFromLua(content); foreach (KeyValuePair <object, object> kvp in dct) { string modName = (string)kvp.Key; Modifier m = new Modifier(); m.name = modName; Dictionary <object, object> innerDict = (Dictionary <object, object>)kvp.Value; if (innerDict.ContainsKey("device")) { m.device = (string)innerDict["device"]; } if (innerDict.ContainsKey("key")) { m.key = (string)innerDict["key"]; } if (innerDict.ContainsKey("switch")) { m.sw = (bool)innerDict["switch"]; } if (!modifiers.ContainsKey(modName)) { modifiers.Add(modName, m); } } }
void IncludeRelationsEvent(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = "Relation Files (*.rl)|*.rl|All filed (*.*)|*.*"; if (MainStructure.lastOpenedLocation.Length < 1 || !Directory.Exists(MainStructure.lastOpenedLocation)) { ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } else { ofd.InitialDirectory = MainStructure.lastOpenedLocation; } string[] filesToInclude; if (ofd.ShowDialog() == true) { filesToInclude = ofd.FileNames; string lastFile = filesToInclude[filesToInclude.Length - 1]; string[] pathParts = lastFile.Split('\\'); if (pathParts.Length > 0) { MainStructure.lastOpenedLocation = pathParts[0]; for (int i = 1; i < pathParts.Length - 1; ++i) { MainStructure.lastOpenedLocation = MainStructure.lastOpenedLocation + "\\" + pathParts[i]; } } MainStructure.InsertRelations(filesToInclude); } }
void ButtonSet(object sender, EventArgs e) { ActivateInputs(); int indx = buttonSetting; buttonSetting = -1; setBtns[indx].Background = Brushes.White; if (joyReader.result == null) { setBtns[indx].Content = "None"; stickLabels[indx].Content = "None"; return; } Bind cr = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME); if (cr == null) { cr = new Bind(CURRENTDISPLAYEDRELATION[indx]); MainStructure.AddBind(cr.Rl.NAME, cr); } cr.Joystick = joyReader.result.Device; cr.JButton = joyReader.result.AxisButton; setBtns[indx].Content = joyReader.result.AxisButton; Console.WriteLine(setBtns[indx].Content); stickLabels[indx].Content = joyReader.result.Device; joyReader = null; }
void DeleteRelationButton(object sender, EventArgs e) { Button b = (Button)sender; int indx = Convert.ToInt32(b.Name.Replace("deleteBtn", "")); Relation r = CURRENTDISPLAYEDRELATION[indx]; MainStructure.RemoveRelation(r); }
void FirstStart() { for (int i = 0; i < ALLBUTTONS.Count; ++i) { ALLBUTTONS[i].IsEnabled = false; } MainStructure.LoadMetaLast(); }
void OKNewJoystick(object sender, EventArgs e) { string selItem = (string)DropDownSticks.SelectedItem; if (selItem == null || selItem.Length < 1) { MessageBox.Show("No Stick selected"); } MainStructure.ExchangeSticksInBind(stickToReplace, selItem); Close(); }
void Init() { AIRCRAFT = new Dictionary <string, bool>(); AllInputs = MainStructure.GetAllInputsWithId(ID); for (int i = 0; i < AllInputs.Length; ++i) { if (!AIRCRAFT.ContainsKey(AllInputs[i].Plane)) { AIRCRAFT.Add(AllInputs[i].Plane, true); } } }
void InitDCS() { MainStructure.InitDCSData(); DropDownInstanceSelection.Items.Clear(); if (MainStructure.SelectedGame == Game.DCS) { foreach (string inst in MainStructure.DCSInstances) { DropDownInstanceSelection.Items.Add(inst); } } }
void SliderAxisSelection(object sender, EventArgs e) { CheckBox cx = (CheckBox)sender; int indx = Convert.ToInt32(cx.Name.Replace("cbxsrel", "")); Bind cr = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME); if (cr == null) { cr = new Bind(CURRENTDISPLAYEDRELATION[indx]); MainStructure.AddBind(cr.Rl.NAME, cr); } cr.Slider = cx.IsChecked; }
private void Event_GameSelectionChanged(object sender, EventArgs e) { string selected = ((ComboBoxItem)DropDownGameSelection.SelectedItem).Content.ToString(); switch (selected) { case "Digital Combat Simulator": InitDCS(); ActivateInputs(); MainStructure.LoadCleanLuas(); break; default: break; } }
void CurvitureSelectionChanged(object sender, EventArgs e) { TextBox cx = (TextBox)sender; int indx = Convert.ToInt32(cx.Name.Replace("txrlsacv", "")); Bind cr = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME); if (cr == null) { if (cx.Text.Length > 0) { MessageBox.Show("Please set first the button or the axis."); } else { MainStructure.ResyncRelations(); } return; } if (cx.Text.Length < 1 || cx.Text.Replace(" ", "") == ".") { return; } double curv = double.NaN; string cleaned = cx.Text.Replace(',', '.'); bool succ = false; try { curv = Convert.ToDouble(cleaned, System.Globalization.CultureInfo.InvariantCulture); succ = true; } catch { MessageBox.Show("Given Curviture not a valid double"); } if (succ == true) { if (cr.Curviture.Count > 0) { cr.Curviture[0] = curv; } else { cr.Curviture.Add(curv); } } }
void LoadExistingExportAndAdd(object sender, EventArgs e) { bool?overwrite = CBKeepDefault.IsChecked; bool param; if (overwrite == null) { param = true; } else if (overwrite == true) { param = false; } else { param = true; } MainStructure.WriteProfileCleanAndLoadedOverwrittenAndAdd(param); }
void modSet(object sender, EventArgs e) { ActivateInputs(); int indx = buttonSetting; buttonSetting = -1; Bind cr = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME); if (joyReader == null || cr == null) { MessageBox.Show("Something went wrong when setting a modifier. Either listener was not started correctly or the main button was not assigend beforehand."); return; } if (modToEdit != "None" && modToEdit.Length > 0) { cr.deleteReformer(modToEdit); modToEdit = ""; } if (joyReader.result == null) { MainStructure.ResyncRelations(); return; } string device; if (joyReader.result.Device == "Keyboard") { device = "Keyboard"; } else { device = "m" + joyReader.result.Device.Split('{')[1].Split('}')[0].GetHashCode().ToString().Substring(0, 5); } string nameToShow = device + joyReader.result.AxisButton; string moddedDevice = cr.JoystickGuidToModifierGuid(joyReader.result.Device); string toAdd = nameToShow + "§" + moddedDevice + "§" + joyReader.result.AxisButton; if (!cr.AllReformers.Contains(toAdd)) { cr.AllReformers.Add(toAdd); } MainStructure.ResyncRelations(); }
public void CheckAgainstDB() { DCSInput[] dbItems = MainStructure.GetAllInputsWithId(ID); List <DCSInput> toRemove = new List <DCSInput>(); List <DCSInput> toKeep = new List <DCSInput>(); for (int i = 0; i < AllInputs.Length; ++i) { DCSInput di = InputsContainPlane(dbItems, AllInputs[i].Plane); if (di != null) { if (di.Title == AllInputs[i].Title) { toKeep.Add(AllInputs[i]); } else { toKeep.Add(di); } } else { toRemove.Add(AllInputs[i]); } } for (int i = 0; i < dbItems.Length; ++i) { DCSInput di = InputsContainPlane(AllInputs, dbItems[i].Plane); if (di == null) { toKeep.Add(dbItems[i]); AIRCRAFT.Add(dbItems[i].Plane, true); } } for (int i = 0; i < toRemove.Count; ++i) { AIRCRAFT.Remove(toRemove[i].Plane); } AllInputs = toKeep.ToArray(); }
void FinishRelation(object sender, EventArgs e) { if (Current.NAME == null || Current.NAME.Length < 1) { MessageBox.Show("No Relation name set."); return; } if (Current.IsEmpty()) { MessageBox.Show("Relation has no nodes."); return; } if (MainStructure.DoesRelationAlreadyExist(Current.NAME) && !MainStructure.RelationIsTheSame(Current.NAME, Current)) { MessageBox.Show("Relation with same Name already exists."); return; } foreach (KeyValuePair <string, int> kvp in Current.GetPlaneSetState()) { if (kvp.Value > 1) { MessageBox.Show("The Plane " + kvp.Key + " has multiple Bindings in this Relation. Either get completly get rid of binding by unchecking all checkboxes of it or reduce it so that the Aircraft has only one appearance"); return; } } if (!editMode) { MainStructure.AddRelation(Current); Console.WriteLine("Adds new relation " + Current.NAME); } else { MainStructure.ResyncRelations(); Console.WriteLine("Finished Editing Relation " + Current.NAME); } Close(); }
void AxisSet(object sender, EventArgs e) { ActivateInputs(); int indx = buttonSetting; buttonSetting = -1; setBtns[indx].Background = Brushes.White; if (e == null) { setBtns[indx].Content = "None"; stickLabels[indx].Content = "None"; return; } Bind cr = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[indx].NAME); if (cr == null) { cr = new Bind(CURRENTDISPLAYEDRELATION[indx]); MainStructure.AddBind(cr.Rl.NAME, cr); } if (joyReader == null) { MessageBox.Show("Something went wrong. Joyreader is null try again."); return; } if (joyReader.result == null) { //Delete Bind MainStructure.DeleteBind(cr.Rl.NAME); MainStructure.ResyncRelations(); return; } cr.Joystick = joyReader.result.Device; cr.JAxis = joyReader.result.AxisButton; setBtns[indx].Content = joyReader.result.AxisButton; stickLabels[indx].Content = joyReader.result.Device; joyReader = null; Console.WriteLine(setBtns[indx].Content); }
void SearchQueryChanged(object sender, EventArgs e) { string[] searchwords = SearchQueryTF.Text.ToLower().Split(' '); DGSource.ItemsSource = MainStructure.SearchBinds(searchwords); }
void AppExit(object sender, EventArgs e) { MainStructure.SaveMetaLast(); }
public static Bind GetBindFromAxisElement(DCSAxisBind dab, string id, string joystick, string plane, bool inv = false, bool slid = false, bool curv = false, bool dz = false, bool sx = false, bool sy = false) { Relation r = new Relation(); Bind b = new Bind(r); string shorten = MainStructure.ShortenDeviceName(joystick); string relationName = shorten + dab.key; r.ISAXIS = true; b.JAxis = dab.key; b.Joystick = joystick; if (dab.filter != null) { b.Inverted = dab.filter.inverted; b.Curviture = dab.filter.curviture; if (b.Curviture == null) { b.Curviture = new List <double>(); } if (b.Curviture.Count < 1) { b.Curviture.Add(0.0); } b.Deadzone = dab.filter.deadzone; b.Slider = dab.filter.slider; b.SaturationX = dab.filter.saturationX; b.SaturationY = dab.filter.saturationY; } else { b.Inverted = false; b.Slider = false; b.Curviture = new List <double>(); b.Curviture.Add(0.0); b.SaturationX = 1.0; b.SaturationY = 1.0; b.Deadzone = 0; } if (inv) { relationName = relationName + "i" + b.Inverted.ToString(); } if (slid) { relationName = relationName + "s" + b.Slider.ToString(); } if (curv && b.Curviture.Count > 0) { relationName = relationName + "c" + b.Curviture[0].ToString(new CultureInfo("en-US")).Substring(0, 4); } if (dz) { relationName = relationName + "d" + b.Deadzone.ToString(new CultureInfo("en-US")).Substring(0, 4); } if (sx) { relationName = relationName + "x" + b.SaturationX.ToString(new CultureInfo("en-US")).Substring(0, 4); } if (sy) { relationName = relationName + "y" + b.SaturationY.ToString(new CultureInfo("en-US")).Substring(0, 4); } r.NAME = relationName; r.AddNode(id, plane); return(b); }
void CleanAndExport(object sender, EventArgs e) { MainStructure.WriteProfileClean(); }
public void AnalyzeRawLuaInput(string content) { if (!content.Contains('{')) { return; } string cleaned = MainStructure.GetContentBetweenSymbols(content, "{", "}"); Dictionary <object, object> dct = MainStructure.CreateAttributeDictFromLua(content); if (dct.ContainsKey("axisDiffs")) { foreach (KeyValuePair <object, object> kvp in (Dictionary <object, object>)dct["axisDiffs"]) { DCSLuaDiffsAxisElement current = new DCSLuaDiffsAxisElement(); current.Keyname = (string)kvp.Key; if (axisDiffs.ContainsKey(current.Keyname)) { axisDiffs[current.Keyname] = current; } else { axisDiffs.Add(current.Keyname, current); } if (((Dictionary <object, object>)kvp.Value).ContainsKey("name")) { current.Title = (string)((Dictionary <object, object>)kvp.Value)["name"]; } if (((Dictionary <object, object>)kvp.Value).ContainsKey("added")) { Dictionary <object, object> dictAdded = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["added"]; foreach (KeyValuePair <object, object> kvpAdded in dictAdded) { if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("key")) { DCSAxisBind dab = new DCSAxisBind(); dab.key = (string)((Dictionary <object, object>)kvpAdded.Value)["key"]; if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("filter")) { DCSAxisFilter daf = new DCSAxisFilter(); dab.filter = daf; daf.deadzone = (double)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["deadzone"]; daf.inverted = (bool)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["invert"]; daf.slider = (bool)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["slider"]; daf.saturationX = (double)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["saturationX"]; daf.saturationY = (double)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["saturationY"]; foreach (KeyValuePair <object, object> kvpCurve in (Dictionary <object, object>)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["curvature"]) { daf.curviture.Add((double)kvpCurve.Value); } } if (!current.doesAddedContainKey(dab.key)) { current.added.Add(dab); current.removeItemFromRemoved(dab.key); } } } } if (((Dictionary <object, object>)kvp.Value).ContainsKey("removed")) { Dictionary <object, object> dictRemoved = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["removed"]; foreach (KeyValuePair <object, object> kvpRemoved in dictRemoved) { if (((Dictionary <object, object>)kvpRemoved.Value).ContainsKey("key")) { DCSAxisBind dab = new DCSAxisBind(); dab.key = (string)((Dictionary <object, object>)kvpRemoved.Value)["key"]; if (!current.doesRemovedContainKey(dab.key)) { current.removed.Add(dab); current.removeItemFromAdded(dab.key); } } } } } } if (dct.ContainsKey("keyDiffs")) { foreach (KeyValuePair <object, object> kvp in (Dictionary <object, object>)dct["keyDiffs"]) { DCSLuaDiffsButtonElement current = new DCSLuaDiffsButtonElement(); current.Keyname = (string)kvp.Key; if (keyDiffs.ContainsKey(current.Keyname)) { keyDiffs[current.Keyname] = current; } else { keyDiffs.Add(current.Keyname, current); } if (((Dictionary <object, object>)kvp.Value).ContainsKey("name")) { current.Title = (string)((Dictionary <object, object>)kvp.Value)["name"]; } if (((Dictionary <object, object>)kvp.Value).ContainsKey("added")) { Dictionary <object, object> dictAdded = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["added"]; foreach (KeyValuePair <object, object> kvpAdded in dictAdded) { if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("key")) { DCSButtonBind dab = new DCSButtonBind(); dab.key = (string)((Dictionary <object, object>)kvpAdded.Value)["key"]; if (!current.doesAddedContainKey(dab.key)) { current.added.Add(dab); current.removeItemFromRemoved(dab.key); } if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("reformers")) { foreach (KeyValuePair <object, object> kvpReformers in (Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["reformers"]) { if (!dab.reformers.Contains((string)kvpReformers.Value)) { dab.reformers.Add((string)kvpReformers.Value); } } } } } } if (((Dictionary <object, object>)kvp.Value).ContainsKey("removed")) { Dictionary <object, object> dictRemoved = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["removed"]; foreach (KeyValuePair <object, object> kvpRemoved in dictRemoved) { if (((Dictionary <object, object>)kvpRemoved.Value).ContainsKey("key")) { DCSButtonBind dab = new DCSButtonBind(); dab.key = (string)((Dictionary <object, object>)kvpRemoved.Value)["key"]; if (!current.doesRemovedContainKey(dab.key)) { current.removed.Add(dab); current.removeItemFromAdded(dab.key); } } } } } } }
void RefreshRelationsToShow() { Grid grid = BaseSetupRelationGrid(); for (int i = 0; i < CURRENTDISPLAYEDRELATION.Count; i++) { Label lblName = new Label(); lblName.Name = "lblname" + i.ToString(); lblName.Foreground = Brushes.White; lblName.Content = CURRENTDISPLAYEDRELATION[i].NAME; lblName.HorizontalAlignment = HorizontalAlignment.Center; lblName.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(lblName, 0); Grid.SetRow(lblName, i); grid.Children.Add(lblName); Button editBtn = new Button(); editBtns[i] = editBtn; editBtn.Name = "editBtn" + i.ToString(); editBtn.Content = "Edit"; editBtn.Click += new RoutedEventHandler(EditRelationButton); editBtn.HorizontalAlignment = HorizontalAlignment.Center; editBtn.VerticalAlignment = VerticalAlignment.Center; editBtn.Width = 50; Grid.SetColumn(editBtn, 1); Grid.SetRow(editBtn, i); grid.Children.Add(editBtn); Button deleteBtn = new Button(); dltBtns[i] = deleteBtn; deleteBtn.Name = "deleteBtn" + i.ToString(); deleteBtn.Content = "Delete Relation"; deleteBtn.Click += new RoutedEventHandler(DeleteRelationButton); deleteBtn.HorizontalAlignment = HorizontalAlignment.Center; deleteBtn.VerticalAlignment = VerticalAlignment.Center; deleteBtn.Width = 100; Grid.SetColumn(deleteBtn, 2); Grid.SetRow(deleteBtn, i); grid.Children.Add(deleteBtn); Bind currentBind = MainStructure.GetBindForRelation(CURRENTDISPLAYEDRELATION[i].NAME); Label joystickPick = new Label(); joystickPick.Name = "joyLbl" + i.ToString(); joystickPick.Content = "None"; stickLabels[i] = joystickPick; joystickPick.Foreground = Brushes.White; if (currentBind != null) { joystickPick.Content = currentBind.Joystick; } joystickPick.Width = 500; joystickPick.HorizontalAlignment = HorizontalAlignment.Center; joystickPick.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(joystickPick, 3); Grid.SetRow(joystickPick, i); grid.Children.Add(joystickPick); Button joybtnin = new Button(); joybtnin.Name = "assignBtn" + i.ToString(); joybtnin.Content = "None"; joybtnin.HorizontalAlignment = HorizontalAlignment.Center; joybtnin.VerticalAlignment = VerticalAlignment.Center; joybtnin.Width = 100; joybtnin.Click += new RoutedEventHandler(SetBtnOrAxisEvent); setBtns[i] = joybtnin; Grid.SetColumn(joybtnin, 4); Grid.SetRow(joybtnin, i); grid.Children.Add(joybtnin); if (CURRENTDISPLAYEDRELATION[i].ISAXIS) { CheckBox cbx = new CheckBox(); cbx.Name = "cbxrel" + i.ToString(); cbx.Content = "Inverted"; cbx.Foreground = Brushes.White; cbx.HorizontalAlignment = HorizontalAlignment.Center; cbx.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(cbx, 5); Grid.SetRow(cbx, i); grid.Children.Add(cbx); CheckBox cbxs = new CheckBox(); cbxs.Name = "cbxsrel" + i.ToString(); cbxs.Content = "Slider"; cbxs.Foreground = Brushes.White; cbxs.HorizontalAlignment = HorizontalAlignment.Center; cbxs.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(cbxs, 6); Grid.SetRow(cbxs, i); grid.Children.Add(cbxs); TextBox txrl = new TextBox(); txrl.Name = "txrldz" + i.ToString(); txrl.Width = 100; txrl.Height = 24; Grid.SetColumn(txrl, 7); Grid.SetRow(txrl, i); grid.Children.Add(txrl); TextBox txrlsx = new TextBox(); txrlsx.Name = "txrlsatx" + i.ToString(); txrlsx.Width = 100; txrlsx.Height = 24; Grid.SetColumn(txrlsx, 8); Grid.SetRow(txrlsx, i); grid.Children.Add(txrlsx); TextBox txrlsy = new TextBox(); txrlsy.Name = "txrlsaty" + i.ToString(); txrlsy.Width = 100; txrlsy.Height = 24; Grid.SetColumn(txrlsy, 9); Grid.SetRow(txrlsy, i); grid.Children.Add(txrlsy); TextBox txrlcv = new TextBox(); txrlcv.Name = "txrlsacv" + i.ToString(); txrlcv.Width = 100; txrlcv.Height = 24; Grid.SetColumn(txrlcv, 10); Grid.SetRow(txrlcv, i); grid.Children.Add(txrlcv); if (currentBind != null) { joybtnin.Content = currentBind.JAxis.ToString(); cbx.IsChecked = currentBind.Inverted; cbxs.IsChecked = currentBind.Slider; txrl.Text = currentBind.Deadzone.ToString(); txrlsx.Text = currentBind.SaturationX.ToString(); txrlsy.Text = currentBind.SaturationY.ToString(); txrlcv.Text = currentBind.Curviture[0].ToString(); } else { txrl.Text = "Deadzone (Dec)"; txrlsx.Text = "SatX (Dec)"; txrlsy.Text = "SatY (Dec)"; txrlcv.Text = "Curviture (Dec)"; } txrlcv.TextChanged += new TextChangedEventHandler(CurvitureSelectionChanged); txrlsy.TextChanged += new TextChangedEventHandler(SaturationYSelectionChanged); txrlsx.TextChanged += new TextChangedEventHandler(SaturationXSelectionChanged); txrl.TextChanged += new TextChangedEventHandler(DeadzoneSelectionChanged); cbxs.Click += new RoutedEventHandler(SliderAxisSelection); cbx.Click += new RoutedEventHandler(InvertAxisSelection); txrlcv.QueryCursor += new QueryCursorEventHandler(CleanText); txrlsy.QueryCursor += new QueryCursorEventHandler(CleanText); txrlsx.QueryCursor += new QueryCursorEventHandler(CleanText); txrl.QueryCursor += new QueryCursorEventHandler(CleanText); txrlcv.QueryCursor += new QueryCursorEventHandler(CleanText); } else { Button modBtn1 = new Button(); modBtn1.Name = "modBtn1_" + i.ToString(); modBtn1.Content = "None"; modBtn1.HorizontalAlignment = HorizontalAlignment.Center; modBtn1.VerticalAlignment = VerticalAlignment.Center; modBtn1.Width = 100; modBtn1.Click += new RoutedEventHandler(listenModBtn); modBtns[1][i] = modBtn1; Grid.SetColumn(modBtn1, 7); Grid.SetRow(modBtn1, i); grid.Children.Add(modBtn1); Button modBtn2 = new Button(); modBtn2.Name = "modBtn2_" + i.ToString(); modBtn2.Content = "None"; modBtn2.HorizontalAlignment = HorizontalAlignment.Center; modBtn2.VerticalAlignment = VerticalAlignment.Center; modBtn2.Width = 100; modBtn2.Click += new RoutedEventHandler(listenModBtn); modBtns[2][i] = modBtn2; Grid.SetColumn(modBtn2, 8); Grid.SetRow(modBtn2, i); grid.Children.Add(modBtn2); Button modBtn3 = new Button(); modBtn3.Name = "modBtn3_" + i.ToString(); modBtn3.Content = "None"; modBtn3.HorizontalAlignment = HorizontalAlignment.Center; modBtn3.VerticalAlignment = VerticalAlignment.Center; modBtn3.Width = 100; modBtn3.Click += new RoutedEventHandler(listenModBtn); modBtns[3][i] = modBtn3; Grid.SetColumn(modBtn3, 9); Grid.SetRow(modBtn3, i); grid.Children.Add(modBtn3); Button modBtn4 = new Button(); modBtn4.Name = "modBtn4_" + i.ToString(); modBtn4.Content = "None"; modBtn4.HorizontalAlignment = HorizontalAlignment.Center; modBtn4.VerticalAlignment = VerticalAlignment.Center; modBtn4.Width = 100; modBtn4.Click += new RoutedEventHandler(listenModBtn); modBtns[4][i] = modBtn4; Grid.SetColumn(modBtn4, 10); Grid.SetRow(modBtn4, i); grid.Children.Add(modBtn4); //Check against mod buttons needed if (currentBind != null) { joybtnin.Content = currentBind.JButton; modBtn1.Content = currentBind.ModToDosplayString(1); modBtn2.Content = currentBind.ModToDosplayString(2); modBtn3.Content = currentBind.ModToDosplayString(3); modBtn4.Content = currentBind.ModToDosplayString(4); } } } sv.Content = grid; }
void ImportProf(object sender, EventArgs e) { if (MainStructure.selectedInstancePath == null || MainStructure.selectedInstancePath.Length < 1) { MessageBox.Show("Not Instance selected"); return; } bool inv, slid, curv, dz, sx, sy, importDefault; if (CBinv.IsChecked == true) { inv = true; } else { inv = false; } if (CBslid.IsChecked == true) { slid = true; } else { slid = false; } if (CBcurv.IsChecked == true) { curv = true; } else { curv = false; } if (CBdz.IsChecked == true) { dz = true; } else { dz = false; } if (CBsx.IsChecked == true) { sx = true; } else { sx = false; } if (CBsy.IsChecked == true) { sy = true; } else { sy = false; } if (CBimportDefault.IsChecked == true) { importDefault = true; } else { importDefault = false; } MainStructure.BindsFromLocal(importDefault, inv, slid, curv, dz, sx, sy); }