private async Task MaintainMainCategoriesAsync() { await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, new MainCategoryOverview() { IsModal = true, DataContext = new MainCategoryViewmodel(_mainViewmodel, this) }); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { _explorer = new TemplateExplorer(); _explorer.ClosingFinished += new RoutedEventHandler(explorer_ClosingFinished); ChildWindowManager.ShowChildWindowAsync(this, _explorer); }
private async void ExecuteEditSelectedCoverPositionCommand() { CoverPositionWindow cpw = new CoverPositionWindow(); CoverPositionWindowViewModel cpwContext = cpw.DataContext as CoverPositionWindowViewModel; cpwContext.View = cpw; cpwContext.OnTradeExecuted += CpwContext_OnTradeExecuted; lock (lockQuotes) { cpwContext._commodities.AddRange(Quotes.Select(x => x.Name).ToList()); } if (cpwContext._commodities.Count > 0) { cpwContext.SelectedCommodity = cpwContext._commodities[0]; cpwContext.CommoditiesCollection.Refresh(); } var position = OpenCoverTradesCollectionView.CurrentItem as CoverPosition; if (null == position) { return; } cpwContext.CoverPosition = position; cpwContext.SelectedCommodity = position.Commodity; cpwContext.SelectedCoveringAccount = position.Coveraccount_id; cpwContext.SelectedOrderType = position.OrderType; cpwContext.LotSize = position.Amount; cpwContext.OpenPrice = position.OpenPrice; cpwContext.Orderid = position.Remoteid; await ChildWindowManager.ShowChildWindowAsync(_mainWindow, cpw, ChildWindowManager.OverlayFillBehavior.WindowContent); }
private async Task ShowAccountAsync() { await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, new AccountView() { IsModal = true }); }
private async Task ShowAccountAsync() { _view.Close(); await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, new ChangePassswordView() { IsModal = true }); }
private async Task ImportTransactionsAsync() { var view = new ImportWizardView(); view.IsModal = true; view.DataContext = new ImportWizardViewmodel(_mainViewmodel, view); await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, view); ReloadCurrentCollection(); }
protected void ViewAllCards(object sender, RoutedEventArgs e) { e.Handled = true; var playWindow = (PlayWindow)Window.GetWindow(this); if (playWindow == null) { return; } ChildWindowManager manager = playWindow.wndManager; manager.Show(new GroupWindow(@group, PilePosition.All, 0)); }
protected void ViewBottomCards(object sender, RoutedEventArgs e) { e.Handled = true; int count = Dialog.InputPositiveInt("View bottom cards", "How many cards do you want to see?", 1); var playWindow = (PlayWindow)Window.GetWindow(this); if (playWindow == null) { return; } ChildWindowManager manager = playWindow.wndManager; manager.Show(new GroupWindow(@group, PilePosition.Bottom, count)); }
private async Task EditTransactionAsync(Transaction transaction) { var view = new Views.ChildViews.EditTransactionWizard(); view.IsModal = true; var vm = new EditTransactionWizardViewmodel(transaction, view, _mainViewmodel); view.DataContext = vm; await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, view); if (vm.Result) { Refresh(null); } //Refresh(null); }
private async Task ResetPasswordCompletedAsync(object sender, EventArgs e) { if (((ConfirmEmailResult)ApiCallNotifier.Result).IsError) { if (((ConfirmEmailResult)ApiCallNotifier.Result).ErrorType == ConfirmEmailErrorType.NoConnection) { ErrorMessage = "Geen verbinding met server"; } else if (((ConfirmEmailResult)ApiCallNotifier.Result).Errors != null && ((ConfirmEmailResult)ApiCallNotifier.Result).Errors.Count > 0) { ErrorMessage = string.Empty; foreach (var error in ((ConfirmEmailResult)ApiCallNotifier.Result).Errors) { if (!string.IsNullOrWhiteSpace(error.Description)) { if (!string.IsNullOrWhiteSpace(ErrorMessage)) { ErrorMessage += Environment.NewLine; } ErrorMessage += error.Description; } } } } else { if (!_changePassword) { LoginView loginView = new LoginView(); loginView.DataContext = new LoginViewmodel(loginView) { EmailAdress = EmailAdress }; loginView.Show(); _view.Close(); } else { _view.Close(); await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, new AccountView() { IsModal = true }); } } }
private async void ExecuteTradeCommand() { TradeOrderWindow tow = new TradeOrderWindow(); TradeOrderWindowViewModel towContext = tow.DataContext as TradeOrderWindowViewModel; towContext.View = tow; towContext.OnTradeExecuted += TowContext_OnTradeExecuted; var quote = QuoteCollectionView.CurrentItem as SharedData.poco.Quote; if (null == quote) { return; } towContext.TradingSymbol = quote.Name; await ChildWindowManager.ShowChildWindowAsync(_mainWindow, tow, ChildWindowManager.OverlayFillBehavior.WindowContent); }
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 } }); } }
private async void ExecuteNewCoverPositionCommand() { CoverPositionWindow cpw = new CoverPositionWindow(); CoverPositionWindowViewModel cpwContext = cpw.DataContext as CoverPositionWindowViewModel; cpwContext.View = cpw; cpwContext.OnTradeExecuted += CpwContext_OnTradeExecuted; lock (lockQuotes) { cpwContext._commodities.AddRange(Quotes.Select(x => x.Name).ToList()); } if (cpwContext._commodities.Count > 0) { cpwContext.SelectedCommodity = cpwContext._commodities[0]; cpwContext.CommoditiesCollection.Refresh(); } await ChildWindowManager.ShowChildWindowAsync(_mainWindow, cpw, ChildWindowManager.OverlayFillBehavior.WindowContent); }
private void Window_Loaded(object sender, RoutedEventArgs e) { mChildManager = new ChildWindowManager(this); }
public ForgottenPasswordViewmodel(IView view, string emailAdress, bool changePassword = false) { ApiCallNotifier = new NotifyTaskCompletion <object>(Task.FromResult <object>(null)); _changePassword = changePassword; _view = view; EmailAdress = emailAdress; SendEmailCodeCommand = new RelayCommand((object obj) => { if (!string.IsNullOrWhiteSpace(EmailAdress)) { ApiCallNotifier = new NotifyTaskCompletion <object>(LoginRepository.Instance.SendPasswordResetCode(EmailAdress, _changePassword).ContinueWith(t => (object)t.Result), SendResetCodeCompleted); } }); ConfirmCommand = new RelayCommand((object obj) => { IChangePasswordView forgotView = (IChangePasswordView)obj; ErrorMessage = string.Empty; if (string.IsNullOrWhiteSpace(forgotView.PassBoxReg1.Password)) { ErrorMessage += "Geen wachwoord ingevuld"; } if (forgotView.PassBoxReg1.Password != forgotView.PassBoxReg2.Password) { if (ErrorMessage != string.Empty) { ErrorMessage += Environment.NewLine; } ErrorMessage += "Wachtwoorden komen niet overeen"; } if (string.IsNullOrWhiteSpace(EmailAdress)) { if (ErrorMessage != string.Empty) { ErrorMessage += Environment.NewLine; } ErrorMessage += "Geen emailadres ingevuld"; } if (string.IsNullOrWhiteSpace(ResetCode)) { if (ErrorMessage != string.Empty) { ErrorMessage += Environment.NewLine; } ErrorMessage += "Geen code ingevuld"; } if (string.IsNullOrWhiteSpace(ErrorMessage)) { ApiCallNotifier = new NotifyTaskCompletion <object>(LoginRepository.Instance.ResetPasswordAsync(EmailAdress, ResetCode, forgotView.PassBoxReg1.Password).ContinueWith(t => (object)t.Result), async(object sender, EventArgs e) => await ResetPasswordCompletedAsync(sender, e)); } }); BackCommand = new RelayCommand(async(object obj) => { if (!_changePassword) { LoginView loginView = new LoginView(); loginView.DataContext = new LoginViewmodel(loginView) { EmailAdress = EmailAdress }; loginView.Show(); view.Close(); } else { view.Close(); await ChildWindowManager.ShowChildWindowAsync(MainWindow.CurrentMainWindow, new AccountView() { IsModal = true }); } }); }