예제 #1
0
        private void SelectGlobalProfile()
        {
            //Function to specifically select the Global Profile
            ProfileSearcher Searcher = new ProfileSearcher();

            CurrentProfile = Searcher.ProfileSearchByName(ProfileList, DefGlobalProf);
            LoadButtonsfromProfile(CurrentProfile.ProfName);
        }
예제 #2
0
        } //}}}

        // SELECT .. EDIT .. SAVE
        public bool SelectProfile(string profileName) // {{{
        {
            // ..     OUT .. [CurrentProfileName] [D_Profiles.Text]
            // ..   CALLS .. ui.ApplyKeySet() (KEYMAP mode)
            // .. ENABLES .. BUTTONS
            string caller = "SelectProfile(" + profileName + ")";

            if (DX1Utility.Debug)
            {
                log(caller);
            }

            // COMMIT CURRENT PROFILE CHANGES {{{
            if ((CurrentProfileName != "") && (profileName != CurrentProfileName))
            {
                if (DX1Utility.Debug)
                {
                    log("LEAVING [" + CurrentProfileName + "] PROFILE");
                }

                ui.ApplyKeySet(caller);
            }
            //}}}
            // SEARCH AND (RE)LOAD [profileName]
            ProfileSearcher Searcher       = new ProfileSearcher();
            string          newProfileName = Searcher.ProfileSearchByName(ProfileList, profileName);

            if (_LoadProfile(newProfileName))
            {
                CurrentProfileName = newProfileName;

                // BUTTONS .. f(loaded profile)
                ui.set_D_Profiles_Text(CurrentProfileName);
                return(true);
            }
            // OR CLEAR PENDING COMMIT REQUIREMENTS
            else
            {
                keyProgrammer.notify_keyMap_commit_done();
                if (ui.C1_Profile_commit.Checked)
                {
                    ui.set_C1_Profile_commit_Checked(false);
                }

                return(false);
            }
        } //}}}
예제 #3
0
        private bool SelectProfile(string profileName)
        {
            //Find the specified Profile and load its Keymap
            ProfileSearcher Searcher = new ProfileSearcher();

            CurrentProfile = Searcher.ProfileSearchByName(ProfileList, profileName);
            LoadButtonsfromProfile(CurrentProfile.ProfName);
            ProfileManuallySelected = true;
            ReBuildKeyMap();
            if (DX1UtilityActive)
            {
                V_Profiles.Text = CurrentProfile.ProfName;
            }
            else
            {
                ApplyKeySet();
            }
            return(true);
        }
예제 #4
0
        } //}}}

        public void EditProfile(string profileName) // {{{
        {
            // Cannot Edit the Global profile {{{

/*{{{
*       if(profileName == Globals.MENU_GLOBAL_PROFILE)
*       {
*           if( Environment.UserInteractive )
*               MessageBox.Show("Cannot Edit the Global profile's properties", "", MessageBoxButtons.OK);
*
*           return;
*       }
*  }}}*/
            //}}}
            // CHECK PROFILE NAME .. (NEW OR EXISTING) {{{
            ProfileSearcher   Searcher = new ProfileSearcher();
            ProfileProperties PProp    = new ProfileProperties();

            //}}}
            // [PProp DIALOG BOX] .. f(New menu entry) .. f(profile name .. from ui.D_Profiles.Text) {{{
            bool bNewProfile
                = (profileName == Globals.MENU_NEW_PROFILE)
                ;

            CurrentProfileName
                = bNewProfile
            ?  "New"
            :  Searcher.ProfileSearchByName(ProfileList, ui.get_D_Profiles_Text());

            PProp.EditProfile(CurrentProfileName);
            //}}}

            bool         clearProfile = false;
            DialogResult PPropAnswer  = PProp.ShowDialog();

            // DIALOG [CANCEL] {{{
            if (PPropAnswer != DialogResult.OK)
            {
                // if we were creating a new profile switch to the Global profile
                if (bNewProfile)
                {
                    SelectProfile(Globals.MENU_GLOBAL_PROFILE);
                }
            }
            //}}}

            // DIALOG [OK] {{{
            else
            {
                // [bNewProfile] {{{
                if (bNewProfile)
                {
                    // REJECT ALREADY EXISTING PROFILE NAME {{{
                    if (Searcher.ProfileSearchByName(ProfileList, PProp.GetProfileNameOnly()) != null)
                    {
                        if (Environment.UserInteractive)
                        {
                            MessageBox.Show("This profile already exists, you should load it first. Changes cancelled.", "", MessageBoxButtons.OK);
                        }

                        ui.set_D_Profiles_Text(Globals.MENU_NEW_PROFILE);
                    }
                    //}}}
                    else
                    {
                        // CREATE NEW PROFILE {{{
                        ui.set_D_Profiles_Text(CurrentProfileName);

                        PProp.GetEditedProfile(ref CurrentProfileName, ref clearProfile);
                        ui.add_D_Profiles_Item(CurrentProfileName);

                        ProfileList.Add(CurrentProfileName);
                        _Save_ProfileList_to_Dx1Profiles_dat();
                        //}}}
                        // [UNASSIGN ALL KEYS] {{{
                        if (clearProfile)
                        {
                            init_keyMapList();
                            ProfileManager.SaveProfile(CurrentProfileName, keyMapList);
                            SyncUI.sync("EditProfile");
                        }
                        else
                        {
                            ProfileManager.SaveProfile(CurrentProfileName, keyMapList);
                        }
                        //}}}
                    }
                }
                //}}}
                // UPDATE SELECTED PROFILE {{{
                else
                {
                    PProp.GetEditedProfile(ref CurrentProfileName, ref clearProfile);
                    if (clearProfile)
                    {
                        //Clear all the currently programmed keys on this profile
                        init_keyMapList();
                        ProfileManager.SaveProfile(CurrentProfileName, keyMapList);
                    }
                }
                //}}}
                ui.set_B_Delete_Enabled(true);
            } //}}}
        }     //}}}
예제 #5
0
        private void EditProfile(string ProfiletoEdit)
        {
            DialogResult PPropAnswer;
            bool bNewProfile = false;
            bool clearProfile = false;
            ProfileSearcher Searcher = new ProfileSearcher();

            //Disable App Change timer, so CurrentProfile doesn't get edited
            appFocusCheckTimer.Enabled = false;

            //Cannot Edit (Global) Profile
            if (ProfiletoEdit == DefGlobalProf)
            {
                MessageBox.Show("Cannot Edit the Global Profile's properties", "", MessageBoxButtons.OK);
                return;
            }

            //Determine if creating a new Profile or editing an existing profile
            ProfileProperties PProp = new ProfileProperties();
            if (ProfiletoEdit == DefCreateProf)
            {
                bNewProfile = true;
                CurrentProfile.ProfName = "New";
                PProp.EditProfile(CurrentProfile);
            }
            else
            {
                //Find the Selected profile and pass its options to the PProp Dialog
                CurrentProfile = Searcher.ProfileSearchByName(ProfileList, V_Profiles.Text);

                PProp.EditProfile(CurrentProfile);
            }

            //Determine return and either creat a new Prifile in the list, or edit the existing
            PPropAnswer = PProp.ShowDialog();
            if (PPropAnswer == DialogResult.OK)
            {
                //Select the recently edited profile
                if (bNewProfile)
                {
                    //Check to ensure profile name doesn't already exist
                    if (Searcher.ProfileSearchByName(ProfileList, PProp.GetProfileNameOnly()) != null)
                    {
                        //Profile already exists, do not create this profile
                        MessageBox.Show("This Profile Name already exists, please edit that profile.  Changes cancelled.", "", MessageBoxButtons.OK);
                        V_Profiles.Text = DefCreateProf;
                    }
                    else
                    {
                        //Create a new Profile of the detail in the PProp dialog
                        V_Profiles.Items.Add(PProp.GetEditedProfile(ref CurrentProfile, ref clearProfile));
                        V_Profiles.Text = CurrentProfile.ProfName;
                        ProfileList.Add(CurrentProfile);
                        if (clearProfile)
                        {
                            //Create all keys as Unassigned
                            InitKeyMap(ref KeyMaps);
                            SaveButtonstoProfile(CurrentProfile.ProfName);
                            ReBuildKeyMap();
                        }
                        else
                        {
                            //Save current keyset to new profile
                            SaveButtonstoProfile(CurrentProfile.ProfName);
                        }
                    }

                }
                else
                {
                    //Update the Profile that was selected already
                    PProp.GetEditedProfile(ref CurrentProfile, ref clearProfile);
                    if (clearProfile)
                    {
                        //Clear all the currently programmed keys on this profile
                        InitKeyMap(ref KeyMaps);
                        SaveButtonstoProfile(CurrentProfile.ProfName);
                    }
                }

            }
            else
            {
                //Cancel was pressed, check to see if we were creating a new profile
                //If so, switch to the Global Profile
                if (bNewProfile) { SelectProfile(DefGlobalProf); }
            }

            //Save Profile List
            SaveProfiles();

            //reenable App Change timer
            appFocusCheckTimer.Enabled = true;
        }
예제 #6
0
        private bool SelectProfile(string profileName)
        {
            //Find the specified Profile and load its Keymap
            ProfileSearcher Searcher = new ProfileSearcher();

            CurrentProfile = Searcher.ProfileSearchByName(ProfileList, profileName);
            LoadButtonsfromProfile(CurrentProfile.ProfName);
            ProfileManuallySelected = true;
            ReBuildKeyMap();
            if (DX1UtilityActive)
            { V_Profiles.Text = CurrentProfile.ProfName; }
            else
            { ApplyKeySet(); }
            return true;
        }
예제 #7
0
        private void SelectGlobalProfile()
        {
            //Function to specifically select the Global Profile
            ProfileSearcher Searcher = new ProfileSearcher();

            CurrentProfile = Searcher.ProfileSearchByName(ProfileList, DefGlobalProf);
            LoadButtonsfromProfile(CurrentProfile.ProfName);
        }
예제 #8
0
        private void EditProfile(string ProfiletoEdit)
        {
            DialogResult    PPropAnswer;
            bool            bNewProfile  = false;
            bool            clearProfile = false;
            ProfileSearcher Searcher     = new ProfileSearcher();

            //Disable App Change timer, so CurrentProfile doesn't get edited
            appFocusCheckTimer.Enabled = false;

            //Cannot Edit (Global) Profile
            if (ProfiletoEdit == DefGlobalProf)
            {
                MessageBox.Show("Cannot Edit the Global Profile's properties", "", MessageBoxButtons.OK);
                return;
            }

            //Determine if creating a new Profile or editing an existing profile
            ProfileProperties PProp = new ProfileProperties();

            if (ProfiletoEdit == DefCreateProf)
            {
                bNewProfile             = true;
                CurrentProfile.ProfName = "New";
                PProp.EditProfile(CurrentProfile);
            }
            else
            {
                //Find the Selected profile and pass its options to the PProp Dialog
                CurrentProfile = Searcher.ProfileSearchByName(ProfileList, V_Profiles.Text);

                PProp.EditProfile(CurrentProfile);
            }

            //Determine return and either creat a new Prifile in the list, or edit the existing
            PPropAnswer = PProp.ShowDialog();
            if (PPropAnswer == DialogResult.OK)
            {
                //Select the recently edited profile
                if (bNewProfile)
                {
                    //Check to ensure profile name doesn't already exist
                    if (Searcher.ProfileSearchByName(ProfileList, PProp.GetProfileNameOnly()) != null)
                    {
                        //Profile already exists, do not create this profile
                        MessageBox.Show("This Profile Name already exists, please edit that profile.  Changes cancelled.", "", MessageBoxButtons.OK);
                        V_Profiles.Text = DefCreateProf;
                    }
                    else
                    {
                        //Create a new Profile of the detail in the PProp dialog
                        V_Profiles.Items.Add(PProp.GetEditedProfile(ref CurrentProfile, ref clearProfile));
                        V_Profiles.Text = CurrentProfile.ProfName;
                        ProfileList.Add(CurrentProfile);
                        if (clearProfile)
                        {
                            //Create all keys as Unassigned
                            InitKeyMap(ref KeyMaps);
                            SaveButtonstoProfile(CurrentProfile.ProfName);
                            ReBuildKeyMap();
                        }
                        else
                        {
                            //Save current keyset to new profile
                            SaveButtonstoProfile(CurrentProfile.ProfName);
                        }
                    }
                }
                else
                {
                    //Update the Profile that was selected already
                    PProp.GetEditedProfile(ref CurrentProfile, ref clearProfile);
                    if (clearProfile)
                    {
                        //Clear all the currently programmed keys on this profile
                        InitKeyMap(ref KeyMaps);
                        SaveButtonstoProfile(CurrentProfile.ProfName);
                    }
                }
            }
            else
            {
                //Cancel was pressed, check to see if we were creating a new profile
                //If so, switch to the Global Profile
                if (bNewProfile)
                {
                    SelectProfile(DefGlobalProf);
                }
            }


            //Save Profile List
            SaveProfiles();

            //reenable App Change timer
            appFocusCheckTimer.Enabled = true;
        }