Example #1
0
        void OnTrade(ITrade trade)
        {
            Console.WriteLine("WatchNotification: trade made");

            var boughtOrSold = trade.Direction == Direction.BUY ? "bought" : "sold";

            var currencyOne  = trade.CurrencyPair.Substring(0, 3);
            var currencyTwo  = trade.CurrencyPair.Substring(3, 3);
            var currentyPair = _currenyPairs[trade.CurrencyPair];

            var userInfo = new NSMutableDictionary
            {
                { (NSString)"trade", trade.ToNSString() },
                { WormHoleConstants.CurrencyPairKey, currentyPair.ToNSString() },
                { (NSString)"baseCurrency", (NSString)currencyOne },
                { (NSString)"counterCurrency", (NSString)currencyTwo }
            };

            var notification = new UILocalNotification
            {
                AlertBody   = $"'{trade.TraderName}' {boughtOrSold} {trade.Notional:n0} {trade.DealtCurrency} vs {currencyTwo} at {trade.SpotRate}",
                Category    = "trade",
                UserInfo    = userInfo,
                AlertTitle  = "Trade Executed",
                AlertAction = $"Show {currencyOne} / {currencyTwo}",
                HasAction   = true,
                SoundName   = UILocalNotification.DefaultSoundName
            };

            Console.WriteLine("WatchNotification: sending from iPhone " + notification.AlertBody);
            UIApplication.SharedApplication.PresentLocalNotificationNow(notification);
        }
        void OnTrade(ITrade trade)
        {
            Console.WriteLine("WatchNotification: trade made");                 

            var boughtOrSold = trade.Direction == Direction.BUY ? "bought" : "sold";

            var currencyOne = trade.CurrencyPair.Substring(0, 3);
            var currencyTwo = trade.CurrencyPair.Substring(3, 3);
            var currentyPair = _currenyPairs[trade.CurrencyPair];

            var userInfo = new NSMutableDictionary
            {
                { (NSString)"trade", trade.ToNSString() },
                { WormHoleConstants.CurrencyPairKey, currentyPair.ToNSString() },
                { (NSString)"baseCurrency", (NSString)currencyOne },
                { (NSString)"counterCurrency", (NSString)currencyTwo }
            };

            var notification = new UILocalNotification
            {
                AlertBody = $"'{trade.TraderName}' {boughtOrSold} {trade.Notional:n0} {trade.DealtCurrency} vs {currencyTwo} at {trade.SpotRate}",
                Category = "trade",
                UserInfo = userInfo,
                AlertTitle = "Trade Executed",
                AlertAction = $"Show {currencyOne} / {currencyTwo}",
                HasAction = true,
                SoundName = UILocalNotification.DefaultSoundName
            };
            
            Console.WriteLine("WatchNotification: sending from iPhone " + notification.AlertBody);                 
            UIApplication.SharedApplication.PresentLocalNotificationNow(notification);
        }