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;
        }
        public ExchangeStick(string toReplace)
        {
            InitializeComponent();
            List <string> sticks = JoystickReader.GetConnectedJoysticks();

            DropDownSticks.ItemsSource = sticks;
            JsToReplace.Content        = toReplace;
            stickToReplace             = toReplace;
            CancelJoyExchange.Click   += new RoutedEventHandler(CancelJoystick);
            OKJoyExchange.Click       += new RoutedEventHandler(OKNewJoystick);
        }
 public MainWindow()
 {
     AppDomain.CurrentDomain.UnhandledException       += NBug.Handler.UnhandledException;
     Application.Current.DispatcherUnhandledException += NBug.Handler.DispatcherUnhandledException;
     InitializeComponent();
     CURRENTDISPLAYEDRELATION = new List <Relation>();
     MessageBox.Show("Please Backup your existing binds. C:\\Users\\USERNAME\\Saved Games\\DCS Please make a backup of these folders somewhere outside your savegames.");
     ALLBUTTONS = new List <Button>();
     ALLBUTTONS.Add(LoadRelationsBtn);
     ALLBUTTONS.Add(SaveRelationsBtn);
     ALLBUTTONS.Add(AddRelationsBtn);
     ALLBUTTONS.Add(IncludeRelationsBtn);
     ALLBUTTONS.Add(MEBWEAKEBtn);
     ALLBUTTONS.Add(CEBAEBtn);
     ALLBUTTONS.Add(MEBWEAOEBtn);
     ALLBUTTONS.Add(SaveProfileBtn);
     ALLBUTTONS.Add(LoadProfileBtn);
     ALLBUTTONS.Add(MEBWEAABBtn);
     ALLBUTTONS.Add(ImportProfileBtn);
     ALLWINDOWS          = new List <Window>();
     MainStructure.mainW = this;
     DropDownGameSelection.SelectionChanged += new SelectionChangedEventHandler(Event_GameSelectionChanged);
     AddRelationsBtn.Click                      += new RoutedEventHandler(Event_AddRelation);
     App.Current.MainWindow.Closing             += new System.ComponentModel.CancelEventHandler(ProgramClosing);
     LoadRelationsBtn.Click                     += new RoutedEventHandler(LoadRelationsEvent);
     IncludeRelationsBtn.Click                  += new RoutedEventHandler(IncludeRelationsEvent);
     LoadProfileBtn.Click                       += new RoutedEventHandler(LoadProfileEvent);
     SaveRelationsBtn.Click                     += new RoutedEventHandler(SaveReleationsEvent);
     SaveProfileBtn.Click                       += new RoutedEventHandler(SaveProfileEvent);
     DropDownInstanceSelection.SelectionChanged += new SelectionChangedEventHandler(InstanceSelectionChanged);
     MEBWEAKEBtn.Click      += new RoutedEventHandler(LoadExistingExportKeepExisting);
     MEBWEAOEBtn.Click      += new RoutedEventHandler(LoadExistingExportOverwrite);
     CEBAEBtn.Click         += new RoutedEventHandler(CleanAndExport);
     MEBWEAABBtn.Click      += new RoutedEventHandler(LoadExistingExportAndAdd);
     ImportProfileBtn.Click += new RoutedEventHandler(ImportProf);
     FirstStart();
     joyReader                 = null;
     buttonSetting             = -1;
     Application.Current.Exit += new ExitEventHandler(AppExit);
 }
        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 listenAxis(object sender, EventArgs e)
 {
     joyReader = new JoystickReader(true);
 }
 void listenButton(object sender, EventArgs e)
 {
     joyReader = new JoystickReader(false);
 }
 void listenMod(object sender, EventArgs e)
 {
     joyReader = new JoystickReader(false, true);
 }