private void OnReceiveMessage(ViewModelMessage msg) { if (msg.Message == ViewModelMessage.Message_Navigate) { if (msg.NavigateTo == ViewModelMessage.Navigation_PizzaSelector) { CurrentViewModel = MainViewModel._pizzaSelectorViewModel; Messenger.Default.Send(new ViewModelMessage { Message = ViewModelMessage.Message_LoadPizzaList, Guid = msg.Guid }); } else if (msg.NavigateTo == ViewModelMessage.Navigation_ProceedOrder) { CurrentViewModel = MainViewModel._orderSummaryViewModel; Messenger.Default.Send(new ViewModelMessage { Message = ViewModelMessage.Message_LoadOrderSummary, Guid = msg.Guid, Orders = msg.Orders }); } else if (msg.NavigateTo == ViewModelMessage.Navigation_Login) { CurrentViewModel = MainViewModel._loginViewModel; } } }
public void Continue() { var vMMessage = new ViewModelMessage <StocktakeNewViewModel, StocktakeNewModel> (this, this.StocktakeNewModel); this.MvvmNavigator.ShowView <StocktakeItemView>(vMMessage); }
private void OnReceiveMessage(ViewModelMessage msg) { if (msg.Message == ViewModelMessage.Message_LoadPizzaList) { this.Guid = msg.Guid; LoadPizzaList(); } else if (msg.Message == ViewModelMessage.Message_AddToCart) { foreach (var item in msg.OrderPart) { this.cart.Add(item); } CartIndicator = "Check Cart (" + cart.Count + ") / Proceed Order"; RaisePropertyChanged("CartIndicator"); ((RelayCommand)ProceedOrderCommand).RaiseCanExecuteChanged(); } else if (msg.Message == ViewModelMessage.Message_RemoveFromCart) { this.cart.RemoveByNameAndSize(msg.OrderedPizza.Name, msg.OrderedPizza.Diameter); CartIndicator = "Check Cart (" + cart.Count + ") / Proceed Order"; RaisePropertyChanged("CartIndicator"); ((RelayCommand)ProceedOrderCommand).RaiseCanExecuteChanged(); } else if (msg.Message == ViewModelMessage.Message_ClearCart) { cart.Clear(); CartIndicator = "Check Cart (0) / Proceed Order"; RaisePropertyChanged("CartIndicator"); ((RelayCommand)ProceedOrderCommand).RaiseCanExecuteChanged(); } }
private void OnReceiveMessage(ViewModelMessage msg) { if (msg.Message == ViewModelMessage.Message_Navigate) { if (msg.NavigateTo == ViewModelMessage.Navigation_AccountDetails) { CurrentViewModel = MainViewModel._accountDetailsViewModel; // En el mensaje pasa el parametro de usuario y de guid Messenger.Default.Send(new ViewModelMessage { Message = ViewModelMessage.Message_LoadAccountList, Guid = msg.Guid, UserName = msg.UserName }); } else if (msg.NavigateTo == ViewModelMessage.Navigation_Login) { CurrentViewModel = MainViewModel._loginViewModel; } else if (msg.NavigateTo == ViewModelMessage.Navigation_Customer) { CurrentViewModel = MainViewModel._customerViewModel; } } }
public override int Add(message model) { var userid = model.objectid; var sid = OperateContext.Current.BLLSession.ISupplier_userManager.Get(su => su.suid == userid).sid; model.tosupplier = sid; if (model.toproduct == null) { model.toproduct = 0; } IDBSession.IMessageRepository.Add(model); var messagereply = ViewModelMessage.ToEntityReply(model); IDBSession.IMessagereplyRepository.Add(messagereply); IDBSession.SaveChanges(); var item = new message(); item = model; item.supplierid = sid; item.userid = messagereply.msgto; item.objectid = messagereply.msgfrom; item.ismain = 0; item.ismessage = 1; IDBSession.IMessageRepository.Add(item); IDBSession.SaveChanges(); return(messagereply.replyid); }
/// <summary> /// Initializes the collection with the specified name. /// </summary> /// <param name="collectionName">The name of the collection (must match the property name!)</param> public VeryObservableCollection(string collectionName, ObserverManager changeManager = null, ViewModelMessage message = ViewModelMessage.None) { CollectionName = collectionName; CollectionChanged += Collection_CollectionChanged; this.message = message; this.changeManager = changeManager; }
private void RunBorrar() { _servicioDatos.DeleteSmartphone(Smartphone); var vmMensaje = new ViewModelMessage(this, "Delete", Smartphone); _messenger.Publish(vmMensaje); Close(this); }
private void OnReceiveOldCust(ViewModelMessage obj) { if (obj != null && obj.Text.Equals("Update")) { oldcust = obj.cust; StateName = obj.SName; DisplayCustomer(oldcust, StateName); } }
private void OnClickCommandAction() { var viewModelMessage = new ViewModelMessage() { Text = TextBoxText }; Messenger.Default.Send(viewModelMessage); }
public void OnSendBtn_Clicked(object sender, EventArgs e) { var viewModelMessage = new ViewModelMessage() { Text = TextBoxText }; Messenger.Default.Send(viewModelMessage); }
private void OnReceiveMessage(ViewModelMessage msg) { if (msg.Message == ViewModelMessage.Message_LoadAccountList) { this.Guid = msg.Guid; this.UserName = msg.UserName; LoadaccountList(); } }
private async void RunAgregar() { var s = await _servicioDatos.AddSmartphone(Smartphone); var vmMensaje = new ViewModelMessage(this, "Add", s); _messenger.Publish(vmMensaje); Close(this); }
private async Task ViewModelMessageHandler(ViewModelMessage message) { if (message.IsInitialized) { await CallEnterTokenDialogAsync(); } IsProgressVisible = message.IsShowingProgress; IsFlyoutOpen = message.IsShowedSearhPanel; IsShowSearchButtonEnabled = message.IsSearhEnabled; }
public void PostMessage(ViewModelMessage message) { var vm = _parentViewModel; while (vm != null) { if (vm.OnRoutedMessage(this, message)) return; vm = vm._parentViewModel; } Console.WriteLine($"Unhandled message {message}"); // TODO: remove debugging }
/// <summary> /// Notify all colleagues that are registered to the /// specific message /// </summary> /// <param name="message">The message for the notify by</param> /// <param name="args">The arguments for the message</param> public void NotifyColleagues(ViewModelMessage message, object args) { if (internalList.ContainsKey(message)) { //forward the message to all listeners foreach (Action <object> callback in internalList[message].ToList()) { callback(args); } } }
private void OnViewModelMessage(ViewModelMessage obj) { var smartphone = obj.Elemento as Smartphone; switch (obj.Accion) { case "Add": SmartphoneLista.Add(smartphone); break; case "Delete": SmartphoneLista.Remove(SmartphoneLista.FirstOrDefault(o => o.Id == smartphone.Id)); break; } }
/// <summary> /// 입력한 수식을 계산하여 Locator를 이용해 Send 해준다. /// </summary> /// <param name="argument"></param> private void Calculate(string argument) { if (string.IsNullOrEmpty(Expressions)) { return; } var temp = Evaluator.Evaluate(Expressions).ToDouble(); var message = new ViewModelMessage() { Text = temp.ToString() }; Messenger.Default.Send(message); }
protected override async Task InitializeAsync() { var message = new ViewModelMessage { IsSearhEnabled = true, IsShowedSearhPanel = true, IsShowingProgress = true }; MessengerInstance.Send( new FlyoutMessage { TypeViewModel = typeof(SearchViewModel), Header = "Search tickets", IsRightPosition = true }); MessengerInstance.Send(message); _cities = await _cacheService.GetAsync <List <City> >(DataNames.Cities); await base.InitializeAsync(); message.IsShowingProgress = false; MessengerInstance.Send(message); }
public void updateUsers() { UpdateView updateview = new UpdateView(); if (selectedCustomer == null) { MessageBox.Show("No customer selected"); } else { var viewModelMessage = new ViewModelMessage() { cust = selectedCustomer, Text = "Update", SName = statedata }; Messenger.Default.Send(viewModelMessage); updateview.ShowDialog(); } }
protected override async Task InitializeAsync() { var message = new ViewModelMessage { IsSearhEnabled = true, IsShowedSearhPanel = true, IsShowingProgress = true }; var flyoutMsg = new FlyoutMessage { TypeViewModel = typeof(SearchByMonthViewModel), Header = String.Concat(Resources.Search, " ", Resources.Tickets), IsRightPosition = true }; MessengerInstance.Send(flyoutMsg); MessengerInstance.Send(message); await base.InitializeAsync(); message.IsShowingProgress = false; MessengerInstance.Send(message); }
protected sealed override async Task InitializeAsync() { var message = new ViewModelMessage { IsShowingProgress = true }; MessengerInstance.Send <ViewModelMessage>(message); IsVisibleData = false; var list = await UpdateCollection(); Collection = new ObservableCollection <T>(list); IsVisibleData = Collection != null && Collection.Any();; IsPageMessageVisible = !IsVisibleData; message.IsShowingProgress = false; MessengerInstance.Send <ViewModelMessage>(message); }
private void OnReceiveMessage(ViewModelMessage msg) { if (msg.Message == ViewModelMessage.Message_OpenDialog) { if (msg.Dialog == ViewModelMessage.Dialog_SelectQuantityAndSize) { SizeAndQuantityViewModel vm = new ViewModelLocator().SizeAndQuantityView; vm.Pizza = msg.Pizza; vm.Quantity = "1"; vm.Size = "32"; SizeAndQuantityView view = new SizeAndQuantityView { DataContext = vm }; view.Show(); } else if (msg.Dialog == ViewModelMessage.Dialog_OrderSuccess) { MessageBox.Show("Order successfully completed."); } else if (msg.Dialog == ViewModelMessage.Dialog_OrderFailed) { MessageBox.Show("Failed to order, please try again later."); } else if (msg.Dialog == ViewModelMessage.Dialog_LoginFailed) { MessageBox.Show("Login failed. Invalid Username or Password."); } else if (msg.Dialog == ViewModelMessage.Dialog_RegistrationSuccess) { MessageBox.Show("Registration completed, you may now login."); } else if (msg.Dialog == ViewModelMessage.Dialog_RegistrationFailed) { MessageBox.Show("Registration failed!"); } } }
protected override async Task InitializeAsync() { var message = new ViewModelMessage { IsSearhEnabled = true, IsShowedSearhPanel = true, IsShowingProgress = true }; var flyoutMsg = new FlyoutMessage { TypeViewModel = typeof(SimpleSearchViewModel), Header = String.Concat(Resources.Search, " ", Resources.Cities), IsRightPosition = true }; MessengerInstance.Send(flyoutMsg); MessengerInstance.Send(message); _cities = await _cacheService.GetAsync <IEnumerable <City> >(DataNames.Cities); await base.InitializeAsync(); message.IsShowingProgress = false; MessengerInstance.Send(message); }
private void OnReceiveMessage(ViewModelMessage msg) { if (msg.Message == ViewModelMessage.Message_LoadOrderSummary) { guid = msg.Guid; LoadOrderSummary(msg.Orders); } else if (msg.Message == ViewModelMessage.Message_RemoveFromCart) { Orders.RemoveByNameAndSize(msg.OrderedPizza.Name, msg.OrderedPizza.Diameter); TotalPrice = "Total Price: " + Orders.Sum(p => { // remove the " HUF" trailing and convert it to int return(int.Parse(p.Price.Substring(0, p.Price.Length - 4))); }).ToString() + " HUF"; // put back " HUF" RaisePropertyChanged("TotalPrice"); } else if (msg.Message == ViewModelMessage.Message_ClearCart) { Orders.Clear(); TotalPrice = "Total Price: 0 HUF"; RaisePropertyChanged("TotalPrice"); } }
public void Handle(object sender, ViewModelMessage message) { Extensions.TraceMessage(this, sender, message); }
protected override bool OnRoutedMessage(ViewModelBase sender, ViewModelMessage message) { var showTx = message as ShowTransactionMessage; if (showTx != null) { ShowTransaction(showTx.Transaction); return true; } var showAccount = message as ShowAccountMessage; if (showAccount != null) { ShowAccount(showAccount.Account); return true; } var openDialog = message as OpenDialogMessage; if (openDialog != null && sender == VisibleContent) { VisibleDialogContent = openDialog.Dialog; return true; } var hideDialog = message as HideDialogMessage; if (hideDialog != null && sender == VisibleDialogContent) { VisibleDialogContent = null; return true; } return false; }
private void OnReceiveMessageAction(ViewModelMessage obj) { ContentText = obj.Text; }
public UserControlMessageTemplate() { InitializeComponent(); DataContext = new ViewModelMessage(); }
public TestMessages() { InitializeComponent(); DataContext = new ViewModelMessage(); }
/// <summary> /// Registers a Colleague to a specific message /// </summary> /// <param name="callback">The callback to use /// when the message it seen</param> /// <param name="message">The message to /// register to</param> public void Register(Action <Object> callback, ViewModelMessage message) { internalList.AddValue(message, callback); }
public MainViewModel() { selectedCustomer = new Customer(); this.CloseWindowCommand = new RelayCommand <Window>(this.CloseWindow); AddUsersCommand = new RelayCommand(addUsers); UpdateUsersCommand = new RelayCommand(updateUsers); GetCustomerCommand = new RelayCommand(() => { try { customerID = Convert.ToInt32(IdTextBox); var data = (from customer in MMABooksEntity.mmaBooks.Customers where customer.CustomerID == customerID select customer).FirstOrDefault <Customer>(); statedata = (from customer in MMABooksEntity.mmaBooks.Customers join state in MMABooksEntity.mmaBooks.States on customer.CustomerID equals customerID select state.StateName).First().ToString(); selectedCustomer = data; this.DisplayCustomer(statedata); var viewModelMessage = new ViewModelMessage() { SName = statedata, Text = "StateName" }; } catch (DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); if (MMABooksEntity.mmaBooks.Entry(selectedCustomer).State == EntityState.Detached) { MessageBox.Show("Another user has deleted " + "that customer.", "Concurrency Error"); //customerID = " "; } else { MessageBox.Show("Another user has updated " + "that customer.", "Concurrency Error"); DisplayCustomer(null); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); this.ClearControls(); } }); DeleteUsersCommand = new RelayCommand(() => { try { customerID = Convert.ToInt32(IdTextBox); var data = (from customer in MMABooksEntity.mmaBooks.Customers //join state in MMABooksEntity.mmaBooks.States //on customer.State equals state.StateCode where customer.CustomerID == customerID select customer).FirstOrDefault <Customer>(); selectedCustomer = data; MMABooksEntity.mmaBooks.Customers.Remove(selectedCustomer); MMABooksEntity.mmaBooks.SaveChanges(); MessageBox.Show("Customer Removed!"); this.ClearControls(); } catch (DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); if (MMABooksEntity.mmaBooks.Entry(selectedCustomer).State == EntityState.Detached) { MessageBox.Show("Another user has deleted " + "that customer.", "Concurrency Error"); //customerID = " "; } else { MessageBox.Show("Another user has updated " + "that customer.", "Concurrency Error"); DisplayCustomer(null); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }); Messenger.Default.Register <Customer>(this, "add", (customer) => { try { selectedCustomer = customer; this.DisplayCustomer(null); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }); Messenger.Default.Register <Customer>(this, "edit", (customer) => { try { selectedCustomer = customer; this.DisplayCustomer(null); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }); }
public MessagePage() { InitializeComponent(); BindingContext = new ViewModelMessage(); }
/// <summary> /// Optionally handles a specific message posted by a child view model. /// </summary> /// <param name="message">Child message to handle.</param> /// <returns>Returns true if the message was handled and should not be propigated to a parent view model.</returns> protected virtual bool OnRoutedMessage(ViewModelBase sender, ViewModelMessage message) { return false; }