private void listView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var itemInconveniente = (InconvenienteDTO)e.SelectedItem; if (itemInconveniente == null) { _vm.IsStartEnabled = false; _vm.IsStopEnabled = false; _vm.IsCloseInconvenienteEnabled = false; _vm.IsExtraEnabled = true; _vm.IsPhotoEnabled = false; _vm.IsTakePhotoEnabled = false; btnStart.BackgroundColor = Color.LightGreen; btnStop.BackgroundColor = Color.IndianRed; btnCloseInconveniente.BackgroundColor = Color.LightCyan; btnCloseInconveniente.TextColor = Color.DarkGray; } if (lastInconveniente != null) { if (App.timer.IsRunning) { listView.SelectedItem = lastInconveniente; return; } else { lastInconveniente.selection = false; } } if (itemInconveniente != null) { btnStart.BackgroundColor = Color.DarkGreen; btnStop.BackgroundColor = Color.IndianRed; btnCloseInconveniente.BackgroundColor = Color.FromHex("#3F51B5"); btnCloseInconveniente.TextColor = Color.White; itemInconveniente.selection = true; if (itemInconveniente.Stato.Equals("Da autorizzare")) { btnStart.BackgroundColor = Color.LightGreen; btnStop.BackgroundColor = Color.IndianRed; btnCloseInconveniente.BackgroundColor = Color.LightCyan; } else { _vm.IsCloseInconvenienteEnabled = true; _vm.IsExtraEnabled = true; _vm.IsPhotoEnabled = true; _vm.IsTakePhotoEnabled = true; _vm.selectedInconveniente = itemInconveniente; } lastInconveniente = itemInconveniente; } _vm.listSelectedInconvenienti?.Execute(e); }
public GestionePopupNoteView(NoteDTO note, InconvenienteDTO inconveniente = null) { InitializeComponent(); this._inconveniente = inconveniente; this._note = note; _vmNotesViewModel = (GestioneNoteViewModel)(ServiceLocator.Current.GetInstance(typeof(GestioneNoteViewModel))); _vmNotesViewModel.inconvenienteDTO = inconveniente; _vmNotesViewModel.noteDTO = note; BindingContext = _vmNotesViewModel; }
public ViewInconveniente(CommessaDTO commessaDTO = null, InconvenienteDTO inconveniente = null) { InitializeComponent(); this._commessa = commessaDTO.NumeroCommessa; this._targa = commessaDTO.TargaCommessa; _vm = (InconvenienteViewModel)(ServiceLocator.Current.GetInstance(typeof(InconvenienteViewModel))); _vm.Navigation = this.Navigation; _vm.selectedCommessa = commessaDTO; _vm.IDCommessa = _commessa; _vm.targaVeicolo = _targa; _vm.codiceCliente = commessaDTO.codice; _vm.ragioneSociale = commessaDTO.ragioneSociale; _vm.telefono = commessaDTO.telefono; _vm.mail = commessaDTO.email; _vm.numeroTelaio = commessaDTO.Telaio; _vm.nomeVeicolo = commessaDTO.DescrizioneVeicolo; _vm.selectedInconveniente = inconveniente; _vm.defCommessa = "Commessa N :" + _commessa + ",Targa Veicolo : " + _targa + " , Telaio : " + commessaDTO.Telaio + " , Veicolo : " + commessaDTO.DescrizioneVeicolo; BindingContext = _vm; ((InconvenienteViewModel)BindingContext).Initialize(this); //MessagingCenter.Subscribe<string, string>(MessagingCenterEvents.Subscriber, MessagingCenterEvents.AlertError, async (sender, msg) => //{ // await DisplayAlert("Informazioni", msg, "OK"); //}); MessagingCenter.Subscribe <Application, DisplayAlertMessage>(this, "Attenzione!", async(sender, message) => { const string title = "Informazioni"; const string cancel = "No"; var result = true; if (!string.IsNullOrEmpty(message.Accept) && !string.IsNullOrEmpty(message.Message)) { result = await DisplayAlert(title, message.Message, message.Accept, cancel); } if (message.OnCompleted != null) { message.OnCompleted(result); } }, Application.Current); SetBackgroundColorButton(); }
public ExtraView(InconvenienteDTO inconveniente, string commessa, string idCommessa, string targa, CommessaDTO commessaDTO) { InitializeComponent(); vm = (InconvenienteExtraViewModel)(ServiceLocator.Current.GetInstance(typeof(InconvenienteExtraViewModel))); vm.Navigation = this.Navigation; vm.defCommessaInExtra = commessa; vm.idCommessa = idCommessa; vm.targa = targa; vm.numeroTelaio = commessaDTO.Telaio; vm.nomeVeicolo = commessaDTO.DescrizioneVeicolo; vm.codiceCliente = commessaDTO.codice; vm.ragioneSociale = commessaDTO.ragioneSociale; vm.telefono = commessaDTO.telefono; vm.mail = commessaDTO.email; vm.commessaDTO = commessaDTO; BindingContext = vm; ((InconvenienteExtraViewModel)BindingContext).Initialize(this); }
public HistoryNotesPage(InconvenienteDTO inconvenienteDTO, CommessaDTO commessaDTO) { InitializeComponent(); _vmNotesPageViewModel = (HistoryNotesPageViewModel)(ServiceLocator.Current.GetInstance(typeof(HistoryNotesPageViewModel))); _vmNotesPageViewModel.IDCommessa = commessaDTO.NumeroCommessa; _vmNotesPageViewModel.targaVeicolo = commessaDTO.TargaCommessa; _vmNotesPageViewModel.codiceCliente = commessaDTO.codice; _vmNotesPageViewModel.ragioneSociale = commessaDTO.ragioneSociale; _vmNotesPageViewModel.telefono = commessaDTO.telefono; _vmNotesPageViewModel.mail = commessaDTO.email; _vmNotesPageViewModel.numeroTelaio = commessaDTO.Telaio; _vmNotesPageViewModel.nomeVeicolo = commessaDTO.DescrizioneVeicolo; _vmNotesPageViewModel.inconvenienteDTO = inconvenienteDTO; this._inconveniente = inconvenienteDTO; BindingContext = _vmNotesPageViewModel; ((HistoryNotesPageViewModel)BindingContext).Initialize(this); try { //questo "segnale" é l'unico modo per poter refreshare la lista delle note dopo un inserimento. MessagingCenter.Subscribe <App>((App)Application.Current, "OnNoteCreated", async(sender) => { if (_vmNotesPageViewModel.lstNote != null) { if (_vmNotesPageViewModel.lstNote.Any()) { _vmNotesPageViewModel.lstNote.Clear(); await _vmNotesPageViewModel.GetNote(); } } }); } catch (Exception ecc) { Log.Error("AppOfficina", ecc.Message); } }
public PhotoUploadView(CommessaDTO commessa, InconvenienteDTO convDTO) { InitializeComponent(); _vm = (PhotoUploadViewModel)(ServiceLocator.Current.GetInstance(typeof(PhotoUploadViewModel))); _vm.SelectedCommessa = commessa; _vm.SelectedInconveniente = convDTO; _vm.idCommessa = commessa.NumeroCommessa; _vm.targa = commessa.TargaCommessa; _vm.numeroTelaio = commessa.Telaio; _vm.nomeVeicolo = commessa.DescrizioneVeicolo; _vm.codiceCliente = commessa.codice; _vm.ragioneSociale = commessa.ragioneSociale; _vm.telefono = commessa.telefono; _vm.mail = commessa.email; _vm.Navigation = this.Navigation; BindingContext = _vm; //MessagingCenter.Subscribe<string, string>(MessagingCenterEvents.Subscriber, MessagingCenterEvents.AlertError, async (sender, msg) => //{ // await DisplayAlert("Warning", msg, "OK"); //}); ((PhotoUploadViewModel)BindingContext).Initialize(this); }