private void LoadFromStream(System.IO.Stream inStream) { UsedToSaveProgramSetv2 temp = UsedToSaveProgramSetv2.Read(inStream); KeyMaps = temp.keyMaps; ReBuildKeyMap(); mKeyProgrammer = new KeyProgrammer(ref KeyMaps); }
//}}} public Profile(DX1Utility formHandle) //{{{ { this.ui = formHandle; keyMapList = new List <KeyMap>(); keyProgrammer = new KeyProgrammer(); } //}}}
public Form1() { mKeyProgrammer = new KeyProgrammer(ref KeyMaps); SpecialKeyPlayer.InitPlayer(); notifyIcon1 = new System.Windows.Forms.NotifyIcon(); notifyIcon1.Icon = this.Icon; notifyIcon1.Text = "DX1 Utility"; notifyIcon1.MouseDoubleClick += new MouseEventHandler(notifyIcon1_MouseDoubleClick); notifyIcon1.Visible = true; InitializeComponent(); mDX1Hardware = new HardwareInterface(); mDevHandle = mDX1Hardware.OpenDevice(true); mDX1Hardware.RegisterWindowForEvents(mDevHandle, Handle); macroTimer.AutoReset = false; macroTimer.Elapsed += new System.Timers.ElapsedEventHandler(macroTimer_Elapsed); RebuildMacroList(); ControlBox = true; //Add the (Create new Profile) option to the Profile Combobox V_Profiles.Items.Add(DefCreateProf); //Create the Quick-Menu for Right-Click on NotifyIcon ContextMenu ContextMenu1 = new ContextMenu(); MenuItem ProfileMenu = new MenuItem(); ProfileMenu.Text = "Profiles"; ProfileMenu.RadioCheck = true; MenuItem ProfileSub; //Check for DX1Profiles folder if it doesn't exist, create it if (!System.IO.Directory.Exists(Globals.ProfileSavePath)) System.IO.Directory.CreateDirectory(Globals.ProfileSavePath); //Load Profile List ProfileList = (List<Profiles>)LoadProfiles(Globals.ProfileSavePath + "Dx1Profiles.dat"); //Add list of profiles to V_Profiles Combo Box and Context Menu foreach (Profiles Profile in ProfileList) { V_Profiles.Items.Add(Profile.ProfName); ProfileSub = new MenuItem(); if (Profile.QuickMenu & Profile.ProfEnabled) { ProfileSub.Text = Profile.ProfName; ProfileSub.RadioCheck = true; ProfileSub.Click += new EventHandler(ProfileSelected); ProfileMenu.MenuItems.Add(ProfileSub); } } V_Profiles.Sorted = true; //AutoSelect Global Profile //If one doesn't exist create it (For users that have run 1.1 or earlier) if (!V_Profiles.Items.Contains(DefGlobalProf)) { //No Global Profile, Create it InitKeyMap(ref KeyMaps); CurrentProfile = new Profiles(); CurrentProfile.ProfName = DefGlobalProf; ProfileList.Add(CurrentProfile); SaveButtonstoProfile(CurrentProfile.ProfName); SaveProfiles(); } SelectGlobalProfile(); //Initialize the DataGrid and KeyMap List G_KeyMap.AutoGenerateColumns = false; G_KeyMap.DataSource = KeyMaps; G_KeyMap.AllowUserToResizeRows = false; G_KeyMap.AllowUserToResizeColumns = false; //G_KeyMap.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //G_KeyMap.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; //Add Dx1Key Column DataGridViewTextBoxColumn DxColumn = new DataGridViewTextBoxColumn(); DxColumn.Width = 30; DxColumn.DataPropertyName = "Dx1Key"; DxColumn.HeaderText = "Key"; DxColumn.ReadOnly = true; DxColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; G_KeyMap.Columns.Add(DxColumn); //Add Description Column DataGridViewTextBoxColumn DescColumn = new DataGridViewTextBoxColumn(); DescColumn.Width = 120; DescColumn.DataPropertyName = "Description"; DescColumn.HeaderText = "Description"; DescColumn.ReadOnly = true; G_KeyMap.Columns.Add(DescColumn); //Finialize Quick-Menu Options for the Notify Icon ProfileMenu.Popup += new EventHandler(QuickMenuPopup); ContextMenu1.MenuItems.Add(ProfileMenu); ContextMenu1.MenuItems.Add("-"); ContextMenu1.MenuItems.Add("O&pen", new EventHandler(notifyIcon1_MouseDoubleClick)); ContextMenu1.MenuItems.Add("E&xit", new EventHandler(CloseApp)); notifyIcon1.ContextMenu = ContextMenu1; appFocusCheckTimer.AutoReset = true; appFocusCheckTimer.Interval = 1000; appFocusCheckTimer.Elapsed += new System.Timers.ElapsedEventHandler(appFocusCheckTimer_Elapsed); appFocusCheckTimer.Start(); }
public Form1() { mKeyProgrammer = new KeyProgrammer(ref KeyMaps); SpecialKeyPlayer.InitPlayer(); notifyIcon1 = new System.Windows.Forms.NotifyIcon(); notifyIcon1.Icon = this.Icon; notifyIcon1.Text = "DX1 Utility"; notifyIcon1.MouseDoubleClick += new MouseEventHandler(notifyIcon1_MouseDoubleClick); notifyIcon1.Visible = true; InitializeComponent(); mDX1Hardware = new HardwareInterface(); mDevHandle = mDX1Hardware.OpenDevice(true); mDX1Hardware.RegisterWindowForEvents(mDevHandle, Handle); macroTimer.AutoReset = false; macroTimer.Elapsed += new System.Timers.ElapsedEventHandler(macroTimer_Elapsed); RebuildMacroList(); ControlBox = true; //Add the (Create new Profile) option to the Profile Combobox V_Profiles.Items.Add(DefCreateProf); //Create the Quick-Menu for Right-Click on NotifyIcon ContextMenu ContextMenu1 = new ContextMenu(); MenuItem ProfileMenu = new MenuItem(); ProfileMenu.Text = "Profiles"; ProfileMenu.RadioCheck = true; MenuItem ProfileSub; //Check for DX1Profiles folder if it doesn't exist, create it if (!System.IO.Directory.Exists(Globals.ProfileSavePath)) { System.IO.Directory.CreateDirectory(Globals.ProfileSavePath); } //Load Profile List ProfileList = (List <Profiles>)LoadProfiles(Globals.ProfileSavePath + "Dx1Profiles.dat"); //Add list of profiles to V_Profiles Combo Box and Context Menu foreach (Profiles Profile in ProfileList) { V_Profiles.Items.Add(Profile.ProfName); ProfileSub = new MenuItem(); if (Profile.QuickMenu & Profile.ProfEnabled) { ProfileSub.Text = Profile.ProfName; ProfileSub.RadioCheck = true; ProfileSub.Click += new EventHandler(ProfileSelected); ProfileMenu.MenuItems.Add(ProfileSub); } } V_Profiles.Sorted = true; //AutoSelect Global Profile //If one doesn't exist create it (For users that have run 1.1 or earlier) if (!V_Profiles.Items.Contains(DefGlobalProf)) { //No Global Profile, Create it InitKeyMap(ref KeyMaps); CurrentProfile = new Profiles(); CurrentProfile.ProfName = DefGlobalProf; ProfileList.Add(CurrentProfile); SaveButtonstoProfile(CurrentProfile.ProfName); SaveProfiles(); } SelectGlobalProfile(); //Initialize the DataGrid and KeyMap List G_KeyMap.AutoGenerateColumns = false; G_KeyMap.DataSource = KeyMaps; G_KeyMap.AllowUserToResizeRows = false; G_KeyMap.AllowUserToResizeColumns = false; //G_KeyMap.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //G_KeyMap.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; //Add Dx1Key Column DataGridViewTextBoxColumn DxColumn = new DataGridViewTextBoxColumn(); DxColumn.Width = 30; DxColumn.DataPropertyName = "Dx1Key"; DxColumn.HeaderText = "Key"; DxColumn.ReadOnly = true; DxColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; G_KeyMap.Columns.Add(DxColumn); //Add Description Column DataGridViewTextBoxColumn DescColumn = new DataGridViewTextBoxColumn(); DescColumn.Width = 120; DescColumn.DataPropertyName = "Description"; DescColumn.HeaderText = "Description"; DescColumn.ReadOnly = true; G_KeyMap.Columns.Add(DescColumn); //Finialize Quick-Menu Options for the Notify Icon ProfileMenu.Popup += new EventHandler(QuickMenuPopup); ContextMenu1.MenuItems.Add(ProfileMenu); ContextMenu1.MenuItems.Add("-"); ContextMenu1.MenuItems.Add("O&pen", new EventHandler(notifyIcon1_MouseDoubleClick)); ContextMenu1.MenuItems.Add("E&xit", new EventHandler(CloseApp)); notifyIcon1.ContextMenu = ContextMenu1; appFocusCheckTimer.AutoReset = true; appFocusCheckTimer.Interval = 1000; appFocusCheckTimer.Elapsed += new System.Timers.ElapsedEventHandler(appFocusCheckTimer_Elapsed); appFocusCheckTimer.Start(); }