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 --- .../Drawers/InclusaoArquivoDigitalDrawer.cs | 186 +++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 Codemerx/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs (limited to 'Codemerx/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs') diff --git a/Codemerx/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs b/Codemerx/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs new file mode 100644 index 0000000..e8013e2 --- /dev/null +++ b/Codemerx/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs @@ -0,0 +1,186 @@ +using Gestor.Application; +using Gestor.Application.ViewModels.Drawer; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +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; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Drawers +{ + public class InclusaoArquivoDigitalDrawer : UserControl, IComponentConnector, IStyleConnector + { + internal System.Windows.Controls.ProgressBar ProgressBar; + + internal Snackbar SnackbarArquivoDigital; + + private bool _contentLoaded; + + public TarefaDrawerViewModel ViewModel + { + get; + set; + } + + public InclusaoArquivoDigitalDrawer(TarefaDrawerViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + this.ViewModel.RegistrarAcao("ACESSOU ANEXO ARQUIVO DIGITAL", (long)0, new TipoTela?(6), null); + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Anexar(); + } + + private void CloseSlackBar() + { + Thread.Sleep(5000); + System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.Toggle("", false))); + } + + private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) + { + Chip chip = sender as Chip; + if (chip == null) + { + return; + } + ListBox listBox = Extentions.FindVisualAncestor(chip); + ArquivoDigital item = (ArquivoDigital)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; + if (item == null) + { + return; + } + this.ViewModel.Delete(item); + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.CloseDrawer(); + } + + [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/drawers/inclusaoarquivodigitaldrawer.xaml", UriKind.Relative)); + } + + private void LimparLista_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.LimparAnexos(); + } + + private void SalvarAnexos_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.SalvarAnexos(); + this.ViewModel.CloseDrawer(); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.SnackbarArquivoDigital.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: + { + ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); + return; + } + case 3: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.AnexarArquivos_OnClick); + return; + } + case 4: + { + this._contentLoaded = true; + return; + } + case 5: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarAnexos_OnClick); + return; + } + case 6: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.LimparLista_OnClick); + return; + } + case 7: + { + this.SnackbarArquivoDigital = (Snackbar)target; + return; + } + case 8: + { + ((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) + { + ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.DeleteArquivo_OnDeleteClick)); + } + } + + public void Toggle(string message, bool active = true) + { + this.SnackbarArquivoDigital.get_Message().Content = message; + this.SnackbarArquivoDigital.set_IsActive(active); + if (!active) + { + return; + } + Task.Factory.StartNew(new Action(this.CloseSlackBar)); + } + } +} \ No newline at end of file -- cgit v1.2.3