diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs | 308 |
1 files changed, 308 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs new file mode 100644 index 0000000..ca1fce5 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs @@ -0,0 +1,308 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Ferramentas; + +public class MalaDiretaView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal MalaDiretaViewModel ViewModel; + + internal DataGrid Grid; + + internal TextBox AssuntoBox; + + internal WebEditor WebEditor; + + private bool _contentLoaded; + + public MalaDiretaView(List<MalaDireta> maladireta, string assunto = null, string corpo = null, FiltroArquivoDigital filtro = null) + { + ViewModel = new MalaDiretaViewModel(filtro); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + CarregarClientes(maladireta, assunto, corpo); + } + + private async void CarregarClientes(List<MalaDireta> maladireta, string assunto = null, string corpo = null) + { + ViewModel.IsEnabled = false; + await ViewModel.CarregarEmails(maladireta, assunto, corpo); + ViewModel.IsEnabled = true; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + + private async void Enviar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsEnabled = false; + ViewModel.Corpo = WebEditor.GetHtml(); + await ViewModel.Enviar(); + ViewModel.IsEnabled = true; + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(); + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Anexar(); + } + + private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.Delete(val3); + } + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ((UIElement)AssuntoBox).Focus(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Corpo = WebEditor.GetHtml(); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void VariaveisBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + VariaveisMalaDireta variaveisMalaDireta = ((ComboVariavel)((Selector)val).SelectedItem).VariaveisMalaDireta; + WebEditor.InsertText(ValidationHelper.GetEntity((Enum)(object)variaveisMalaDireta) + " "); + ((Selector)val).SelectedItem = null; + } + } + + private void ModelosBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ModeloMalaDireta modeloMalaDireta = ((ComboModelo)((Selector)val).SelectedItem).ModeloMalaDireta; + if (((DomainBase)modeloMalaDireta).Id != 0L) + { + ViewModel.Corpo = modeloMalaDireta.Corpo; + ViewModel.Assunto = modeloMalaDireta.Assunto; + } + } + } + + private async void AdicionarCC_OnClick(object sender, RoutedEventArgs e) + { + Button box = (Button)sender; + if (((FrameworkElement)box).DataContext != null) + { + ((UIElement)WebEditor).Visibility = (Visibility)2; + Copia val = await ViewModel.ShowCopiaDialog(((MalaDireta)((FrameworkElement)box).DataContext).Copia); + ((UIElement)WebEditor).Visibility = (Visibility)0; + if (val != null) + { + ((MalaDireta)((FrameworkElement)box).DataContext).Copia = val; + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/maladiretaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Expected O, but got Unknown + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00ec: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_00f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0133: Expected O, but got Unknown + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Expected O, but got Unknown + //IL_014d: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Grid = (DataGrid)target; + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 9: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(ModelosBox_SelectionChanged); + break; + case 10: + AssuntoBox = (TextBox)target; + break; + case 11: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(VariaveisBox_SelectionChanged); + break; + case 13: + WebEditor = (WebEditor)target; + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(Enviar_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + switch (connectionId) + { + case 2: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarCC_OnClick); + break; + case 12: + ((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick); + break; + } + } +} |