Example #1
0
        public TrackManager()
        {
            var proxy         = KanColleClient.Current.Proxy;
            var MapInfo       = new TrackerMapInfo();
            var battleTracker = new BattleTracker();

            // 연습전 종료
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/battle_result")
            .TryParse <kcsapi_practice_result>().Subscribe(x =>
                                                           PractiveResultEvent?.Invoke(this, new PracticeResultEventArgs(x.Data))
                                                           );

            // 근대화 개수
            proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>().Subscribe(x =>
                                                                               PowerUpEvent?.Invoke(this, this.EmptyEventArg)
                                                                               );

            // 개수공창 개수
            proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x =>
                                                                                          ReModelEvent?.Invoke(this, this.EmptyEventArg)
                                                                                          );

            // 폐기
            proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(x =>
                                                                                          DestoryItemEvent?.Invoke(this, this.EmptyEventArg)
                                                                                          );

            // 해체
            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x =>
                                                                                        DestoryShipEvent?.Invoke(this, this.EmptyEventArg)
                                                                                        );

            // 건조
            proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x =>
                                                                                      CreateShipEvent?.Invoke(this, this.EmptyEventArg)
                                                                                      );

            // 개발
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x =>
                                                                                      CreateItemEvent?.Invoke(this, this.EmptyEventArg)
                                                                                      );

            // 보급
            proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x =>
                                                                            ChargeEvent?.Invoke(this, this.EmptyEventArg)
                                                                            );

            // 입거
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_nyukyo/start")
            .Subscribe(x => RepairStartEvent?.Invoke(this, this.EmptyEventArg));

            // 원정
            proxy.api_req_mission_result.TryParse <kcsapi_mission_result>().Subscribe(x =>
                                                                                      MissionResultEvent?.Invoke(this, new MissionResultEventArgs(x.Data))
                                                                                      );

            // 출격 (시작)
            proxy.api_req_map_start.TryParse <kcsapi_map_start>().Subscribe(x => MapInfo.Reset(x.Data.api_maparea_id));

            // 통상 - 주간전
            proxy.api_req_sortie_battle.TryParse <kcsapi_sortie_battle>().Subscribe(x => battleTracker.BattleProcess(x.Data));

            // 통상 - 야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/battle")
            .TryParse <kcsapi_battle_midnight_battle>().Subscribe(x => battleTracker.BattleProcess(x.Data));

            // 통상 - 개막야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/sp_midnight")
            .TryParse <kcsapi_battle_midnight_sp_midnight>().Subscribe(x => battleTracker.BattleProcess(x.Data));

            // 전투 종료 (연합함대 포함)
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>()
            .Subscribe(x => BattleResultEvent?.Invoke(this, new BattleResultEventArgs(MapInfo.AfterCombat(), battleTracker.enemyShips, x.Data)));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>()
            .Subscribe(x => BattleResultEvent?.Invoke(this, new BattleResultEventArgs(MapInfo.AfterCombat(), battleTracker.enemyShips, x.Data)));


            // Register all trackers
            trackingAvailable = new ObservableCollection <ITracker>(trackingAvailable.OrderBy(x => x.Id));
            trackingAvailable.CollectionChanged += (sender, e) =>
            {
                if (e.Action != NotifyCollectionChangedAction.Add)
                {
                    return;
                }

                foreach (ITracker tracker in e.NewItems)
                {
                    tracker.RegisterEvent(this);
                    tracker.ResetQuest();
                    tracker.ProcessChanged += ((x, y) =>
                    {
                        QuestsEventChanged?.Invoke(this, EmptyEventArg);

                        WriteToStorage(KanColleClient.Current.Homeport.Quests);
                    });
                }
            };

            Assembly.GetExecutingAssembly().GetTypes()
            .ToList().Where(x => x.Namespace == "Grabacr07.KanColleViewer.Models.QuestTracker.Tracker" && typeof(ITracker).IsAssignableFrom(x))
            .ToList().ForEach(x => trackingAvailable.Add((ITracker)Activator.CreateInstance(x)));

            ReadFromStorage();

            proxy.api_get_member_questlist.Subscribe(x => new System.Threading.Thread(ProcessQuests).Start());
            QuestsEventChanged?.Invoke(this, EmptyEventArg);
        }
Example #2
0
        public TrackManager(Func <bool> PreprocessCheck)
        {
            this.PreprocessCheck = PreprocessCheck;

            var homeport      = KanColleClient.Current.Homeport;
            var proxy         = KanColleClient.Current.Proxy;
            var MapInfo       = new TrackerMapInfo();
            var battleTracker = new BattleTracker();

            // 편성 변경
            homeport.Organization.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(homeport.Organization.Fleets))
                {
                    var fleets = homeport.Organization.Fleets.Select(x => x.Value);
                    foreach (var x in fleets)
                    {
                        x.State.Updated += (_, _2) => Preprocess(() => HenseiEvent?.Invoke(this, this.EmptyEventArg));
                    }
                }
            };
            // 장비 변경
            proxy.api_req_kaisou_slot_exchange_index.TryParse <kcsapi_slot_exchange_index>()
            .Subscribe(x => Preprocess(() => EquipEvent?.Invoke(this, this.EmptyEventArg)));
            proxy.api_req_kaisou_slot_deprive.TryParse <kcsapi_slot_deprive>()
            .Subscribe(x => Preprocess(() => EquipEvent?.Invoke(this, this.EmptyEventArg)));

            // 연습전 종료
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/battle_result")
            .TryParse <kcsapi_practice_result>().Subscribe(x =>
                                                           Preprocess(() => PracticeResultEvent?.Invoke(this, new PracticeResultEventArgs(x.Data)))
                                                           );

            // 근대화 개수
            proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>()
            .Subscribe(x => Preprocess(() => PowerUpEvent?.Invoke(this, new BaseEventArgs(x.Data.api_powerup_flag != 0))));

            // 개수공창 개수
            proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>()
            .Subscribe(x => Preprocess(() => ReModelEvent?.Invoke(this, new BaseEventArgs(x.Data.api_remodel_flag != 0))));

            // 폐기
            proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>()
            .Subscribe(x => Preprocess(() => DestoryItemEvent?.Invoke(this, new DestroyItemEventArgs(x.Request, x.Data))));

            // 해체
            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>()
            .Subscribe(x => Preprocess(() => DestoryShipEvent?.Invoke(this, this.EmptyEventArg)));

            // 건조
            proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>()
            .Subscribe(x => Preprocess(() => CreateShipEvent?.Invoke(this, this.EmptyEventArg)));

            // 개발
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>()
            .Subscribe(x => Preprocess(() => CreateItemEvent?.Invoke(this, new BaseEventArgs(x.Data.api_create_flag != 0))));

            // 보급
            proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>()
            .Subscribe(x => Preprocess(() => ChargeEvent?.Invoke(this, this.EmptyEventArg)));

            // 입거
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_nyukyo/start")
            .Subscribe(x => Preprocess(() => RepairStartEvent?.Invoke(this, this.EmptyEventArg)));

            // 원정
            proxy.api_req_mission_result.TryParse <kcsapi_mission_result>()
            .Subscribe(x => Preprocess(() => MissionResultEvent?.Invoke(this, new MissionResultEventArgs(x.Data))));

            // 출격 (시작, 진격)
            proxy.api_req_map_start.TryParse <kcsapi_map_start>()
            .Subscribe(x => Preprocess(() => MapInfo.Reset(x.Data.api_maparea_id, x.Data.api_mapinfo_no, x.Data.api_no)));
            proxy.api_req_map_next.TryParse <kcsapi_map_start>()
            .Subscribe(x => Preprocess(() => MapInfo.Next(x.Data.api_maparea_id, x.Data.api_mapinfo_no, x.Data.api_no)));

            // 통상 - 주간전
            proxy.api_req_sortie_battle.TryParse <kcsapi_sortie_battle>()
            .Subscribe(x => Preprocess(() => battleTracker.BattleProcess(x.Data)));

            // 통상 - 야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/battle")
            .TryParse <kcsapi_battle_midnight_battle>()
            .Subscribe(x => Preprocess(() => battleTracker.BattleProcess(x.Data)));

            // 통상 - 개막야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/sp_midnight")
            .TryParse <kcsapi_battle_midnight_sp_midnight>()
            .Subscribe(x => Preprocess(() => battleTracker.BattleProcess(x.Data)));

            // 전투 종료 (연합함대 포함)
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>()
            .Subscribe(x => Preprocess(() => BattleResultEvent?.Invoke(this, new BattleResultEventArgs(MapInfo.AfterCombat(), battleTracker.enemyShips, x.Data))));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>()
            .Subscribe(x => Preprocess(() => BattleResultEvent?.Invoke(this, new BattleResultEventArgs(MapInfo.AfterCombat(), battleTracker.enemyShips, x.Data))));


            // Register all trackers
            trackingAvailable = new ObservableCollection <ITracker>(trackingAvailable.OrderBy(x => x.Id));
            trackingAvailable.CollectionChanged += (sender, e) =>
            {
                if (e.Action != NotifyCollectionChangedAction.Add)
                {
                    return;
                }

                foreach (ITracker tracker in e.NewItems)
                {
                    tracker.RegisterEvent(this);
                    tracker.ResetQuest();
                    tracker.ProcessChanged += ((x, y) =>
                    {
                        try
                        {
                            QuestsEventChanged?.Invoke(this, EmptyEventArg);
                        }
                        catch { }
                    });
                }
            };
        }
Example #3
0
        public TrackManager(Func <bool> PreprocessCheck, Func <string> KcaQSync_Pass)
        {
            this.PreprocessCheck = PreprocessCheck;

            var homeport = KanColleClient.Current.Homeport;
            var proxy    = KanColleClient.Current.Proxy;
            var MapInfo  = new TrackerMapInfo();

            battleCalculator = new BattleCalculator();
            slotitemTracker  = new SlotItemTracker(homeport, proxy);

            // 동기화
            {
                var pass = KcaQSync_Pass?.Invoke();
                if (!string.IsNullOrEmpty(pass))
                {
                    var json = DynamicJson.Serialize(new {
                        userid = KanColleClient.Current.Homeport.Admiral.RawData.api_member_id,
                        pass   = pass
                    });
                    HTTPRequest.PostAsync(
                        "http://kcaqsync.swaytwig.com/api/read",
                        "data=" + WebUtility.UrlEncode(RSA.Encrypt(json)),
                        y =>
                    {
                        var result = DynamicJson.Parse(y);
                        if (result.status.ToString() == "error")
                        {
                            return;
                        }

                        ApplySyncData(
                            result.data.ToString() as string,
                            Convert.ToInt64(result.timestamp.ToString() as string)
                            );
                    }
                        );
                }
            }
            this.QuestsEventChanged += (s, e) =>
            {
                var enc36 = new Func <int, string>(input =>
                {
                    var table  = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ=";
                    var output = "";
                    do
                    {
                        output = table[input % 36] + output;
                        input /= 36;
                    } while (input > 0);
                    return(output);
                });
                var enc37 = new Func <int, string>(input =>
                {
                    var table  = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ=";
                    var output = "";
                    do
                    {
                        var pos = Math.Min(table.Length - 1, input);
                        output += table[pos];
                        input  -= pos;
                    } while (input > 0);
                    return(output);
                });

                var pass = KcaQSync_Pass?.Invoke();
                if (string.IsNullOrEmpty(pass))
                {
                    return;
                }

                var data = "";
                foreach (var item in this.trackingAvailable)
                {
                    if (item.GetType() == typeof(DefaultTracker))
                    {
                        continue;
                    }
                    if (item.GetRawDatas().All(x => x == 0) && !item.IsTracking)
                    {
                        continue;
                    }

                    var content =
                        (item.IsTracking ? "1" : "0")
                        + enc36(item.Id).PadLeft(2, '0')
                        + string.Join("", item.GetRawDatas().Select(enc37));

                    data += enc37(content.Length) + content;
                }

                var json = DynamicJson.Serialize(new
                {
                    userid = KanColleClient.Current.Homeport.Admiral.RawData.api_member_id,
                    pass   = pass,
                    data   = data
                });
                HTTPRequest.PostAsync(
                    "http://kcaqsync.swaytwig.com/api/write",
                    "data=" + WebUtility.UrlEncode(RSA.Encrypt(json)),
                    y => { }
                    );
            };

            // 편성 변경
            homeport.Organization.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(homeport.Organization.Fleets))
                {
                    var fleets = homeport.Organization.Fleets.Select(x => x.Value);
                    foreach (var x in fleets)
                    {
                        x.State.Updated += (_, _2) => Preprocess(() => HenseiEvent?.Invoke(this, _EventArgs.Empty));
                    }
                }
            };
            // 장비 변경
            proxy.api_req_kaisou_slot_exchange_index.TryParse <kcsapi_slot_exchange_index>()
            .Subscribe(x => Preprocess(() => EquipEvent?.Invoke(this, _EventArgs.Empty)));
            proxy.api_req_kaisou_slot_deprive.TryParse <kcsapi_slot_deprive>()
            .Subscribe(x => Preprocess(() => EquipEvent?.Invoke(this, _EventArgs.Empty)));

            // 근대화 개수
            proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>()
            .Subscribe(x => Preprocess(() => PowerUpEvent?.Invoke(this, new BaseEventArgs(x.Data.api_powerup_flag != 0))));

            // 개수공창 개수
            proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>()
            .Subscribe(x => Preprocess(() => ReModelEvent?.Invoke(this, new BaseEventArgs(x.Data.api_remodel_flag != 0))));

            // 폐기
            slotitemTracker.DestroyItemEvent += (s, e) => Preprocess(() => DestoryItemEvent?.Invoke(this, e));

            // 해체
            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>()
            .Subscribe(x => Preprocess(() => DestoryShipEvent?.Invoke(this, new DestroyShipEventArgs(x.Request, x.Data))));

            // 건조
            proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>()
            .Subscribe(x => Preprocess(() => CreateShipEvent?.Invoke(this, _EventArgs.Empty)));

            // 개발
            slotitemTracker.CreateItemEvent += (s, e) => Preprocess(() => CreateItemEvent?.Invoke(this, e));

            // 보급
            proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>()
            .Subscribe(x => Preprocess(() => ChargeEvent?.Invoke(this, _EventArgs.Empty)));

            // 입거
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_nyukyo/start")
            .Subscribe(x => Preprocess(() => RepairStartEvent?.Invoke(this, _EventArgs.Empty)));

            // 원정
            proxy.api_req_mission_result.TryParse <kcsapi_mission_result>()
            .Subscribe(x => Preprocess(() => MissionResultEvent?.Invoke(this, new MissionResultEventArgs(x.Data))));

            // 출격 (시작, 진격)
            proxy.api_req_map_start.TryParse <kcsapi_map_start_next>()
            .Subscribe(x => Preprocess(() => MapInfo.Reset(x.Data.api_maparea_id, x.Data.api_mapinfo_no, x.Data.api_no, x.Data.api_event_id == 5)));
            proxy.api_req_map_next.TryParse <kcsapi_map_start_next>()
            .Subscribe(x => Preprocess(() => MapInfo.Next(x.Data.api_maparea_id, x.Data.api_mapinfo_no, x.Data.api_no, x.Data.api_event_id == 5)));

            #region 전투

            #region 통상 - 주간전 / 연습 - 주간전
            proxy.api_req_sortie_battle
            .TryParse <kcsapi_sortie_battle>().Subscribe(x => this.Update(x.Data, ApiTypes.sortie_battle));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/battle")
            .TryParse <practice_battle>().Subscribe(x => this.Update(x.Data, ApiTypes.practice_battle));
            #endregion

            #region 통상 - 야전 / 통상 - 개막야전 / 연습 - 야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/battle")
            .TryParse <kcsapi_sortie_battle_midnight>().Subscribe(x => this.Update(x.Data, ApiTypes.sortie_battle_midnight));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/sp_midnight")
            .TryParse <battle_midnight_sp_midnight>().Subscribe(x => this.Update(x.Data, ApiTypes.sortie_battle_midnight_sp));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/midnight_battle")
            .TryParse <practice_midnight_battle>().Subscribe(x => this.Update(x.Data, ApiTypes.practice_midnight_battle));
            #endregion

            #region 항공전 - 주간전 / 공습전 - 주간전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_sortie/airbattle")
            .TryParse <kcsapi_sortie_airbattle>().Subscribe(x => this.Update(x.Data, ApiTypes.sortie_airbattle));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_sortie/ld_airbattle")
            .TryParse <sortie_ld_airbattle>().Subscribe(x => this.Update(x.Data, ApiTypes.sortie_ld_airbattle));
            #endregion

            #region 연합함대 - 주간전
            proxy.api_req_combined_battle_battle
            .TryParse <kcsapi_combined_battle>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/battle_water")
            .TryParse <combined_battle_battle_water>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_water));
            #endregion

            #region 연합vs연합 - 주간전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/ec_battle")
            .TryParse <kcsapi_combined_battle_each>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_ec));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/each_battle")
            .TryParse <kcsapi_combined_battle_each>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_each));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/each_battle_water")
            .TryParse <kcsapi_combined_battle_each>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_each_water));
            #endregion

            #region 연합함대 - 항공전 / 공습전
            proxy.api_req_combined_battle_airbattle
            .TryParse <kcsapi_combined_airbattle>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_airbattle));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/ld_airbattle")
            .TryParse <combined_battle_ld_airbattle>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_ld_airbattle));
            #endregion

            #region 연합함대 - 야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/midnight_battle")
            .TryParse <kcsapi_combined_battle_midnight>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_midnight));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/sp_midnight")
            .TryParse <combined_battle_sp_midnight>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_midnight_sp));
            #endregion

            #region vs 연합 - 야전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/ec_midnight_battle")
            .TryParse <kcsapi_combined_battle_midnight_ec>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_midnight_ec));
            #endregion

            #region vs 연합 - 야전>주간전
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/ec_night_to_day")
            .TryParse <kcsapi_combined_battle_ec_nighttoday>().Subscribe(x => this.Update(x.Data, ApiTypes.combined_battle_ec_nighttoday));
            #endregion

            #endregion

            // 전투 종료 (연합함대 포함)
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battle_result>()
            .Subscribe(x => Preprocess(() => BattleResultEvent?.Invoke(this,
                                                                       new BattleResultEventArgs(
                                                                           MapInfo.AfterCombat(),
                                                                           battleCalculator.EnemyFirstShips,
                                                                           battleCalculator.EnemySecondShips,
                                                                           x.Data
                                                                           )
                                                                       )));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_battle_result>()
            .Subscribe(x => Preprocess(() => BattleResultEvent?.Invoke(this,
                                                                       new BattleResultEventArgs(
                                                                           MapInfo.AfterCombat(),
                                                                           battleCalculator.EnemyFirstShips,
                                                                           battleCalculator.EnemySecondShips,
                                                                           x.Data
                                                                           )
                                                                       )));

            // 연습전 종료
            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/battle_result")
            .TryParse <kcsapi_battle_result>().Subscribe(x =>
                                                         Preprocess(() => PracticeResultEvent?.Invoke(this, new PracticeResultEventArgs(x.Data)))
                                                         );


            // Register all trackers
            trackingAvailable = new ObservableCollection <TrackerBase>(trackingAvailable.OrderBy(x => x.Id));
            trackingAvailable.CollectionChanged += (sender, e) =>
            {
                if (e.Action != NotifyCollectionChangedAction.Add)
                {
                    return;
                }

                foreach (TrackerBase tracker in e.NewItems)
                {
                    tracker.RegisterEvent(this);
                    tracker.ResetQuest();
                    tracker.ProgressChanged += () =>
                    {
                        try
                        {
                            QuestsEventChanged?.Invoke(this, _EventArgs.Empty);
                        }
                        catch { }
                    };
                }
            };
        }
Example #4
0
 private void ReModel()
 {
     ReModelEvent?.Invoke(this, new EventArgs());
 }