Example #1
0
 public void AddWatch(Watch watch)
 {
     _watches.Add(watch);
     WatchListView.RowCount = _watches.Count;
     GeneralUpdate();
     UpdateWatchCount();
     Changes();
 }
Example #2
0
 public void AddWatch(Watch watch)
 {
     _watches.Add(watch);
     WatchListView.ItemCount = _watches.Count;
     UpdateValues();
     UpdateWatchCount();
     Changes();
 }
Example #3
0
		private void SaveMenuItem_Click(object sender, EventArgs e)
		{
			if (!string.IsNullOrWhiteSpace(_currentFileName))
			{
				var watches = new WatchList(MemoryDomains, Emu.SystemId) { CurrentFileName = _currentFileName };
				for (var i = 0; i < _searches.Count; i++)
				{
					watches.Add(_searches[i]);
				}

				if (!string.IsNullOrWhiteSpace(watches.CurrentFileName))
				{
					if (watches.Save())
					{
						_currentFileName = watches.CurrentFileName;
						MessageLabel.Text = $"{Path.GetFileName(_currentFileName)} saved";
						Settings.RecentSearches.Add(watches.CurrentFileName);
					}
				}
				else
				{
					var result = watches.SaveAs(GetWatchSaveFileFromUser(CurrentFileName()));
					if (result)
					{
						MessageLabel.Text = $"{Path.GetFileName(_currentFileName)} saved";
						Settings.RecentSearches.Add(watches.CurrentFileName);
					}
				}
			}
		}
Example #4
0
        /// <inheritdoc />
        public override ResponseObject <OrderUpdate> PlaceStoplossOrder(TradingPair pair, OrderSide side, decimal quantity, decimal price, long tradeId)
        {
            // Add the order to the watchlist
            OrderUpdate order = new OrderUpdate(
                orderId: _mockOrderCounter++,
                tradeId: tradeId,
                orderStatus: OrderUpdate.OrderStatus.New,
                orderType: OrderUpdate.OrderTypes.StopLoss,
                createdTimestamp: Timer.CurrentTime.ToUnixTimeMilliseconds(),
                setPrice: 0,
                side: side,
                pair: pair,
                setQuantity: quantity)
            {
                StopPrice = price,
            };

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

            // Add to watchlist to check if filled
            WatchList.Add(order.OrderId, order);

            return(new ResponseObject <OrderUpdate>(ResponseCode.Success, order));
        }
Example #5
0
 public PlatformClassVertexChangeListener(string[] watchList)
 {
     foreach (string w in watchList)
     {
         WatchList.Add(w);
     }
 }
        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;
        }
Example #7
0
 /// <summary>
 /// Add a company to the user's watchlist.
 /// </summary>
 /// <param name="company"></param>
 public void AddToWatchList(Company company)
 {
     if (!CompanyInWatchList(company))
     {
         WatchList.Add(company);
         MessageBox.Show("Company added to watchlist.");
     }
     else
     {
         MessageBox.Show("Company already in watchlist.");
     }
 }
        /// <summary>
        /// Restart is called the first time you call the form
        /// but also when you start playing a movie
        /// </summary>
        public void Restart()
        {
            //set a client padding
            ClientApi.SetExtraPadding(50, 50);

            if (Global.Game.Name != "Null")
            {
                //first initialization of WatchList
                if (_watches == null)
                {
                    _watches = new WatchList(_memoryDomains, _emu.SystemId ?? string.Empty);

                    //Create some watch
                    Watch myFirstWatch  = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x40, WatchSize.Byte, BizHawk.Client.Common.DisplayType.Hex, true);
                    Watch mySecondWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x50, WatchSize.Word, BizHawk.Client.Common.DisplayType.Unsigned, true);
                    Watch myThirdWatch  = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x60, WatchSize.DWord, BizHawk.Client.Common.DisplayType.Hex, true);

                    //add them into the list
                    _watches.Add(myFirstWatch);
                    _watches.Add(mySecondWatch);
                    _watches.Add(myThirdWatch);

                    label_Game.Text     = string.Format("You're playing {0}", Global.Game.Name);
                    label_GameHash.Text = string.Format("Hash: {0}", Global.Game.Hash);
                }
                //refresh it
                else
                {
                    _watches.RefreshDomains(_memoryDomains);
                    label_Game.Text     = string.Format("You're playing {0}", Global.Game.Name);
                    label_GameHash.Text = string.Format("Hash: {0}", Global.Game.Hash);
                }
            }
            else
            {
                label_Game.Text     = string.Format("You aren't playing to anything");
                label_GameHash.Text = string.Empty;
            }
        }
Example #9
0
        private void AddWatch(object obj)
        {
            ProductMasterItem newWatch = obj as ProductMasterItem;

            if (newWatch == null)
            {
                return;
            }

            if (!WatchList.Contains(newWatch))
            {
                WatchList.Add(newWatch);
                ExtendedSchedule.Instance.Update();
            }
        }
Example #10
0
        public void AddToWatchList(string[] animes, List <Anime> animeList)
        {
            foreach (var item in animes)
            {
                if (!int.TryParse(item, out int index) || index >= animeList.Count || index < 0)
                {
                    Program.DisplayError($"ERROR: INVALID INDEX: {item} PROVIDED, SO IT WON'T BE ADDED");
                    continue;
                }

                string title = animeList[index].Title;

                for (int i = title.Length - 1; i != 0; i--)
                {
                    if (title[i] == '-')
                    {
                        var animeToBeAdded = new WatchListItem()
                        {
                            Title         = title.Remove(i),
                            LatestEpisode = 0,
                            IsDownloaded  = false,
                            ReleaseDay    = animeList[index].PubDate
                        };

                        // Check if it already exists in the watchlist
                        if (WatchList.Contains(animeToBeAdded))
                        {
                            Program.DisplayError($"Anime \"{animeToBeAdded.Title}\" already exists in the watchlist");
                            break;
                        }

                        // Add a new watchlist value
                        WatchList.Add(animeToBeAdded);
                        break;
                    }
                }
            }
            // Rechecks the whole list for containing animes
            foreach (var anime in animeList)
            {
                anime.IsInWatchList = ContainsInWatchList(anime);
            }

            WatchList.Sort();
        }
Example #11
0
        /// <inheritdoc />
        public override ResponseObject <OrderUpdate> PlaceLimitOrder(TradingPair pair, OrderSide side, decimal quantity, decimal price, long tradeId)
        {
            // Add the order to the watchlist
            OrderUpdate order = new OrderUpdate(
                _mockOrderCounter++,
                tradeId,
                OrderUpdate.OrderStatus.New,
                OrderUpdate.OrderTypes.Limit,
                Timer.CurrentTime.ToUnixTimeMilliseconds(),
                price,
                side,
                pair,
                quantity);

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

            // Add to watch list to check if filled
            WatchList.Add(order.OrderId, order);

            return(new ResponseObject <OrderUpdate>(ResponseCode.Success, order));
        }
Example #12
0
 public void AddInvalid()
 {
     Assert.Throws <ArgumentNullException> (() => list.Add(null));
 }
Example #13
0
		private void SaveMenuItem_Click(object sender, EventArgs e)
		{
			if (!string.IsNullOrWhiteSpace(_currentFileName))
			{
				var watches = new WatchList(_settings.Domain) { CurrentFileName = _currentFileName };
				for (var i = 0; i < _searches.Count; i++)
				{
					watches.Add(_searches[i]);
				}

				if (!string.IsNullOrWhiteSpace(watches.CurrentFileName))
				{
					if (watches.Save())
					{
						_currentFileName = watches.CurrentFileName;
						MessageLabel.Text = Path.GetFileName(_currentFileName) + " saved";
					}
				}
				else
				{
					var result = watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(watches.CurrentFileName));
					if (result)
					{
						MessageLabel.Text = Path.GetFileName(_currentFileName) + " saved";
						Global.Config.RecentWatches.Add(watches.CurrentFileName);
					}
				}
			}
		}
Example #14
0
        private void SaveAsMenuItem_Click(object sender, EventArgs e)
        {
            var watches = new WatchList(MemoryDomains, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName };
            for (var i = 0; i < _searches.Count; i++)
            {
                watches.Add(_searches[i]);
            }

            if (watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(watches.CurrentFileName)))
            {
                _currentFileName = watches.CurrentFileName;
                MessageLabel.Text = Path.GetFileName(_currentFileName) + " saved";
                Settings.RecentSearches.Add(watches.CurrentFileName);
            }
        }
Example #15
0
        /// <summary>
        /// Add the value from the queue in the correct watch list
        /// </summary>
        /// <param name="dispatchTimeout"></param>
        private void Dispatch(int dispatchTimeout)
        {
            RAMValue rvt;

            while (!_endGlobal)
            {
                while (!_endGlobal && !_breakGlobal)
                {
                    if (RAMValueQueue.Count > 0)
                    {
                        switch (_watchMode)
                        {
                        // MONO THREAD MODE
                        case WatchMode.SingleThreaded:
                            while (!Monitor.TryEnter(WatchList))
                            {
                                Thread.Sleep(1);
                            }
                            while (RAMValueQueue.Count > 0)
                            {
                                if (RAMValueQueue.TryDequeue(out rvt))
                                {
                                    WatchList.Add(rvt);
                                }
                            }
                            Monitor.Exit(WatchList);
                            break;


                        // MULTI THREAD MODE 1 ( 1 THREAD PER ACTION )
                        case WatchMode.MultiThreaded_A:
                            while (RAMValueQueue.Count > 0)
                            {
                                RAMValueQueue.TryDequeue(out rvt);
                                if (rvt.Update)
                                {
                                    while (!Monitor.TryEnter(ThreadedWatchLists["read_0"]))
                                    {
                                        Thread.Sleep(1);
                                    }
                                    ThreadedWatchLists["read_0"].Add(rvt);
                                }

                                if (rvt.Write)
                                {
                                    ThreadedWatchLists["write_0"].Add(rvt);
                                }
                                if (rvt.Freeze)
                                {
                                    ThreadedWatchLists["freeze_0"].Add(rvt);
                                }
                            }
                            break;

                        // MULTI THREAD MODE N ( N THREAD PER ACTION )
                        case WatchMode.MultiThreaded_N:
                            //TODO
                            break;

                        // MULTI THREAD MODE S ( N SINGLE THREAD )
                        case WatchMode.MultiThreaded_S:
                            //TODO
                            break;
                        }
                    }

                    Thread.Sleep(dispatchTimeout);
                }
            }
        }