Esempio n. 1
0
 protected void RaiseOnGenericResponseReceived(GenericResponseEventArgs args)
 {
     if (null != OnGenericResponseReceived)
     {
         GenericResponseReceivedEventHandler handler = OnGenericResponseReceived;
         handler(this, args);
     }
 }
Esempio n. 2
0
        private void MainWindowViewModel_OnOrderUpdateReceived(object sender, GenericResponseEventArgs e)
        {
            if (e.GenericResponse.ContainsKey("requote"))
            {
                App.Current.Dispatcher.Invoke((Action)async delegate
                {
                    RequoteReviewWindow rrw           = new RequoteReviewWindow();
                    RequoteReviewWindowViewModel rrwm = rrw.DataContext as RequoteReviewWindowViewModel;

                    Guid orderId    = Guid.Parse(e.GenericResponse["orderid"]);
                    TradePosition p = null;
                    lock (lockTrades)
                    {
                        p = Trades.FirstOrDefault(x => orderId.CompareTo(x.OrderId) == 0);
                    }

                    if (p != null)
                    {
                        rrwm.TradePosition = p;
                        if (e.GenericResponse["pendingclose"].Length > 0)
                        {
                            rrwm.RequestedPrice = p.ClosePrice;
                        }
                        else
                        {
                            rrwm.RequestedPrice = p.OpenPrice;
                        }
                        rrwm.RequotedPrice      = decimal.Parse(e.GenericResponse["requoteprice"]);
                        rrwm.OrderId            = p.Friendlyorderid;
                        rrwm.RemainingTime      = int.Parse(e.GenericResponse["timeout"]);
                        rrwm.OnRequoteReviewed += Rrwm_OnRequoteReviewed;

                        rrwm.View = rrw;

                        await ChildWindowManager.ShowChildWindowAsync(_mainWindow, rrw, ChildWindowManager.OverlayFillBehavior.FullWindow);
                    }
                    else
                    {
                        //todo: log here
                    }
                });
            }
        }