From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- Gestor.Application/Componentes/DialogTarefa.cs | 391 ------------------------- 1 file changed, 391 deletions(-) delete mode 100644 Gestor.Application/Componentes/DialogTarefa.cs (limited to 'Gestor.Application/Componentes/DialogTarefa.cs') diff --git a/Gestor.Application/Componentes/DialogTarefa.cs b/Gestor.Application/Componentes/DialogTarefa.cs deleted file mode 100644 index a9dc309..0000000 --- a/Gestor.Application/Componentes/DialogTarefa.cs +++ /dev/null @@ -1,391 +0,0 @@ -using Gestor.Application; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -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.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; -using Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Componentes -{ - public class DialogTarefa : UserControl, IComponentConnector, IStyleConnector - { - internal Button ClienteButton; - - internal Button ApoliceButton; - - internal Button SinistroButton; - - internal TextBox TituloBox; - - internal DatePicker AgendamentoBox; - - internal RadioButton AnotacoesButton; - - internal TextBox AnotacoesBox; - - internal ComboBox ResponsavelBox; - - internal DatePicker ConclusaoBox; - - internal MenuItem SalvarButton; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - private DialogTarefaViewModel ViewModel - { - get; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public DialogTarefa(Tarefa tarefa, List telefones, bool nota = false, bool agendamento = false) - { - this.ViewModel = new DialogTarefaViewModel(tarefa, telefones, nota, agendamento); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) - { - Documento documento; - documento = (this.ViewModel.Tarefa.get_Entidade() != 3 ? await this.ViewModel.CarregaApolice(this.ViewModel.Tarefa.get_IdEntidade()) : await this.ViewModel.CarregaApoliceParcela(this.ViewModel.Tarefa.get_IdEntidade())); - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new ApoliceView(documento, true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", this.ViewModel.Tarefa.get_Cliente()), nullable1, nullable, false)).Show(); - } - - private async void AcessarCliente_OnClick(object sender, RoutedEventArgs e) - { - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new ClienteView(await this.ViewModel.CarregaCliente(this.ViewModel.Tarefa.get_IdCliente()), true, null), string.Concat("CADASTRO DE CLIENTE - ", this.ViewModel.Tarefa.get_Cliente()), nullable1, nullable, false)).Show(); - } - - private async void AcessarSinistro_OnClick(object sender, RoutedEventArgs e) - { - Sinistro sinistro = await this.ViewModel.CarregaSinistroApolice(this.ViewModel.Tarefa.get_IdEntidade()); - double? nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new SinistroView(sinistro.get_ControleSinistro().get_Item(), false), string.Concat("CADASTRO DE SINISTRO - ", sinistro.get_ControleSinistro().get_Item().get_Descricao()), nullable1, nullable, false)).Show(); - } - - private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AdcionarResponsavel(); - } - - private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) - { - this.ViewModel.IsAnotacoes = true; - } - - private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) - { - this.ViewModel.IsAnotacoes = false; - } - - private void CloseSlackBar() - { - Thread.Sleep(3000); - System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private void ContentLoad() - { - this.AgendamentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.AgendamentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.ViewModel.PermissaoWhatsapp = this.ViewModel.Restricao(32); - switch (this.ViewModel.Tarefa.get_Entidade()) - { - case 0: - { - this.ClienteButton.Visibility = System.Windows.Visibility.Visible; - this.ApoliceButton.Visibility = System.Windows.Visibility.Visible; - break; - } - case 2: - { - this.ClienteButton.Visibility = System.Windows.Visibility.Visible; - break; - } - case 3: - { - this.ClienteButton.Visibility = System.Windows.Visibility.Visible; - this.ApoliceButton.Visibility = System.Windows.Visibility.Visible; - break; - } - case 4: - { - this.ClienteButton.Visibility = System.Windows.Visibility.Visible; - this.SinistroButton.Visibility = System.Windows.Visibility.Visible; - break; - } - default: - { - this.ClienteButton.Visibility = System.Windows.Visibility.Collapsed; - this.ApoliceButton.Visibility = System.Windows.Visibility.Collapsed; - break; - } - } - this.AnotacoesButton.IsChecked = new bool?(this.ViewModel.IsAnotacoes); - this.AnotacoesButton.Checked += new RoutedEventHandler(this.Anotacoes_OnChecked); - } - - private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) - { - TelefoneBase dataContext = (TelefoneBase)((Button)sender).DataContext; - string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).CopyToClipboard(); - this.ToggleSnackBar("NÚMERO COPIADO COM SUCESSO", true); - } - - private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) - { - ((DatePicker)sender).SelectedDate = new DateTime?(Funcoes.GetNetworkTime().Date); - } - - private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) - { - DatePicker datePicker = (DatePicker)sender; - datePicker.Text = ValidationHelper.FormatDate(datePicker.Text); - } - - private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) - { - if (e.Key != Key.Return) - { - return; - } - DatePicker str = (DatePicker)sender; - DateTime date = Funcoes.GetNetworkTime().Date; - str.Text = date.ToString("dd/MM/yyyy"); - } - - private void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e) - { - Chip chip = sender as Chip; - if (chip == null) - { - return; - } - ListBox listBox = Extentions.FindVisualAncestor(chip); - Usuario item = (Usuario)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; - if (item == null) - { - return; - } - this.ViewModel.RemoverResponsavel(item); - } - - [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/componentes/dialogtarefa.xaml", UriKind.Relative)); - } - - private void MenuItem_OnClick(object sender, RoutedEventArgs e) - { - if (this.ViewModel.Tarefa.get_UsuariosVinculados() == null) - { - this.ViewModel.Tarefa.set_UsuariosVinculados(new List()); - } - DialogHost.CloseDialogCommand.Execute(this.ViewModel.Tarefa, this.SalvarButton); - } - - 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.ClienteButton = (Button)target; - this.ClienteButton.Click += new RoutedEventHandler(this.AcessarCliente_OnClick); - return; - } - case 2: - { - this.ApoliceButton = (Button)target; - this.ApoliceButton.Click += new RoutedEventHandler(this.AcessarApolice_OnClick); - return; - } - case 3: - { - this.SinistroButton = (Button)target; - this.SinistroButton.Click += new RoutedEventHandler(this.AcessarSinistro_OnClick); - return; - } - case 4: - case 5: - case 12: - { - this._contentLoaded = true; - return; - } - case 6: - { - this.TituloBox = (TextBox)target; - return; - } - case 7: - { - this.AgendamentoBox = (DatePicker)target; - this.AgendamentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.AgendamentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - return; - } - case 8: - { - this.AnotacoesButton = (RadioButton)target; - return; - } - case 9: - { - this.AnotacoesBox = (TextBox)target; - return; - } - case 10: - { - this.ResponsavelBox = (ComboBox)target; - return; - } - case 11: - { - ((Button)target).Click += new RoutedEventHandler(this.AdicionarResponsavel_OnClick); - return; - } - case 13: - { - this.ConclusaoBox = (DatePicker)target; - this.ConclusaoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.ConclusaoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - return; - } - case 14: - { - this.SalvarButton = (MenuItem)target; - this.SalvarButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); - return; - } - case 15: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 16: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - default: - { - this._contentLoaded = true; - return; - } - } - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) - { - if (connectionId == 4) - { - ((Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); - return; - } - if (connectionId == 5) - { - ((Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); - return; - } - if (connectionId != 12) - { - return; - } - ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirResponsavel_OnClick)); - } - - private void TimePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) - { - TimePicker timePicker = (TimePicker)sender; - timePicker.TextBox.Text = ValidationHelper.FormatTime(timePicker.TextBox.Text); - } - - 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)); - } - - private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) - { - string str; - TelefoneBase dataContext = (TelefoneBase)((Button)sender).DataContext; - str = (!dataContext.get_Tipo().HasValue || dataContext.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", dataContext.get_Prefixo(), dataContext.get_Numero().Clear()) : string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).Clear()); - if (!str.EnviarWhatsapp(null)) - { - await this.ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS", "OK", "", false); - } - } - } -} \ No newline at end of file -- cgit v1.2.3