summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs
blob: 4c2f5f8af6c713892c44f4d3477772ddbd2e7d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Markup;
using Gestor.Application.ViewModels.Generic;
using MaterialDesignThemes.Wpf;
using Newtonsoft.Json.Linq;

namespace Gestor.Application.Componentes;

public class DialogAdvertising : UserControl, IComponentConnector
{
	private DialogAdvertisingViewModel ViewModel;

	private readonly bool _isPromocao;

	internal Label Titulo;

	private bool _contentLoaded;

	public DialogAdvertising(JObject jsonAd, bool isPromo = true)
	{
		ViewModel = new DialogAdvertisingViewModel(jsonAd, isPromo);
		((FrameworkElement)this).DataContext = ViewModel;
		InitializeComponent();
	}

	private void LinkImage_MouseDown(object sender, MouseButtonEventArgs e)
	{
		try
		{
			if (!_isPromocao)
			{
				ViewModel.EnviarPesquisa();
			}
			Process.Start(ViewModel.Url);
		}
		catch
		{
		}
	}

	private void Lido_OnClick(object sender, RoutedEventArgs e)
	{
		ViewModel.SalvaEditarArquivoConfig(visto: true);
		DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null);
	}

	private void CloseOnClick(object sender, RoutedEventArgs e)
	{
		DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null);
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	public void InitializeComponent()
	{
		if (!_contentLoaded)
		{
			_contentLoaded = true;
			Uri uri = new Uri("/Gestor.Application;component/componentes/dialogadvertising.xaml", UriKind.Relative);
			Application.LoadComponent((object)this, uri);
		}
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	[EditorBrowsable(EditorBrowsableState.Never)]
	void IComponentConnector.Connect(int connectionId, object target)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Expected O, but got Unknown
		switch (connectionId)
		{
		case 1:
			Titulo = (Label)target;
			break;
		case 2:
			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseOnClick);
			break;
		case 3:
			((UIElement)(Image)target).MouseDown += new MouseButtonEventHandler(LinkImage_MouseDown);
			break;
		case 4:
			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Lido_OnClick);
			break;
		default:
			_contentLoaded = true;
			break;
		}
	}
}