Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9769186
Работает
Wintego Dec 26, 2018
84c9ae6
доделываю по аналогии из урока
Wintego Dec 27, 2018
a721a9b
1
Wintego Dec 28, 2018
9d27d0f
Сделал всё, осталась проблема с биндингом
Wintego Dec 28, 2018
1f63d87
Разобрался с DataContext
Wintego Jan 4, 2019
23f18fb
Из предыдущего урока
Wintego Jan 4, 2019
240eeca
1
Wintego Jan 4, 2019
fea9f19
Добавлен MVVM Light
Wintego Jan 4, 2019
6cab006
Доделываю по уроку
Wintego Jan 4, 2019
66c4756
Всё что было на уроке
Wintego Jan 5, 2019
7a5878d
Реализована возможность поиска получателей писем по имени (дз из мето…
Wintego Jan 6, 2019
450ba51
добавил дз из сайта
Wintego Jan 7, 2019
c47e990
2 задании по аналогии с уроком
Wintego Jan 12, 2019
6eb13ee
фунция добавления задания
Wintego Jan 12, 2019
3f76ea2
новая форма
Wintego Jan 12, 2019
ac8d896
CheckComboBox
Wintego Jan 12, 2019
29a2d6a
Работа с расписанием (не окончена)
Wintego Jan 12, 2019
7124899
Свойства зависимости для отправителей
Wintego Jan 12, 2019
c7ec38c
свойства зависимости
Wintego Jan 13, 2019
290ebca
Доработан SendMail
Wintego Jan 13, 2019
0788584
1
Wintego Jan 14, 2019
cda67ee
sendparallel
Wintego Jan 14, 2019
34b041f
Добавлен Планировщик
Wintego Jan 14, 2019
7375eb3
2 задание
Wintego Jan 15, 2019
6e9cca9
что то сломалось
Wintego Jan 15, 2019
8a8b5ee
дз
Wintego Jan 16, 2019
3176569
Таски
Wintego Jan 17, 2019
0ee123e
2 задание
Wintego Jan 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions EmailSendService.lib/EmailSendService.lib.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1C081ED6-B778-44E9-B0D8-36FAAB09A87A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EmailSendService.lib</RootNamespace>
<AssemblyName>EmailSendService.lib</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SenderService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SpamTools.lib\SpamTools.lib.csproj">
<Project>{772FEDB7-183B-40F1-89D1-4415997A0D1E}</Project>
<Name>SpamTools.lib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
36 changes: 36 additions & 0 deletions EmailSendService.lib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("EmailSendService.lib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmailSendService.lib")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]

// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("1c081ed6-b778-44e9-b0d8-36faab09a87a")]

// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
83 changes: 83 additions & 0 deletions EmailSendService.lib/SenderService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using SpamTools.lib.Data;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SpamTools.lib.Database;

namespace EmailSendService.lib
{
public class SenderService
{
private string _ServerAdress;
private int _Port;
private bool _UseSSL;
private string _FromLogin;
private SecureString _FromPassword;
public string Subject { get; set; }

public SenderService(string ServerAdress, int Port, bool UseSSL, string FromLogin, SecureString FromPassword)
{
_ServerAdress = ServerAdress;
_Port = Port;
_UseSSL = UseSSL;
_FromLogin = FromLogin;
_FromPassword = FromPassword;
}

public void Send(string to, string subject, string body)
{
//string response = default(string);
using (var message = new MailMessage(_FromLogin, to))
{
message.Subject = subject;
message.Body = body;

using (var client = new SmtpClient(_ServerAdress, _Port))
{
client.EnableSsl = _UseSSL;
client.Credentials = new NetworkCredential(_FromLogin, _FromPassword);
try
{
client.Send(message);
//response = $"Письмо успешно отправлено на почту {to}";
}
catch (Exception ex)
{
//response = "Ошибка: "+ex.Message;
}
}
}
//return response;
}
/// <summary>
/// массовое отправление писем
/// </summary>
/// <param name="subject">тема письма</param>
/// <param name="body">тело письма</param>
/// <param name="recipients">получатели письма</param>
public void SendParallel(string subject, string body, IEnumerable<EmailRecipients> recipients)
{
foreach (var recipient in recipients)
{
var sending_thread = new Thread(() => Send(recipient.EmailAdress, subject, body));
sending_thread.IsBackground = true;
sending_thread.Start();
}
}
public void Send(string subject, string body, IEnumerable<EmailRecipients> recipients)
{
foreach (var recipient in recipients)
{
Task.Factory.StartNew(()=> Send(subject, body, recipient.EmailAdress));
}
}
}
}
41 changes: 41 additions & 0 deletions MailSender.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ 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
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmailSendService.lib", "EmailSendService.lib\EmailSendService.lib.csproj", "{1C081ED6-B778-44E9-B0D8-36FAAB09A87A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8BB062CE-B09C-4B1F-9E7B-612FA41317E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpamTools.lib.Tests", "SpamTools.lib.Tests\SpamTools.lib.Tests.csproj", "{F28BF459-9A95-4B66-AC0A-D50D9216108E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hw5", "hw5\hw5.csproj", "{7BE85544-8D56-4E23-8E2E-8C1939D21427}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hw6-1", "hw6\hw6-1.csproj", "{941649D3-FC29-44DC-914B-91C388ACB211}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hw6-2", "hw6-2\hw6-2.csproj", "{749183D2-F08B-4730-B6D3-D9F410ADE740}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,10 +29,37 @@ 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
{1C081ED6-B778-44E9-B0D8-36FAAB09A87A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C081ED6-B778-44E9-B0D8-36FAAB09A87A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C081ED6-B778-44E9-B0D8-36FAAB09A87A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C081ED6-B778-44E9-B0D8-36FAAB09A87A}.Release|Any CPU.Build.0 = Release|Any CPU
{F28BF459-9A95-4B66-AC0A-D50D9216108E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F28BF459-9A95-4B66-AC0A-D50D9216108E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F28BF459-9A95-4B66-AC0A-D50D9216108E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F28BF459-9A95-4B66-AC0A-D50D9216108E}.Release|Any CPU.Build.0 = Release|Any CPU
{7BE85544-8D56-4E23-8E2E-8C1939D21427}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BE85544-8D56-4E23-8E2E-8C1939D21427}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BE85544-8D56-4E23-8E2E-8C1939D21427}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BE85544-8D56-4E23-8E2E-8C1939D21427}.Release|Any CPU.Build.0 = Release|Any CPU
{941649D3-FC29-44DC-914B-91C388ACB211}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{941649D3-FC29-44DC-914B-91C388ACB211}.Debug|Any CPU.Build.0 = Debug|Any CPU
{941649D3-FC29-44DC-914B-91C388ACB211}.Release|Any CPU.ActiveCfg = Release|Any CPU
{941649D3-FC29-44DC-914B-91C388ACB211}.Release|Any CPU.Build.0 = Release|Any CPU
{749183D2-F08B-4730-B6D3-D9F410ADE740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{749183D2-F08B-4730-B6D3-D9F410ADE740}.Debug|Any CPU.Build.0 = Debug|Any CPU
{749183D2-F08B-4730-B6D3-D9F410ADE740}.Release|Any CPU.ActiveCfg = Release|Any CPU
{749183D2-F08B-4730-B6D3-D9F410ADE740}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F28BF459-9A95-4B66-AC0A-D50D9216108E} = {8BB062CE-B09C-4B1F-9E7B-612FA41317E0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F5A42F05-4853-4892-8AB8-28B2CD3F0A5E}
EndGlobalSection
Expand Down
13 changes: 12 additions & 1 deletion MailSender/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<connectionStrings>
<add name="SpamTools.lib.Properties.Settings.MailDBConnectionString" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MailDB;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
27 changes: 14 additions & 13 deletions MailSender/App.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Application x:Class="MailSender.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MailSender"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
<Application
x:Class="MailSender.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MailSender"
StartupUri="MainWindow.xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<Application.Resources>
<ResourceDictionary>
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:MailSender.ViewModel" />
</ResourceDictionary>
</Application.Resources>
</Application>
36 changes: 36 additions & 0 deletions MailSender/Controls/ListViewItemScheduler-custom.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<UserControl x:Class="MailSender.Controls.ListViewItemScheduler_custom"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MailSender.Controls"
xmlns:fa="http://schemas.fontawesome.io/icons/"
mc:Ignorable="d"
d:DesignHeight="64" d:DesignWidth="179"
DataContext="{Binding MainWindowModel, Source={StaticResource Locator}}">
<Grid Background="WhiteSmoke">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="159"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="0">
<TextBlock>
<TextBlock>Время: </TextBlock>
<TextBlock MaxWidth="118"></TextBlock>
</TextBlock>
<TextBlock Text="Кому: "/>
<TextBlock Text="Тема: "/>
<TextBlock Text="Текст: "/>
</StackPanel>

<StackPanel Grid.Column="1">
<Button>
<fa:ImageAwesome Icon="Pencil" Foreground="LightSalmon"/>
</Button>
<Button>
<fa:ImageAwesome Icon="MinusCircle" Foreground="LightCoral"/>
</Button>
</StackPanel>
</Grid>
</UserControl>
28 changes: 28 additions & 0 deletions MailSender/Controls/ListViewItemScheduler-custom.xaml.cs
Original file line number Diff line number Diff line change
@@ -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.Controls
{
/// <summary>
/// Логика взаимодействия для ListViewItemScheduler_custom.xaml
/// </summary>
public partial class ListViewItemScheduler_custom : UserControl
{
public ListViewItemScheduler_custom()
{
InitializeComponent();
}
}
}
19 changes: 19 additions & 0 deletions MailSender/Controls/ListViewItemScheduler.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<UserControl x:Class="MailSender.Controls.ListViewItemScheduler"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MailSender.Controls"
xmlns:fa="http://schemas.fontawesome.io/icons/"
mc:Ignorable="d"
d:DesignHeight="20" d:DesignWidth="179">
<StackPanel Orientation="Horizontal">
<Button Width="20">
<fa:ImageAwesome Icon="Pencil" Foreground="LightSalmon"/>
</Button>
<TextBox Width="139"></TextBox>
<Button>
<fa:ImageAwesome Icon="MinusCircle" Foreground="LightCoral"/>
</Button>
</StackPanel>
</UserControl>
28 changes: 28 additions & 0 deletions MailSender/Controls/ListViewItemScheduler.xaml.cs
Original file line number Diff line number Diff line change
@@ -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.Controls
{
/// <summary>
/// Логика взаимодействия для ListViewItemScheduler.xaml
/// </summary>
public partial class ListViewItemScheduler : UserControl
{
public ListViewItemScheduler()
{
InitializeComponent();
}
}
}
Loading