From 9769186d4a92c3752b1205750d447821b86b8b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=9E=D1=80=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= <3841832@gmail.com> Date: Wed, 26 Dec 2018 12:45:28 +0300 Subject: [PATCH 01/28] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MailSender/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MailSender/MainWindow.xaml.cs b/MailSender/MainWindow.xaml.cs index 64cbf30..dd3b6cc 100644 --- a/MailSender/MainWindow.xaml.cs +++ b/MailSender/MainWindow.xaml.cs @@ -45,7 +45,7 @@ private void Button_Click(object sender, RoutedEventArgs e) { sc.Send(mm); } - catch (Exception ex) { new SendEndWindow($"{email_addr}: {ex.Message}").Show(); } + catch (Exception ex) { new SendEndWindow($"{email_addr}: {ex.Message}").Show(); }// } } } From 84c9ae63f1c2f863094f1d18a37594902f52efca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=9E=D1=80=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= <3841832@gmail.com> Date: Thu, 27 Dec 2018 18:41:22 +0300 Subject: [PATCH 02/28] =?UTF-8?q?=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D1=8B?= =?UTF-8?q?=D0=B2=D0=B0=D1=8E=20=D0=BF=D0=BE=20=D0=B0=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D1=83=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MailSender.sln | 6 + MailSender/App.config | 5 + MailSender/App.xaml | 2 +- MailSender/MailSender.csproj | 7 + MailSender/MainWindow.xaml | 139 ++++++++++--- MailSender/MainWindow.xaml.cs | 38 ++-- MailSender/packages.config | 4 + SpamTools.lib/Data/MailServer.cs | 24 +++ SpamTools.lib/Data/MailServers.cs | 18 ++ SpamTools.lib/Data/Sender.cs | 15 ++ SpamTools.lib/Data/Senders.cs | 18 ++ SpamTools.lib/Database/MailDatabase.dbml | 10 + .../Database/MailDatabase.dbml.layout | 12 ++ .../Database/MailDatabase.designer.cs | 187 ++++++++++++++++++ SpamTools.lib/DatabaseService.cs | 12 ++ SpamTools.lib/MainSenderService.cs | 12 ++ SpamTools.lib/Properties/AssemblyInfo.cs | 36 ++++ SpamTools.lib/Properties/Settings.Designer.cs | 37 ++++ SpamTools.lib/Properties/Settings.settings | 14 ++ SpamTools.lib/Scheduler.cs | 12 ++ SpamTools.lib/Service/PasswordService.cs | 21 ++ SpamTools.lib/SpamTools.lib.csproj | 85 ++++++++ SpamTools.lib/app.config | 10 + 23 files changed, 680 insertions(+), 44 deletions(-) create mode 100644 MailSender/packages.config create mode 100644 SpamTools.lib/Data/MailServer.cs create mode 100644 SpamTools.lib/Data/MailServers.cs create mode 100644 SpamTools.lib/Data/Sender.cs create mode 100644 SpamTools.lib/Data/Senders.cs create mode 100644 SpamTools.lib/Database/MailDatabase.dbml create mode 100644 SpamTools.lib/Database/MailDatabase.dbml.layout create mode 100644 SpamTools.lib/Database/MailDatabase.designer.cs create mode 100644 SpamTools.lib/DatabaseService.cs create mode 100644 SpamTools.lib/MainSenderService.cs create mode 100644 SpamTools.lib/Properties/AssemblyInfo.cs create mode 100644 SpamTools.lib/Properties/Settings.Designer.cs create mode 100644 SpamTools.lib/Properties/Settings.settings create mode 100644 SpamTools.lib/Scheduler.cs create mode 100644 SpamTools.lib/Service/PasswordService.cs create mode 100644 SpamTools.lib/SpamTools.lib.csproj create mode 100644 SpamTools.lib/app.config diff --git a/MailSender.sln b/MailSender.sln index 9da86fb..4a13726 100644 --- a/MailSender.sln +++ b/MailSender.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.28307.168 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MailSender", "MailSender\MailSender.csproj", "{F41CB514-4BD5-4D18-8411-7B0579F510F2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpamTools.lib", "SpamTools.lib\SpamTools.lib.csproj", "{772FEDB7-183B-40F1-89D1-4415997A0D1E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {F41CB514-4BD5-4D18-8411-7B0579F510F2}.Debug|Any CPU.Build.0 = Debug|Any CPU {F41CB514-4BD5-4D18-8411-7B0579F510F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {F41CB514-4BD5-4D18-8411-7B0579F510F2}.Release|Any CPU.Build.0 = Release|Any CPU + {772FEDB7-183B-40F1-89D1-4415997A0D1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {772FEDB7-183B-40F1-89D1-4415997A0D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {772FEDB7-183B-40F1-89D1-4415997A0D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {772FEDB7-183B-40F1-89D1-4415997A0D1E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MailSender/App.config b/MailSender/App.config index 731f6de..d5aba9a 100644 --- a/MailSender/App.config +++ b/MailSender/App.config @@ -3,4 +3,9 @@ + + + \ No newline at end of file diff --git a/MailSender/App.xaml b/MailSender/App.xaml index 2216690..df27af6 100644 --- a/MailSender/App.xaml +++ b/MailSender/App.xaml @@ -6,7 +6,7 @@ - + diff --git a/MailSender/MailSender.csproj b/MailSender/MailSender.csproj index 3a73bb3..c57837a 100644 --- a/MailSender/MailSender.csproj +++ b/MailSender/MailSender.csproj @@ -35,6 +35,12 @@ 4 + + ..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + + + ..\SpamTools.lib\bin\Debug\SpamTools.lib.dll + @@ -102,6 +108,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/MailSender/MainWindow.xaml b/MailSender/MainWindow.xaml index 568d53a..0aaa725 100644 --- a/MailSender/MainWindow.xaml +++ b/MailSender/MainWindow.xaml @@ -4,9 +4,13 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MailSender" + xmlns:data="clr-namespace:SpamTools.lib.Data;assembly=SpamTools.lib" + xmlns:db="clr-namespace:SpamTools.lib.Database;assembly=SpamTools.lib" + xmlns:fa="http://schemas.fontawesome.io/icons/" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> + @@ -17,32 +21,119 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - @@ -71,7 +71,7 @@ - + @@ -82,16 +82,27 @@ + + + + - + + + + + + - + @@ -117,7 +128,7 @@ - + + + + + + + + + diff --git a/MailSender/View/RecipientsView.xaml.cs b/MailSender/View/RecipientsView.xaml.cs new file mode 100644 index 0000000..1bc3b97 --- /dev/null +++ b/MailSender/View/RecipientsView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace MailSender.View +{ + /// + /// Логика взаимодействия для RecipientsView.xaml + /// + public partial class RecipientsView : UserControl + { + public RecipientsView() + { + InitializeComponent(); + } + } +} diff --git a/MailSender/ViewModel/MainWindowViewModel.cs b/MailSender/ViewModel/MainWindowViewModel.cs new file mode 100644 index 0000000..9358fd7 --- /dev/null +++ b/MailSender/ViewModel/MainWindowViewModel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using GalaSoft.MvvmLight; +using SpamTools.lib; +using SpamTools.lib.Database; + +namespace MailSender.ViewModel +{ + public class MainWindowViewModel: ViewModelBase + { + private readonly IDataService _DataService; + private string _Title = "Рассыльщик почты"; + public string Title + { + get => _Title; + set => Set(ref _Title, value); + } + + private string _Status = "Готов"; + public string Status + { + get => _Status; + set => Set(ref _Status, value); + } + + //public IEnumerable Recipients => _DataService.GetEmailRecipients(); + public MainWindowViewModel(IDataService DataService) + { + _DataService = DataService; + } + + public IEnumerable Recipients { get; } = new ObservableCollection(); + } +} diff --git a/MailSender/ViewModel/ViewModelLocator.cs b/MailSender/ViewModel/ViewModelLocator.cs index f2a5ac4..a715496 100644 --- a/MailSender/ViewModel/ViewModelLocator.cs +++ b/MailSender/ViewModel/ViewModelLocator.cs @@ -1,6 +1,9 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; +using SpamTools.lib; +using SpamTools.lib.Database; + //using Microsoft.Practices.ServiceLocation; namespace MailSender.ViewModel @@ -17,8 +20,10 @@ public class ViewModelLocator public ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); - + SimpleIoc.Default.Register(() => new MailDatabaseDataContext()); + SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); } public MainViewModel Main @@ -28,6 +33,8 @@ public MainViewModel Main return ServiceLocator.Current.GetInstance(); } } + + public MainWindowViewModel MainWindowModel => ServiceLocator.Current.GetInstance(); public static void Cleanup() { diff --git a/SpamTools.lib/DataServiceDB.cs b/SpamTools.lib/DataServiceDB.cs new file mode 100644 index 0000000..d7e59e6 --- /dev/null +++ b/SpamTools.lib/DataServiceDB.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SpamTools.lib.Database; + +namespace SpamTools.lib +{ + public class DataServiceDB: IDataService + { + private MailDatabaseDataContext _DataBaseContext; + + public DataServiceDB(MailDatabaseDataContext DataBaseContext) + { + _DataBaseContext = DataBaseContext; + } + + public IEnumerable GetEmailRecipients() + { + return new ObservableCollection(_DataBaseContext.EmailRecipients); + } + } +} diff --git a/SpamTools.lib/DatabaseService.cs b/SpamTools.lib/IDataService.cs similarity index 50% rename from SpamTools.lib/DatabaseService.cs rename to SpamTools.lib/IDataService.cs index f3d2a57..8ce867a 100644 --- a/SpamTools.lib/DatabaseService.cs +++ b/SpamTools.lib/IDataService.cs @@ -1,4 +1,5 @@ -using System; +using SpamTools.lib.Database; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,8 @@ namespace SpamTools.lib { - public class DatabaseService + public interface IDataService { + IEnumerable GetEmailRecipients(); } } diff --git a/SpamTools.lib/MVVM/LambdaCommand.cs b/SpamTools.lib/MVVM/LambdaCommand.cs new file mode 100644 index 0000000..959462f --- /dev/null +++ b/SpamTools.lib/MVVM/LambdaCommand.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace SpamTools.lib.MVVM +{ + public class LambdaCommand : ICommand + { + public event EventHandler CanExecuteChanged; + + public bool CanExecute(object parameter) + { + throw new NotImplementedException(); + } + + public void Execute(object parameter) + { + throw new NotImplementedException(); + } + } +} diff --git a/SpamTools.lib/SpamTools.lib.csproj b/SpamTools.lib/SpamTools.lib.csproj index 0ba6e08..a89d674 100644 --- a/SpamTools.lib/SpamTools.lib.csproj +++ b/SpamTools.lib/SpamTools.lib.csproj @@ -42,7 +42,7 @@ - + True True @@ -52,7 +52,9 @@ + + From 66c47566debde5e01b7e08e22dcf50d14d38f32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=9E=D1=80=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= <3841832@gmail.com> Date: Sat, 5 Jan 2019 13:44:20 +0300 Subject: [PATCH 10/28] =?UTF-8?q?=D0=92=D1=81=D1=91=20=D1=87=D1=82=D0=BE?= =?UTF-8?q?=20=D0=B1=D1=8B=D0=BB=D0=BE=20=D0=BD=D0=B0=20=D1=83=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MailSender/MailSender.csproj | 7 +++ MailSender/MainWindow.xaml | 21 +++----- MailSender/View/RecipientsEditorView.xaml | 25 +++++++++ MailSender/View/RecipientsEditorView.xaml.cs | 28 ++++++++++ MailSender/View/RecipientsView.xaml | 11 +++- MailSender/ViewModel/MainWindowViewModel.cs | 57 +++++++++++++++++++- SpamTools.lib/DataServiceDB.cs | 14 +++++ SpamTools.lib/IDataService.cs | 3 ++ SpamTools.lib/MVVM/LambdaCommand.cs | 18 +++++-- SpamTools.lib/SpamTools.lib.csproj | 1 + 10 files changed, 165 insertions(+), 20 deletions(-) create mode 100644 MailSender/View/RecipientsEditorView.xaml create mode 100644 MailSender/View/RecipientsEditorView.xaml.cs diff --git a/MailSender/MailSender.csproj b/MailSender/MailSender.csproj index f25ea63..d5eb460 100644 --- a/MailSender/MailSender.csproj +++ b/MailSender/MailSender.csproj @@ -90,6 +90,9 @@ + + RecipientsEditorView.xaml + RecipientsView.xaml @@ -114,6 +117,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/MailSender/MainWindow.xaml b/MailSender/MainWindow.xaml index b17486b..6ca5ba9 100644 --- a/MailSender/MainWindow.xaml +++ b/MailSender/MainWindow.xaml @@ -93,20 +93,13 @@ - - - - - + + + + + + + diff --git a/MailSender/View/RecipientsEditorView.xaml b/MailSender/View/RecipientsEditorView.xaml new file mode 100644 index 0000000..311d229 --- /dev/null +++ b/MailSender/View/RecipientsEditorView.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + +