private void Initialization(string token) { Log.DebugFormat("[Pilot.Initialization] starting for token = {0}", token); EsiData = new EsiAuthorization(Global.ApplicationSettings.Authorization_ClientId, Global.ApplicationSettings.Authorization_ClientSecret); EsiData.Authorization(token); RefreshToken = EsiData.RefreshToken; dynamic data = EsiData.ObtainingCharacterData(); Id = data.CharacterID; Name = data.CharacterName; LoadLocationInfo(); if (Key == null) { Key = Name + "'s map"; } if (Location.Name != "unknown") { SpaceMap = new Map.Map { Key = Key, ActivePilot = Name, SelectedSolarSystemName = Location.Name }; SpaceMap.Activate(Name, Location.Name); SpaceMap.ApiPublishSolarSystem(Name, Key, null, LocationCurrentSystemName); OnEnterToSolarSystem += SpaceMap.RelocatePilot; } LoadCharacterInfo(); Global.ApplicationSettings.UpdatePilotInStorage(Name, Id.ToString(), EsiData.RefreshToken, Key); _lastTokenUpdate = DateTime.Now; }
private void ActivatePilot() { Key = Global.ApplicationSettings.GetPilotKey(Name); LocationCurrentSystemName = Location.Name; // Pilot not are log in if (Location.Name == "unknown") { return; } SpaceMap = new Map.Map { Key = Key, ActivePilot = Name, SelectedSolarSystemName = Location.Name }; SpaceMap.OnChangeStatus += GetMapMessage; SpaceMap.Activate(Name, Location.Name); SpaceMap.ApiPublishSolarSystem(Name, Key, null, LocationCurrentSystemName); OnEnterToSolarSystem += SpaceMap.RelocatePilot; if (SpaceMap != null) { ChangeLocation(); } _updateMapTimer = new Timer(); _updateMapTimer.Elapsed += Event_Refresh; _updateMapTimer.Interval = 5000; _updateMapTimer.Enabled = true; }