コード例 #1
0
        private async Task RemoveFromWatchlist(string movieTitle)
        {
            WatchList.Remove(movieTitle);

            var listString = JsonConvert.SerializeObject(WatchList);

            WatchList.Clear();

            Application.Current.Properties["myMovieList"] = null;
            await Application.Current.SavePropertiesAsync();

            Application.Current.Properties["myMovieList"] = listString;
            await Application.Current.SavePropertiesAsync();

            var           listofstring = Application.Current.Properties["myMovieList"] as string;
            List <string> newList      = JsonConvert.DeserializeObject <List <string> >(listofstring);

            foreach (var item in newList)
            {
                WatchList.Add(item);
            }

            IsAddVisible    = true;
            IsRemoveVisible = false;
        }
コード例 #2
0
ファイル: RamWatch.cs プロジェクト: lenalia/BizHawk
        private void RemoveWatchMenuItem_Click(object sender, EventArgs e)
        {
            var items = SelectedItems.ToList();

            if (items.Any())
            {
                foreach (var item in items)
                {
                    _watches.Remove(item);
                }

                WatchListView.ItemCount = _watches.Count;
                UpdateValues();
                UpdateWatchCount();
            }
        }
コード例 #3
0
        private void RemoveWatch(object obj)
        {
            ProductMasterItem newWatch = obj as ProductMasterItem;

            if (newWatch == null)
            {
                return;
            }

            WatchList.Remove(newWatch);
            ExtendedSchedule.Instance.Update();
        }
コード例 #4
0
        /// <inheritdoc />
        public override ResponseObject CancelOrder(TradingPair pair, long orderId)
        {
            if (!WatchList.ContainsKey(orderId))
            {
                throw new InvalidStateException($"Cannot cancel order {orderId} because it doesn't exist.");
            }

            var order = WatchList[orderId];

            order.Status          = OrderUpdate.OrderStatus.Cancelled;
            order.FilledTimestamp = Timer.CurrentTime.ToUnixTimeMilliseconds();
            WatchList.Remove(order.OrderId);

            // Add to order cache to confirm cancelled.
            _orderCache.Enqueue(order);

            // Add cancelled order to the logger
            LogOrder(order);

            return(new ResponseObject(ResponseCode.Success));
        }
コード例 #5
0
ファイル: RAMWatch.cs プロジェクト: ProCNR/Trainer_dll.old
        private void SingleThreadWatch(int individualTimeout = 0, int globalTimeout = 167, int breakTimeout = 2000)
        {
            while (!_endGlobal)
            {
                while (!_endGlobal && !_breakGlobal)
                {
                    foreach (RAMValue rvt in WatchList)
                    {
                        while (!Monitor.TryEnter(WatchList))
                        {
                            Thread.Sleep(1);
                        }
                        // Read (Update)
                        if (rvt.Update)
                        {
                            rvt.ReadValue(ref _memoryReader);
                        }
                        // Write (Poke)
                        if (rvt.Write)
                        {
                            rvt.WriteValue(ref _memoryWriter);
                            WatchList.Remove(rvt);
                        }
                        // Freeze
                        if (rvt.Freeze)
                        {
                            rvt.WriteValue(ref _memoryWriter);
                        }

                        Monitor.Exit(WatchList);
                        Thread.Sleep(individualTimeout);
                    }
                    Thread.Sleep(globalTimeout);
                }
                Thread.Sleep(breakTimeout);
            }
        }
コード例 #6
0
 public void RemoveInvalid()
 {
     Assert.Throws <ArgumentNullException> (() => list.Remove(null));
 }
コード例 #7
0
ファイル: WatchListTests.cs プロジェクト: thehexgod/BESSY-DB
        public void WatchListTriggersRemove()
        {
            var wl = new WatchList<int>("carp");
            bool triggered = false;

            wl.AddRangeInternal(new int[] { 1, 2, 3 });

            wl.OnCollectionChanged += new CollectionChanged<int>(delegate(string name, IEnumerable<int> collection)
            {
                triggered = true;
            });

            wl.Remove(2);

            Assert.IsTrue(triggered);
        }