/// <summary> /// Adds the blank character. /// </summary> public static async Task AddBlankCharacterAsync(Action callback) { // Add blank character var result = await GlobalCharacterCollection.TryAddOrUpdateFromUriAsync(new Uri(s_filename)); if (result == null || result.HasError) { return; } UriCharacter character = result.CreateCharacter(); character.Monitored = true; callback.Invoke(); }
/// <summary> /// Initializes paths, static objects, check and load datafiles, etc. /// </summary> /// <remarks>May be called more than once without causing redundant operations to occur.</remarks> public static void Initialize() { lock (s_initializationLock) { if (s_initialized) return; s_initialized = true; Trace("EveClient.Initialize() - begin"); // Members instantiations HttpWebService = new HttpWebService(); APIProviders = new GlobalAPIProviderCollection(); MonitoredCharacters = new GlobalMonitoredCharacterCollection(); CharacterIdentities = new GlobalCharacterIdentityCollection(); Notifications = new GlobalNotificationCollection(); Characters = new GlobalCharacterCollection(); Datafiles = new GlobalDatafileCollection(); Accounts = new GlobalAccountCollection(); EVEServer = new EveServer(); // Load static datas (min order to follow : skills before anything else, items before certs) Trace("Load Datafiles - begin"); StaticProperties.Load(); StaticSkills.Load(); StaticItems.Load(); StaticCertificates.Load(); StaticBlueprints.Load(); Trace("Load Datafiles - done"); // Network monitoring (connection availability changes) NetworkMonitor.Initialize(); Trace("EveClient.Initialize() - done"); } }
/// <summary> /// Try to download a character XML from the given URI. /// </summary> /// <param name="uri"></param> private async Task TryUri(string uri) { m_version++; m_args = null; // Update controls okButton.Enabled = false; namePanel.Visible = false; errorPanel.Visible = false; urlThrobber.State = ThrobberState.Rotating; // Starts querying the web or the hard drive, and invokes the given callback on result int version = m_version; var result = await GlobalCharacterCollection.TryAddOrUpdateFromUriAsync(new Uri(uri)); if (version != m_version) { return; } urlThrobber.State = ThrobberState.Stopped; // Was there an error ? if (result.HasError) { okButton.Enabled = false; errorPanel.Visible = true; labelError.Text = result.Error; return; } nameTextBox.Text = result.CharacterName; namePanel.Visible = true; okButton.Enabled = true; m_args = result; }
/// <summary> /// Resets collection that need to be cleared. /// </summary> internal static void ResetCollections() { APIKeys = new GlobalAPIKeyCollection(); Characters = new GlobalCharacterCollection(); Notifications = new GlobalNotificationCollection(); CharacterIdentities = new GlobalCharacterIdentityCollection(); MonitoredCharacters = new GlobalMonitoredCharacterCollection(); }
/// <summary> /// Initializes paths, static objects, check and load datafiles, etc. /// </summary> /// <remarks>May be called more than once without causing redundant operations to occur.</remarks> public static void Initialize() { if (s_initialized) return; s_initialized = true; Trace("begin"); // Network monitoring (connection availability changes) NetworkMonitor.Initialize(); // APIMethods collection initialization (always before members instatiation) APIMethods.Initialize(); // Members instantiations APIProviders = new GlobalAPIProviderCollection(); MonitoredCharacters = new GlobalMonitoredCharacterCollection(); CharacterIdentities = new GlobalCharacterIdentityCollection(); Notifications = new GlobalNotificationCollection(); Characters = new GlobalCharacterCollection(); Datafiles = new GlobalDatafileCollection(); APIKeys = new GlobalAPIKeyCollection(); EVEServer = new EveServer(); Trace("done"); }