diff options
Diffstat (limited to 'Gestor.Application/Views/Seguros/TrocarClienteView.cs')
| -rw-r--r-- | Gestor.Application/Views/Seguros/TrocarClienteView.cs | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/Gestor.Application/Views/Seguros/TrocarClienteView.cs b/Gestor.Application/Views/Seguros/TrocarClienteView.cs deleted file mode 100644 index 61be59b..0000000 --- a/Gestor.Application/Views/Seguros/TrocarClienteView.cs +++ /dev/null @@ -1,154 +0,0 @@ -using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.ViewModels.Seguros;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Seguros;
-using MaterialDesignThemes.Wpf;
-using System;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Markup;
-using System.Windows.Threading;
-
-namespace Gestor.Application.Views.Seguros
-{
- public class TrocarClienteView : BaseUserControl, IComponentConnector
- {
- public TrocarClienteViewModel ViewModel;
-
- internal System.Windows.Controls.ProgressBar ProgressBar;
-
- internal MaterialDesignThemes.Wpf.Snackbar Snackbar;
-
- private bool _contentLoaded;
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public TrocarClienteView(Documento documento)
- {
- this.ViewModel = new TrocarClienteViewModel()
- {
- SelectedDocumento = documento
- };
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- }
-
- private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim()), null, 2).ContinueWith((Task<List<Cliente>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void CloseSlackBar()
- {
- Thread.Sleep(5000);
- System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher;
- if (dispatcher == null)
- {
- return;
- }
- dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false)));
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- {
- return;
- }
- this._contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/views/seguros/trocarclienteview.xaml", UriKind.Relative));
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- if (!await this.ViewModel.Salvar())
- {
- this.ToggleSnackBar("ERRO AO TROCAR CLIENTE.", true);
- }
- else
- {
- this.ToggleSnackBar("CLIENTE TROCADO COM SUCESSO.", true);
- }
- }
-
- private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
- {
- this.Snackbar.set_IsActive(false);
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- this.ProgressBar = (System.Windows.Controls.ProgressBar)target;
- return;
- }
- case 2:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
- return;
- }
- case 3:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, TrocarClienteView.AutoCompleteBox_Populating));
- return;
- }
- case 4:
- {
- this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target;
- return;
- }
- case 5:
- {
- ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick));
- return;
- }
- }
- this._contentLoaded = true;
- }
-
- public void ToggleSnackBar(string message, bool active = true)
- {
- this.Snackbar.get_Message().Content = message;
- this.Snackbar.set_IsActive(active);
- if (!active)
- {
- return;
- }
- Task.Factory.StartNew(new Action(this.CloseSlackBar));
- }
- }
-}
\ No newline at end of file |