예제 #1
0
 private void KCODt_ItemDataChanged(object sender, DataChangedEventArgs e)
 {
     Dispatcher.FromThread(UIThread).Invoke((MainWindow.Invoker) delegate {
         try {
             queryItems();
         } catch (Exception ex) {
             Debug.Print(ex.ToString());
         }
     }, null);
 }
예제 #2
0
        protected virtual void OnNDockDataChangedEvent(DataChangedEventArgs e)
        {
            NDockData = e.Data;
            NDockDataChangedEventHandler handler = NDockDataChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #3
0
        public virtual void OnShipTypeChangedEvent(DataChangedEventArgs e)
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data", defMasterSType);

            File.WriteAllText(path, e.Data.ToString());
            ShipType = e.Data;
            ShipTypeChangedEventHandler handler = ShipTypeChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #4
0
 public virtual void OnItemDataChangedEvent(DataChangedEventArgs e)
 {
     lock (ItemDataMap) {
         ItemData = e.Data;
         ItemDataMap.Clear();
         foreach (JToken it in ItemData)
         {
             ItemDataMap.Add(it["api_id"].ToString(), it);
         }
         ItemDataChangedEventHandler handler = ItemDataChanged;
         if (handler != null)
         {
             handler(this, e);
         }
     }
 }
예제 #5
0
 public virtual void OnShipDataChangedEvent(DataChangedEventArgs e)
 {
     lock (ShipDataMap) {
         ShipData = e.Data;
         ShipDataMap.Clear();
         foreach (JToken sh in ShipData)
         {
             ShipDataMap.Add(sh["api_id"].ToString(), sh);
         }
         ShipDataChangedEventHandler handler = ShipDataChanged;
         if (handler != null)
         {
             handler(this, e);
         }
     }
 }
예제 #6
0
 private void missionCheck(DataChangedEventArgs e)
 {
     try {
         if (KCODt.Instance.DeckData == null || KCODt.Instance.ShipSpec == null || KCODt.Instance.ShipData == null)
         {
             return;
         }
         IEnumerable <JToken> decks = KCODt.Instance.DeckData;
         foreach (JToken deck in decks)
         {
             int   timerId = int.Parse(deck["api_id"].ToString());
             Timer timer;
             int   dueTime = 2000;
             if (deck["api_mission"][2].ToString() == "0")
             {
                 if (FMTimers[timerId] != null)
                 {
                     FMTimers[timerId].Dispose();
                 }
                 timer = null;
             }
             else
             {
                 long x = long.Parse(deck["api_mission"][2].ToString());
                 x -= 50000;
                 DateTime dt = Utils.parseUTC(x.ToString());
                 TimeSpan ts = dt - DateTime.Now;
                 dueTime = int.Parse(ts.TotalMilliseconds.ToString("0"));
                 if (dueTime < 0)
                 {
                     continue;
                 }
                 timer = new Timer(this.checkMission, timerId, dueTime, Timeout.Infinite);
                 Debug.Print(string.Format("deck {0} mission finish after {1} ms", deck["api_id"], ts));
             }
             if (FMTimers[timerId] != null)
             {
                 FMTimers[timerId].Dispose();
             }
             FMTimers[timerId] = timer;
         }
     } catch (Exception ex) {
         Debug.Print(ex.ToString());
     }
 }
예제 #7
0
 public virtual void OnItemSpecChangedEvent(DataChangedEventArgs e)
 {
     lock (ItemSpecMap) {
         string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data", defMasterSlotItem);
         File.WriteAllText(path, e.Data.ToString());
         ItemSpec = e.Data;
         ItemSpecMap.Clear();
         foreach (JToken it in ItemSpec)
         {
             ItemSpecMap.Add(it["api_id"].ToString(), it);
         }
         ItemSpecChangedEventHandler handler = ItemSpecChanged;
         if (handler != null)
         {
             handler(this, e);
         }
     }
 }
예제 #8
0
 protected virtual void OnShipSpecChangedEvent(DataChangedEventArgs e)
 {
     lock (ShipSpecMap) {
         string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data", defMasterShip);
         File.WriteAllText(path, e.Data.ToString());
         ShipSpec = e.Data;
         ShipSpecMap.Clear();
         foreach (JToken sh in ShipSpec)
         {
             ShipSpecMap.Add(sh["api_id"].ToString(), sh);
         }
         ShipSpecChangedEventHandler handler = ShipSpecChanged;
         if (handler != null)
         {
             handler(this, e);
         }
     }
 }
예제 #9
0
 void KCODt_SlotItemChanged(object sender, DataChangedEventArgs e)
 {
     reflash();
 }
예제 #10
0
 private void KCODt_ShipDataChanged(object sender, DataChangedEventArgs e)
 {
     reflash();
 }
예제 #11
0
 private void KCODt_DeckDataChanged(object sender, DataChangedEventArgs e)
 {
     missionCheck(e);
 }
예제 #12
0
 private void KCODt_NDockDataChanged(object sender, DataChangedEventArgs e)
 {
     ndocking(e);
 }
예제 #13
0
 private void KCODt_ItemSpecChanged(object sender, DataChangedEventArgs e)
 {
     reflash();
 }