private void Splash_Loaded(object sender, RoutedEventArgs e) { var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); if (!EoiInterface.IsVersionValid(version)) { MessageBox.Show("Die Version konnte nicht validiert werden. Mögliche Ursachen: Version zu alt bzw. ungültig, Keine Internet Verbindung, Server nicht erreichbar"); App.Current.Shutdown(); return; } EoiThreadManager.Init(); _threadManagerInitialized = true; var init = new EoiThread(EoiInterface.Init); EoiThreadManager.ThreadManager.ThreadFinished += (thread, args) => { if (Equals(init, thread)) { OnStartupFinish(); } }; EoiThreadManager.ThreadManager.Add(init); }
public ContractsControl() { var descriptor = DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)); var isDesignMode = (bool)descriptor.Metadata.DefaultValue; InitializeComponent(); if (!isDesignMode) { this.Contracts = EoiInterface.GetContracts(); var availableContractsView = new CollectionViewSource() { Source = this.Contracts }; var acceptedContractsView = new CollectionViewSource() { Source = this.Contracts }; var availableContractsItemList = availableContractsView.View; var acceptedContractsItemList = acceptedContractsView.View; var availableContractsFilter = new Predicate <object>(AvailableContractsFilter); var acceptedContractsFilter = new Predicate <object>(AcceptedContractsFilter); availableContractsItemList.Filter = availableContractsFilter; acceptedContractsItemList.Filter = acceptedContractsFilter; this.AvailableContractsCollectionView = availableContractsItemList; this.AcceptedContractsCollectionView = acceptedContractsItemList; } }
internal bool Create() { int volume; if (!int.TryParse(OrderVolumeTextBox.Text, out volume)) { return(false); } decimal price; if (!decimal.TryParse(PriceTextBox.Text, out price)) { return(false); } var success = EoiInterface.CreateIndustryContract(Blueprint, volume, price, (string)ContractTypeComboBox.SelectedItem, MaterialsDeliveredCheckBox.IsChecked.Value, BlueprintDeliveredCheckBox.IsChecked.Value, DescriptionTextBox.Text, EnablePartitionCheckBox.IsChecked.Value); if (!success) { return(false); } Reset(); return(true); }
private void TradeHubChanged(object sender, SelectionChangedEventArgs e) { if (TradeHubComboBox.SelectedItem != null) { SettingsInterface.GlobalSettings.TradeHub = ((SolarSystem)TradeHubComboBox.SelectedItem).SolarSysteId.ToString(); } EoiInterface.CalculateAllBlueprints(); }
private void ExportOrderChanged(object sender, SelectionChangedEventArgs e) { if (ExportOrderTypeComboBox.SelectedItem != null) { SettingsInterface.GlobalSettings.ExportOrderType = (OrderType)ExportOrderTypeComboBox.SelectedItem; } EoiInterface.CalculateAllBlueprints(); }
private void NotOwnedTeChanged(object sender, TextChangedEventArgs e) { int result; if (!string.IsNullOrWhiteSpace(NotOwnedTeTextBox.Text) && int.TryParse(NotOwnedTeTextBox.Text, out result)) { SettingsInterface.GlobalSettings.NotOwnedTe = result; } EoiInterface.CalculateAllBlueprints(); }
private void StructureMaterialBonusChanged(object sender, TextChangedEventArgs e) { decimal result; if (!string.IsNullOrWhiteSpace(StructureMaterialBonusTextBox.Text) && decimal.TryParse(StructureMaterialBonusTextBox.Text, out result)) { SettingsInterface.GlobalSettings.StructureMaterialBonus = result; } EoiInterface.CalculateAllBlueprints(); }
private void IndustryTaxChanged(object sender, TextChangedEventArgs e) { decimal result; if (!string.IsNullOrWhiteSpace(IndustryTaxTextBox.Text) && decimal.TryParse(IndustryTaxTextBox.Text, out result)) { SettingsInterface.GlobalSettings.IndustryTax = result; } EoiInterface.CalculateAllBlueprints(); }
internal bool Accept() { var success = EoiInterface.AcceptIndustryContract(Contract, SelectedVolume); if (success) { Reset(); return(true); } return(false); }
private void ProfitPerHourForPriceChanged(object sender, TextChangedEventArgs e) { decimal result; if (!string.IsNullOrWhiteSpace(ProfitPerHourForPriceTextBox.Text) && decimal.TryParse(ProfitPerHourForPriceTextBox.Text, out result)) { SettingsInterface.GlobalSettings.ProfitPerHourForPrice = result; } EoiInterface.CalculateAllBlueprints(); }
private static void CreateDefaultUser() { FileSystemDataInterface.CreateDefaultUser(); var user = FileSystemDataInterface.GetUsers().FirstOrDefault(x => x.Name == "Default"); if (user != null) { var eoiDataUser = new EoiDataUser(user); _eoiDataUsers.Add(eoiDataUser); EoiInterface.AddUser(eoiDataUser.GetEoiUser()); } }
private void Splash_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (_backgroundWorker != null) { EoiInterface.StopBackgroundWorker(); _backgroundWorker.Thread.Join(); EoiInterface.Close(); } if (_threadManagerInitialized) { EoiThreadManager.ThreadManager.Stop(); } }
internal static bool SynchronizeCorporationContracts() { var updated = false; var users = GetUsers(); var user = users.FirstOrDefault(x => x.GetAccessToken() != null); if (user != null) { _eoiDataContracts.ForEach(x => x.Synchronized = false); var corpContracts = CorporationWebInterface.GetContracts(user.Name); foreach (var corpContract in corpContracts) { EoiDataContract eoiDataContract = _eoiDataContracts.FirstOrDefault(x => x.Id == corpContract.Id); if (eoiDataContract == null) { eoiDataContract = new EoiDataContract(corpContract); eoiDataContract.Synchronized = true; _eoiDataContracts.Add(eoiDataContract); EoiInterface.InvokeDispatcherAddContract(eoiDataContract.GetEoiContract()); updated = true; } else { if (eoiDataContract.Synchronize(corpContract)) { updated = true; } } } var notSynchronizedContracts = _eoiDataContracts.Where(x => !x.Synchronized).ToList(); foreach (var contract in notSynchronizedContracts) { EoiInterface.InvokeDispatcherRemoveContract(contract.GetEoiContract()); contract.Dispose(); _eoiDataContracts.Remove(contract); } } if (updated) { EoiInterface.InvokeDispatcherContractsPropertyChanged(); } return(updated); }
private void ProgressTimerTick(object sender, EventArgs e) { var status = EoiInterface.GetAutoUpdaterStatus(); if (status != null) { if (status.Progress == -1) { this.AutoUpdaterProgressBar.IsIndeterminate = true; } else { this.AutoUpdaterProgressBar.IsIndeterminate = false; this.AutoUpdaterProgressBar.Value = status.Progress; } this.AutoUpdaterStatusTextBlock.Text = status.Status; } }
public BlueprintsControl() { var descriptor = DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)); var isDesignMode = (bool)descriptor.Metadata.DefaultValue; InitializeComponent(); if (!isDesignMode) { this.Blueprints = EoiInterface.GetBlueprints(); var collectionView = new CollectionViewSource() { Source = this.Blueprints }; var itemList = collectionView.View; var filter = new Predicate <object>(CustomFilter); itemList.Filter = filter; this.BlueprintsCollectionView = itemList; } }
public BlueprintsComboBox() { this.ItemsSource = EoiInterface.GetBlueprints(); }
public UserManagement() { Users = EoiInterface.GetUsers(); InitializeComponent(); }
internal static void SynchronizeAssets() { foreach (var eoiDataAsset in _eoiDataAsset) { eoiDataAsset.Synchronized = false; eoiDataAsset.Reset(); } var users = GetUsers(); foreach (var user in users) { if (!user.SynchronizeAssets) { continue; } var token = user.GetAccessToken(); if (token != null) { var esiAssets = EveSwaggerInterface.GetAssets(token, user.Id); if (esiAssets == null) { user.SynchronizeAssets = false; continue; } foreach (var esiAsset in esiAssets) { if (esiAsset.is_singleton) { continue; } if (esiAsset.location_flag != "Unlocked" && esiAsset.location_flag != "Locked" && esiAsset.location_flag != "Cargo" && esiAsset.location_flag != "Deliveries" && esiAsset.location_flag != "Hangar" && esiAsset.location_flag != "HangarAll") { continue; } if (esiAsset.is_blueprint_copy) { continue; } var eoiDataAsset = _eoiDataAsset.FirstOrDefault(x => x.Id == esiAsset.type_id); if (eoiDataAsset == null) { eoiDataAsset = new EoiDataAsset(esiAsset); _eoiDataAsset.Add(eoiDataAsset); } else { eoiDataAsset.Synchronize(esiAsset); } eoiDataAsset.Synchronized = true; } } } var eoiDataAssetsToRemove = _eoiDataAsset.Where(x => x.Synchronized == false || x.GetQuantity() <= 0).ToList(); foreach (var asset in eoiDataAssetsToRemove) { foreach (var eoiAsset in asset.GetEoiAssets()) { EoiInterface.RemoveAsset(eoiAsset); } asset.Delete(); _eoiDataAsset.Remove(asset); } }
internal static void SynchronizeWallet() { var users = GetUsers(); foreach (var user in users) { if (!user.SynchronizeTransactions) { continue; } var token = user.GetAccessToken(); if (token != null) { // var balance = EveSwaggerInterface.GetWalletBalance(token, user.Id); var transactions = EveSwaggerInterface.GetWalletTransactions(token, user.Id); if (transactions == null) { user.SynchronizeTransactions = false; continue; } foreach (var transaction in transactions) { if (!transaction.is_buy) { continue; } var eoiDataAsset = _eoiDataAsset.FirstOrDefault(x => x.Id == transaction.type_id); if (eoiDataAsset != null) { eoiDataAsset.AddTransaction(transaction); } } } } var eoiDataAssets = _eoiDataAsset.ToList(); foreach (var asset in eoiDataAssets) { asset.Clean(); if (!asset.HasPrice()) { foreach (var eoiAsset in asset.GetEoiAssets()) { EoiInterface.RemoveAsset(eoiAsset); } asset.Delete(); _eoiDataAsset.Remove(asset); } else { asset.UpdateEoiAssets(); foreach (var eoiAsset in asset.GetEoiAssets()) { } } } }
internal void UpdateEoiAssets() { if (_fileSystemAsset == null) { return; } var transactions = _fileSystemAsset.GetOrderedTransactions(); var quantity = _fileSystemAsset.Quantity; var usedEoiAssets = new List <EoiAsset>(); _eoiAssets.ForEach(x => x.Quantity = 0); foreach (var transaction in transactions) { var eoiAsset = _eoiAssets.FirstOrDefault(x => x.Price == transaction.unit_price); if (eoiAsset == null) { eoiAsset = new EoiAsset(); if (_type != null) { eoiAsset.Name = _type.Name; } else { eoiAsset.Name = "Unknown"; } eoiAsset.Price = transaction.unit_price; if (quantity > transaction.quantity) { eoiAsset.Quantity = transaction.quantity; } else if (quantity > 0) { eoiAsset.Quantity = quantity; } quantity -= transaction.quantity; _eoiAssets.Add(eoiAsset); EoiInterface.AddAsset(eoiAsset); } else { if (quantity > transaction.quantity) { eoiAsset.Quantity += transaction.quantity; } else if (quantity > 0) { eoiAsset.Quantity += quantity; } quantity -= transaction.quantity; } usedEoiAssets.Add(eoiAsset); } if (quantity > 0) { var eoiAsset = _eoiAssets.FirstOrDefault(x => x.Price == 0); if (eoiAsset == null) { eoiAsset = new EoiAsset(); if (_type != null) { eoiAsset.Name = _type.Name; } eoiAsset.Price = 0; eoiAsset.Quantity = quantity; _eoiAssets.Add(eoiAsset); } else { eoiAsset.Quantity += quantity; } usedEoiAssets.Add(eoiAsset); } foreach (var eoiAsset in _eoiAssets.ToList()) { if (!usedEoiAssets.Contains(eoiAsset)) { _eoiAssets.Remove(eoiAsset); EoiInterface.RemoveAsset(eoiAsset); } } }
private void EnableCalculationChanged(object sender, RoutedEventArgs e) { SettingsInterface.GlobalSettings.EnableCalculation = EnableCalculationCheckBox.IsChecked.Value; EoiInterface.CalculateAllBlueprints(); }
public BlueprintControl() { EnableManualChanges = EoiInterface.GetUsers().Any(x => x.Authenticated) ? false : true; InitializeComponent(); }