예제 #1
0
 void UpdateForm2()
 {
     // Set status labels.
     StatusIsAdminLabel.Text = WinAPI.IsVista
                         ? string.Format("Elevated: {0}", WinAPI.IsElevated())
                         : "";
     StatusIniLabel.Text = SettingManager.IniFileName;
     CheckEncoding(SettingManager.TmpFileName);
     CheckEncoding(SettingManager.IniFileName);
     // Show status values.
     MainStatusStrip.Visible = true;
     // Load PAD controls.
     ControlPads = new PadControl[4];
     for (int i = 0; i < ControlPads.Length; i++)
     {
         ControlPads[i]      = new Controls.PadControl(i);
         ControlPads[i].Name = string.Format("ControlPad{0}", i + 1);
         ControlPads[i].Dock = DockStyle.Fill;
         ControlPages[i].Controls.Add(ControlPads[i]);
         ControlPads[i].InitPadControl();
     }
     // Initialize pre-sets. Execute only after name of cIniFile is set.
     SettingsDatabasePanel.InitPresets();
     // Allow events after PAD control are loaded.
     MainTabControl.SelectedIndexChanged += new System.EventHandler(this.MainTabControl_SelectedIndexChanged);
     // Load about control.
     ControlAbout      = new AboutControl();
     ControlAbout.Dock = DockStyle.Fill;
     AboutTabPage.Controls.Add(ControlAbout);
     // Update settings map.
     UpdateSettingsMap();
     ReloadXinputSettings();
     //// start capture events.
     if (WinAPI.IsVista && WinAPI.IsElevated() && WinAPI.IsInAdministratorRole)
     {
         this.Text += " (Administrator)";
     }
 }
예제 #2
0
 void LoadForm()
 {
     formLoaded                = true;
     detector                  = new DeviceDetector(false);
     detector.DeviceChanged   += new DeviceDetector.DeviceDetectorEventHandler(detector_DeviceChanged);
     BusyLoadingCircle.Visible = false;
     BusyLoadingCircle.Top     = HeaderPictureBox.Top;
     BusyLoadingCircle.Left    = HeaderPictureBox.Left;
     defaultBody               = HelpBodyLabel.Text;
     //if (DesignMode) return;
     // init default
     OptionsPanel.InitOptions();
     // Set status.
     StatusSaveLabel.Visible   = false;
     StatusEventsLabel.Visible = false;
     // Load Tab pages.
     ControlPages    = new TabPage[4];
     ControlPages[0] = Pad1TabPage;
     ControlPages[1] = Pad2TabPage;
     ControlPages[2] = Pad3TabPage;
     ControlPages[3] = Pad4TabPage;
     //BuletImageList.Images.Add("bullet_square_glass_blue.png", new Bitmap(Helper.GetResource("Images.bullet_square_glass_blue.png")));
     //BuletImageList.Images.Add("bullet_square_glass_green.png", new Bitmap(Helper.GetResource("Images.bullet_square_glass_green.png")));
     //BuletImageList.Images.Add("bullet_square_glass_grey.png", new Bitmap(Helper.GetResource("Images.bullet_square_glass_grey.png")));
     //BuletImageList.Images.Add("bullet_square_glass_red.png", new Bitmap(Helper.GetResource("Images.bullet_square_glass_red.png")));
     //BuletImageList.Images.Add("bullet_square_glass_yellow.png", new Bitmap(Helper.GetResource("Images.bullet_square_glass_yellow.png")));
     foreach (var item in ControlPages)
     {
         item.ImageKey = "bullet_square_glass_grey.png";
     }
     // Hide status values.
     StatusDllLabel.Text     = "";
     MainStatusStrip.Visible = false;
     // Check if ini and dll is on disk.
     if (!CheckFiles(true))
     {
         return;
     }
     CheckEncoding(SettingManager.TmpFileName);
     CheckEncoding(SettingManager.IniFileName);
     // Show status values.
     MainStatusStrip.Visible = true;
     // Load PAD controls.
     ControlPads = new Controls.PadControl[4];
     for (int i = 0; i < ControlPads.Length; i++)
     {
         ControlPads[i]      = new Controls.PadControl(i);
         ControlPads[i].Name = string.Format("ControlPad{0}", i + 1);
         ControlPads[i].Dock = DockStyle.Fill;
         ControlPages[i].Controls.Add(ControlPads[i]);
         ControlPads[i].InitPadControl();
     }
     // Init presets. Execute only after name of cIniFile is set.
     SettingsDatabasePanel.InitPresets();
     // Allow events after PAD control are loaded.
     MainTabControl.SelectedIndexChanged += new System.EventHandler(this.MainTabControl_SelectedIndexChanged);
     // Load about control.
     ControlAbout      = new Controls.AboutControl();
     ControlAbout.Dock = DockStyle.Fill;
     AboutTabPage.Controls.Add(ControlAbout);
     // Update settings map.
     UpdateSettingsMap();
     ReloadXinputSettings();
     ////InitDirectInputTab();
     //// Timer will execute ReloadXInputLibrary();
     ////XInput.ReLoadLibrary(cXinput3File);
     ////XInput.ReLoadLibrary(cXinput3File);
     //// start capture events.
     if (WinAPI.IsVista && WinAPI.IsElevated() && WinAPI.IsInAdministratorRole)
     {
         this.Text += " (Administrator)";
     }
     ////ReloadXInputLibrary();
 }