Автор работы: Пользователь скрыл имя, 29 Января 2013 в 17:29, курсовая работа
Целью курсовой работы является автоматизация рассылки SMS сообщений, для ускорения и облегчения работы по оповещению студентов.
Задачей, для достижения данной цели является создание приложения SmsMessenger, которое будет производить автоматизацию рассылки SMS.
Введение 2
1. Описание предметной области 3
1.1. Предметная область курсового проекта 3
1.2. Информационно-логическая модель предметной области 3
2. Создание приложения SmsMessenger 6
2.1. Логическое проектирование 6
2.2. Модель данных 7
2.3. Описание представлений и представителей 8
3. Тестирование программы 17
Заключение 25
Список литературы 26
Пиложение А. Задание на курсовой проект 27
Приложение Б. Структура исходных файлов 28
Приложение В. XAML код всех представлений и библиотек ресурсов 30
Приложение Г. Код классов программы. 62
return true;
else
return false;
}
public void SetPeriod(DateTime? begin, DateTime? end)
{
BeginDate = begin;
EndDate = end;
}
}
}
PresenterBase.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SmsMessanger.Presenters
{
public class PresenterBase<T> : Notifer
{
private readonly T _view;
private string _tabHeaderPath;
public PresenterBase(T view)
{
_view = view;
}
public PresenterBase(T view, string tabHeaderPath)
{
_view = view;
_tabHeaderPath = tabHeaderPath;
}
public T View
{
get { return _view; }
}
public string TabHeaderPath
{
get { return _tabHeaderPath; }
}
}
}
SendSmsByListPresenter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmsMessanger.Views;
using SmsMessanger.Model;
using Microsoft.Win32;
using System.IO;
using System.Windows.Data;
using System.Windows;
using SmsMessanger.Model.ViewModels;
namespace SmsMessanger.Presenters
{
public class SendSmsByListPresenter : PresenterBase<SendSmsByListVie
{
private readonly Contact _contact;
private readonly ApplicationPresenter _applicationPresenter;
private readonly List<SmsTemplateGroup> _avalableSmsTemplates;
private SmsTemplate _selectedTemplate;
private DistributionList _distributionList;
public string MessageText { get; set; }
private VMDistributionTreeEdit _model;
public VMDistributionTreeEdit Model
{
get { return _model; }
set
{
_model = value;
OnPropertyChanged("Model");
}
}
public SendSmsByListPresenter(Applica
List<SmsTemplateGroup> avalableSmsTemplates, SmsTemplate template)
: base(view, "TabHeader")
{
_applicationPresenter = applicationPresenter;
_avalableSmsTemplates = avalableSmsTemplates;
DistributionList = distributionList;
Model = new VMDistributionTreeEdit();
Model.SetupGroups(
Model.CheckedAll();
if (template != null)
MessageText = template.Text;
}
public List<SmsTemplateGroup> AvalableSmsTemplates
{
get { return _avalableSmsTemplates; }
}
public string TabHeader
{
get { return string.Format("Отправка SMS по списку {0}",DistributionList.Title); }
}
public SmsTemplate SelectedTemplate
{
get
{
return _selectedTemplate;
}
set
{
_selectedTemplate = value;
OnPropertyChanged("
}
}
public DistributionList DistributionList
{
get
{
return _distributionList;
}
set
{
_distributionList = value;
OnPropertyChanged("
}
}
public void SendSmsList()
{
List<Guid> selectedContacts = new List<Guid>();
foreach (var ContactsGroup in Model.Groups)
foreach (var contact in ContactsGroup.Contacts)
selectedContacts.Add(contact.
List<Contact> contacts = _applicationPresenter.
_applicationPresenter.
}
public void Cancel()
{
_applicationPresenter.
}
public void SaveSmsTemplate(string title, string text, SmsTemplateGroup group)
{
SmsTemplate template = new SmsTemplate { Text = text, Title = title, ParentGroup = group };
_applicationPresenter.
}
public override bool Equals(object obj)
{
SendSmsByListPresenter presenter = obj as SendSmsByListPresenter;
return presenter != null && presenter.DistributionList.
}
}
}
SmsSendReportPresenter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmsMessanger.Views;
using SmsMessanger.Model;
namespace SmsMessanger.Presenters
{
public class SmsSendReportPresenter:Present
{
private SmsSendReportView View { get; set; }
private ApplicationPresenter ApplicationPresenter { get; set; }
private readonly SendSmsReport _report;
public string HeaderText { get { return "Отчет"; } }
public SendSmsReport Report { get { return _report; } }
public SmsSendReportPresenter(Applica
:base(view,"HeaderText")
{
View = view;
ApplicationPresenter = appPresenter;
_report = report;
}
}
}
DistributionTreeBar.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using SmsMessanger.Presenters;
using SmsMessanger.Model;
namespace SmsMessanger.UserControls
{
/// <summary>
/// Interaction logic for SmsTemplateBar.xaml
/// </summary>
public partial class DistributionTreeBar : UserControl
{
public DistributionTreeBar()
{
InitializeComponent();
}
private ApplicationPresenter Presenter { get { return DataContext as ApplicationPresenter; } }
private void EditContactButtonClick(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button != null)
Presenter.OpenContact(button.
}
private void EditDistributionButtin_click(o
{
Button button = sender as Button;
if (button!=null)
Presenter.
}
private void AddDistributionList_click(obje
{
Presenter.
}
private void SendSmsButton_click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button != null)
Presenter.
}
private void distributionList_drop(object sender, DragEventArgs e)
{
string[] formats = e.Data.GetFormats();
if (formats.Contains("
{
Presenter.
e.Data.GetData("SmsTemplate") as SmsTemplate);
}
}
private void dropToStudent(object sender, DragEventArgs e)
{
string[] formats = e.Data.GetFormats();
if (formats.Contains("
{
Presenter.SendSmsByContact((
e.Data.GetData("SmsTemplate") as SmsTemplate);
}
}
private void deleteDistributionListButton_
{
if (MessageBox.Show("Вы уверены, что хотите удалить список рассылки", "Удаление списка рассылки", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
return;
Button button = sender as Button;
if (button!=null)
Presenter.
}
}
}
Menu.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using SmsMessanger.Presenters;
namespace SmsMessanger.UserControls
{
/// <summary>
/// Interaction logic for Menu.xaml
/// </summary>
public partial class Menu : UserControl
{
private bool _isHelpShowing;
public Menu()
{
_isHelpShowing = false;
InitializeComponent();
}
private ApplicationPresenter Presenter { get { return DataContext as ApplicationPresenter; } }
private void OpenLog_click(object sender, RoutedEventArgs e)
{
Presenter.OpenLog();
}
private void ShowHelp_click(object sender, RoutedEventArgs e)
{
ShowHelp();
}
public void ShowHelp()
{
if (!_isHelpShowing)
{
_isHelpShowing = true;
Help helpwindow = new Help();
helpwindow.Show();
helpwindow.Closed += (s, arg) =>
{
_isHelpShowing = false;
};
}
}
private void OpenSettings_click(object sender, RoutedEventArgs e)
{
Presenter.OpenSettings();
}
private void exitMenuClick(object sender, RoutedEventArgs e)
{
Presenter.CloseApp();
}
}
}
SideBar.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using SmsMessanger.Presenters;
using SmsMessanger.Model;
using System.Windows.Controls.
namespace SmsMessanger.UserControls
{
/// <summary>
/// Interaction logic for SideBar.xaml
/// </summary>
public partial class SideBar : UserControl
{
public SideBar()
{
InitializeComponent();
}
private ApplicationPresenter Presenter { get { return DataContext as ApplicationPresenter; } }
private void newContactButton_Click(object sender, RoutedEventArgs e)
{
Presenter.OpenContact(new Model.Contact());
}
private void editContactButton_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button != null)
Presenter.OpenContact(button.
}
private void deleteContactButton_click(obje
{
if (MessageBox.Show("Уверены?", "Удаление контакта", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
return;
Button button = sender as Button;
if (button != null)
Presenter.DeleteContact(
}
private void newGroupButton_Click(object sender, RoutedEventArgs e)
{
Presenter.OpenGroup(new Group() { Title = "Новая группа" });
}
private void editGroupButton_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button != null)
Presenter.OpenGroup(button.
}
private void TooGleUsersButton_checked(obje
{
ToggleButton button = sender as ToggleButton;
if (button != null)
Presenter.AddCheckedGroup(
}
private void TooGleUsersButton_unChecked(ob
{
ToggleButton button = sender as ToggleButton;
if (button != null)
Presenter.RemoveCheckedGroup(
}
private void deleteGroupButton_click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show("Уверены?", "Удаление группы", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
return;
Button button = sender as Button;
if (button != null)
Presenter.DeleteGroup(button.
}
private void addUserToGroupButton_Click(obj
{
Button button = sender as Button;
if (button != null)
{
Group group = (button.DataContext as Group);
Presenter.OpenContact(new Model.Contact() { Group = group });
}
}
private void sendSmsToContact_button(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button!=null)
Presenter.SendSmsByContact(
}
private void dropToStudent(object sender, DragEventArgs e)
{
string[] formats = e.Data.GetFormats();
if (formats.Contains("
{
Presenter.SendSmsByContact((
e.Data.GetData("SmsTemplate") as SmsTemplate);
}
}
}
}
SmsTemplateBar.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using SmsMessanger.Presenters;
using SmsMessanger.Model;
namespace SmsMessanger.UserControls
{
/// <summary>
/// Interaction logic for SmsTemplateBar.xaml
/// </summary>
public partial class SmsTemplateBar : UserControl
{
public bool MousePressedOnTreeItem = false;
Point lastMouseDown;
public SmsTemplateBar()
{
InitializeComponent();
}
private ApplicationPresenter Presenter { get { return DataContext as ApplicationPresenter; } }
private void editSmsTemplateButton_click(ob
{
Button button = sender as Button;
if (button != null)
Presenter.OpenSmsTemplate(
}
private void DeleteSmsTemplateButton_click(
{
if (MessageBox.Show("Уверены?", "Удаление шаблона SMS", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
return;
Button button = sender as Button;
if (button != null)
Presenter.DeleteSmsTemplate(
}
private void AddSmsTemplateButton_click(obj
{
Button button = sender as Button;
if (button != null)
Presenter.OpenSmsTemplate(new SmsTemplate() { ParentGroup = button.DataContext as SmsTemplateGroup, Title="Новый шаблон"});
}
private void smsTemplate_mouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
lastMouseDown = e.GetPosition(sender as Border);
}
private void smsTemplate_mouseMove(object sender, MouseEventArgs e)
{
Информация о работе Разработка системы рассылки СМС сообщений