internal virtual void Edit() { // currently in "add" mode... if (_currentMode == E_Mode.add) { // check if editing is possible and switch controls CurrentEditMode = DoEdit(); // edit is possible if (CurrentEditMode != E_EditMode.no_edit) { // update button state / label UpdateButtons(); // switch to edit mode _currentMode = E_Mode.edit; } } else { // set control state ResetControlState(); // save the changes to the database SaveEditChanges(); // ask maincontroler to reload data from database and refresh all controls // maincontroler needs to take care of this since it not only settings tab MainControler.ReloadAndRefreshControls(); // reset the modes _currentMode = E_Mode.add; CurrentEditMode = E_EditMode.no_edit; } }
// ========================================================================================================================= // === internal ============================================================================================================ void PrepareFor_Internal(E_Mode inMode, string inFriendName) { /* * // check actual state of statistics... * //if(m_CurrentMode == inMode) * // return; * * // reset internal values... * m_CurrentMode = inMode; * m_StatisticsItems.Clear(); * * * // prepare data for correct statistics harvesting... * PlayerPersistentInfoData playerdata = null; * * try { * playerdata = Game.Instance.PlayerPersistentInfo.GetPlayerData_ForStatistics(); * } * catch { * PlayerPersistantInfo __ppinfo = new PlayerPersistantInfo(); * __ppinfo.InitPlayerDataFromStr(GameSaveLoadUtl.OpenReadPlayerData().GetString("PPI")); * playerdata = __ppinfo.GetPlayerData_ForStatistics(); * } * * List<FriendInfo> friendsData = new List<FriendInfo>(); * * if(inMode == E_Mode.CompareWithFriend) * { * if(string.IsNullOrEmpty(inFriendName) == false) * { * FriendInfo fi = GameCloudManager.friendList.friends.Find(f => f.m_Name == inFriendName); * if(fi != null && fi.m_PPIData != null) * { * friendsData.Add(fi); * } * } * else * { * Debug.LogError("Invalid friend name: " + inFriendName); * } * } * else if(inMode == E_Mode.CompareWithBest) * { * friendsData = GameCloudManager.friendList.friends; * } * * * // and now harvest all interesting statistics from player and friends data... * m_StatisticsItems = HarvestStatistics(playerdata, friendsData); */ m_StatisticsItems = HarvestStatistics(null, null); }
public TabControlerBase(MainWindow window, MainWindowControler mainControler) : base(window) { MainControler = mainControler; // register events CountryControl.Leaving += CountryControl_Leaving; AreaControl.Leaving += AreaControl_Leaving; AreaControl.LeavingViaShift += AreaControl_Leaving_LeavingViaShift; SubAreaControl.Leaving += SubAreaControl_Leaving; SubAreaControl.LeavingViaShift += SubAreaControl_LeavingViaShift; SubjectLocationControl.Leaving += SubjectLocationControl_Leaving; SubjectLocationControl.LeavingViaShift += SubjectLocationControl_LeavingViaShift; _currentMode = E_Mode.add; }
// ------------------------------------------------------------------------------------------------------------------------- public void Clear() { m_CurrentMode = E_Mode.None; m_StatisticsItems.Clear(); }
// ------------------------------------------------------------------------------------------------------------------------- public void PrepareFor(E_Mode inMode, string inFriendName) { PrepareFor_Internal(inMode, inFriendName); }