Beispiel #1
0
 protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     base.OnPanelMessage(panelName, msgType, msgParams);
     if (msgType == "button_clicked")
     {
         if (panelName == "createButton")
         {
             this._enterProfileNameDialog = this._app.UI.CreateDialog((Dialog) new GenericTextEntryDialog(this._app, App.Localize("@PROFILE_DIALOG"), App.Localize("@PROFILE_CREATE_DIALOG"), App.Localize("@GENERAL_DEFACTO"), 16, 2, true, EditBoxFilterMode.ProfileName), null);
         }
         else if (panelName == "deleteButton")
         {
             this._confirmDeleteDialog = this._app.UI.CreateDialog((Dialog) new GenericQuestionDialog(this._app, App.Localize("@DELETE_HEADER"), string.Format(App.Localize("@DELETE_DIALOG"), (object)Profile.GetAvailableProfiles()[this._selection].ProfileName), "dialogGenericQuestion"), null);
         }
         else
         {
             if (!(panelName == "okButton"))
             {
                 return;
             }
             List <Profile> availableProfiles = Profile.GetAvailableProfiles();
             this._app.UserProfile = availableProfiles[this._selection];
             this._app.GameSettings.LastProfile = availableProfiles[this._selection].ProfileName;
             this._app.GameSettings.Save();
             if (!HotKeyManager.GetAvailableProfiles().Contains(this._app.UserProfile.ProfileName))
             {
                 this._app.HotKeyManager.CreateProfile(this._app.UserProfile.ProfileName);
             }
             this._app.HotKeyManager.LoadProfile(this._app.UserProfile.ProfileName, false);
             this._app.UI.CloseDialog((Dialog)this, true);
         }
     }
     else if (msgType == "dialog_closed")
     {
         if (panelName == this._enterProfileNameDialog)
         {
             if (!bool.Parse(msgParams[0]))
             {
                 return;
             }
             foreach (Profile availableProfile in Profile.GetAvailableProfiles())
             {
                 if (availableProfile.ProfileName == msgParams[1])
                 {
                     this._enterProfileNameDialog = this._app.UI.CreateDialog((Dialog) new GenericTextEntryDialog(this._app, App.Localize("@PROFILE_DIALOG"), App.Localize("@PROFILE_CREATE_DIALOG"), App.Localize("@GENERAL_DEFACTO"), 16, 2, false, EditBoxFilterMode.ProfileName), null);
                     this._app.UI.CreateDialog((Dialog) new GenericTextDialog(this._app, App.Localize("@ALREADY_EXISTS"), App.Localize("@ALREADY_EXISTS_TEXT"), "dialogGenericMessage"), null);
                     return;
                 }
             }
             new Profile().CreateProfile(msgParams[1]);
             this.RefreshProfileList();
         }
         else
         {
             if (!(panelName == this._confirmDeleteDialog) || !bool.Parse(msgParams[0]))
             {
                 return;
             }
             List <Profile> availableProfiles = Profile.GetAvailableProfiles();
             availableProfiles[this._selection].DeleteProfile();
             if (availableProfiles.Count <Profile>() == 1)
             {
                 this._enterProfileNameDialog = this._app.UI.CreateDialog((Dialog) new GenericTextEntryDialog(this._app, App.Localize("@PROFILE_DIALOG"), App.Localize("@PROFILE_CREATE_DIALOG"), App.Localize("@GENERAL_DEFACTO"), 16, 2, false, EditBoxFilterMode.ProfileName), null);
             }
             this.RefreshProfileList();
         }
     }
     else
     {
         if (!(msgType == "list_sel_changed"))
         {
             return;
         }
         this._selection = int.Parse(msgParams[0]);
     }
 }