Пример #1
0
        public int CompareAlliance(IEveCharacter char1, IEveCharacter char2, SortOrder order)
        {
            var comparison =
                String.Compare(char1.Alliance, char2.Alliance, StringComparison.InvariantCultureIgnoreCase) *
                (int)order;

            return(comparison == 0 ? CompareCorporation(char1, char2, SortOrder.Ascending) : comparison);
        }
Пример #2
0
 public static void AddFirst(IEveCharacter character)
 {
     lock (REQUEST_QUEUE)
     {
         REQUEST_QUEUE.AddFirst(character);
         Monitor.Pulse(REQUEST_QUEUE);
     }
 }
Пример #3
0
 private static bool IsAssociatedTo(IEveCharacter eveChar, IEveCharacter curChar)
 {
     return(eveChar.KillboardInformation != null && (
                eveChar.KillboardInformation.AssociatedAlliances.Contains
                    (curChar.Alliance) ||
                eveChar.KillboardInformation.AssociatedCorporations
                .Contains(curChar.Corporation)));
 }
Пример #4
0
        private static bool AreConnected(IEveCharacter eveChar, IEveCharacter curChar)
        {
            if (Properties.Settings.Default.IsShowingCoalitionsColumn && eveChar.Coalitions.Any(c => curChar.Coalitions.Contains(c)))
            {
                return(true);
            }

            return((!string.IsNullOrEmpty(eveChar.Alliance)
                        ? eveChar.Alliance == curChar.Alliance
                        : !string.IsNullOrEmpty(eveChar.Corporation) && curChar.Corporation == eveChar.Corporation) ||
                   IsAssociatedTo(eveChar, curChar) || IsAssociatedTo(curChar, eveChar));
        }
Пример #5
0
        public EveCharacterViewModel(IEveCharacter eveCharacter, EveLocalStatistics statistics)
        {
            EveCharacter = eveCharacter;
            _statistics  = statistics;
            EveCharacter.PropertyChanged += OnPropertyChanged;
            Properties.Settings.Default.PropertyChanged += SettingsPropertyChanged;
            ActiveProfile.Default.PropertyChanged       += SettingsPropertyChanged;

            _customCharacterInfo = CUSTOM_CHARACTER_INFO_REPOSITORY.GetCustomCharacterInfo(eveCharacter);
            _customCharacterInfo.PropertyChanged += CustomCharacterInfoOnPropertyChanged;

            InitValues();
        }
Пример #6
0
        private static int CompareLocalChangeStatus(IEveCharacter char1, IEveCharacter char2)
        {
            if (char1.LocalChangeStatus == char2.LocalChangeStatus)
            {
                return(0);
            }

            if (char1.LocalChangeStatus == LocalChangeStatus.Exited)
            {
                return(1);
            }

            return(char2.LocalChangeStatus == LocalChangeStatus.Exited ? -1 : 0);
        }
Пример #7
0
        public int CompareCoalitions(IEveCharacter char1, IEveCharacter char2, SortOrder order)
        {
            var char1Coalition     = char1.Coalitions.FirstOrDefault();
            var char1CoalitionName = char1Coalition != null ? char1Coalition.Name : "";

            var char2Coalition     = char2.Coalitions.FirstOrDefault();
            var char2CoalitionName = char2Coalition != null ? char2Coalition.Name : "";

            var comparison =
                String.Compare(char1CoalitionName, char2CoalitionName, StringComparison.InvariantCultureIgnoreCase) *
                (int)order;

            return(comparison == 0 ? CompareAlliance(char1, char2, SortOrder.Ascending) : comparison);
        }
Пример #8
0
        private static bool TryGetEveCharacterFromMenuItem(object sender, out IEveCharacter eveChar)
        {
            var menuItem = sender as MenuItem;

            if (menuItem == null)
            {
                eveChar = null;
                return(false);
            }
            var vm = menuItem.CommandParameter as EveCharacterViewModel;

            if (vm != null)
            {
                eveChar = vm.EveCharacter;
                return(true);
            }
            eveChar = null;
            return(false);
        }
Пример #9
0
        public CustomCharacterInfoViewModel GetCustomCharacterInfo(IEveCharacter character)
        {
            var id = long.Parse(character.Id);
            CustomCharacterInfoViewModel result;

            if (_viewModelsCache.TryGetValue(id, out result))
            {
                return(result);
            }
            var customCharacterInfo = App.GetFromCollection <CustomCharacterInfo, CustomCharacterInfo>(x => x.FindById(long.Parse(character.Id)))
                                      ?? new CustomCharacterInfo
            {
                Id = id
            };

            result = new CustomCharacterInfoViewModel(customCharacterInfo);
            _viewModelsCache[id] = result;

            return(result);
        }
Пример #10
0
 private static void Run()
 {
     while (true)
     {
         IEveCharacter character = null;
         try
         {
             lock (REQUEST_QUEUE)
             {
                 if (!REQUEST_QUEUE.Any())
                 {
                     Monitor.Wait(REQUEST_QUEUE);
                     continue;
                 }
                 character = REQUEST_QUEUE.First();
                 REQUEST_QUEUE.RemoveFirst();
                 if (character.KillboardInformation != null)
                 {
                     continue;
                 }
             }
             character.KillboardInformation = GetKillboardAnalysisFor(int.Parse(character.Id));
         }
         catch (Exception e)
         {
             var message = character == null
                               ? "Error during KB-Data retrieval"
                               : string.Format("Could not retrieve killboard information for {0}", character);
             LOG.Warn(message, e);
             Application.Current.Dispatcher.Invoke(
                 new Action(
                     () =>
             {
                 if (Application.Current != null && Application.Current.MainWindow != null)
                 {
                     ((MainWindow)Application.Current.MainWindow).SetTitleToError(message);
                 }
             }));
         }
     }
 }
Пример #11
0
 public int CompareName(IEveCharacter char1, IEveCharacter char2, SortOrder order)
 {
     return(String.Compare(char1.Name, char2.Name, StringComparison.InvariantCultureIgnoreCase) * (int)order);
 }
Пример #12
0
 public ArchivedEveCharacter(IEveCharacter eveCharacter, LocalChangeStatus status)
 {
     _eveCharacter = eveCharacter;
     _status       = status;
     _eveCharacter.PropertyChanged += EveCharacterOnPropertyChanged;
 }
Пример #13
0
        public void OpenForCharacter(IEveCharacter character)
        {
            var url = "https://neweden.xyz/character/" + character.Id + "/";

            Process.Start(url);
        }
Пример #14
0
 //TODO standings service ->
 public static bool TryGetStandings(IEveCharacter eveChar, out double standings)
 {
     return(TryGetStandings(eveChar.Name, out standings) || TryGetStandings(eveChar.Corporation, out standings) ||
            eveChar.Alliance != null && TryGetStandings(eveChar.Alliance, out standings));
 }
Пример #15
0
 private static bool IsInLocal(IEveCharacter character)
 {
     return(character.LocalChangeStatus != LocalChangeStatus.Exited);
 }
Пример #16
0
        public void OpenForCharacter(IEveCharacter character)
        {
            var url = "https://zkillboard.com/charactor/search/" + character.Id + "/";

            Process.Start(url);
        }
Пример #17
0
        public void OpenForCharacter(IEveCharacter character)
        {
            var url = string.Format(@"https://zkillboard.com/character/{0}/", character.Id);

            Process.Start(url);
        }
Пример #18
0
 protected bool Equals(IEveCharacter other)
 {
     return(string.Equals(Name, other.Name));
 }