Автор работы: Пользователь скрыл имя, 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
{
if (!_checkedGroups.Contains(
{
_checkedGroups.Add(group);
ApplyFilters();
}
}
public void RemoveCheckedGroup(Group group)
{
if (_checkedGroups.Contains(
{
_checkedGroups.Remove(group);
ApplyFilters();
}
}
public void DeleteGroup(Group group)
{
_groupRepository.DeleteGroup(
if (CurrentGroups.Contains(group)
CurrentGroups.Remove(group);
}
#endregion
#region Работа с логом
public void OpenLog()
{
View.AddTab(
new LogPresenter(this,new LogView(),_logEventRepository.
);
}
#endregion
public void CloseTab<T>(PresenterBase<T> presenter)
{
View.RemoveTab(presenter);
}
public void CloseApp()
{
App.Current.Shutdown();
}
}
}
EditConfigPresenter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmsMessanger.Views;
using System.Windows;
namespace SmsMessanger.Presenters
{
public class EditConfigPresenter:PresenterB
{
private string _smscPassword;
private string _smscLogin;
private string _oldPassword;
private bool _combatMode;
public string SmscLogin
{
get { return _smscLogin;}
set
{
_smscLogin = value;
OnPropertyChanged("SmscLogin")
}
}
public string SmscPassword
{
get { return _smscPassword; }
set
{
_smscPassword = value;
OnPropertyChanged("
}
}
public bool CombatMode
{
get { return _combatMode; }
set
{
_combatMode = value;
OnPropertyChanged("CombatMode"
}
}
public string HeaderText { get { return "Настройки"; } }
private ApplicationPresenter _applicationPresenter;
private EditConfigView _view;
public EditConfigPresenter(Applicatio
{
_applicationPresenter = appPresenter;
_view = view;
//Загрузка текущих настроек
SmscLogin = Configurator.SmscLogin;
SmscPassword = Configurator.SmscPassword;
CombatMode = Configurator.CombatMode;
_view.passwordBox.Password = SmscPassword;
_oldPassword = string.Copy(_smscPassword);
}
public void SaveSettings()
{
SmscPassword = View.passwordBox.Password;
if (SmscPassword != _oldPassword)
if (MessageBox.Show("Сохранить изменения в пароле к SMSC?", "", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
SmscPassword = _oldPassword;
Configurator.SmscLogin = SmscLogin;
Configurator.SmscPassword = SmscPassword;
Configurator.CombatMode = CombatMode;
_applicationPresenter.
}
public override bool Equals(object obj)
{
if ((obj as EditConfigPresenter)!=null)
return true;
else
return false;
}
}
}
EditContactPresenter.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;
namespace SmsMessanger.Presenters
{
public class EditContactPresenter:Presenter
{
private readonly Contact _contact;
private readonly ApplicationPresenter _applicationPresenter;
private readonly List<Group> _avalableGroups;
public EditContactPresenter(Applicati
{
_applicationPresenter = applicationPresenter;
_contact = contact;
_avalableGroups = groups;
}
public Contact Contact
{
get { return _contact; }
}
public List<Group> AvalableGroups
{
get
{
return _avalableGroups;
}
}
public void SaveImage()
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Jpeg files|*.jpg|PNG files|*.png";
if (dlg.ShowDialog() == true)
{
string oldPhoto = Contact.Photo;
string PhotoDirectory = Path.Combine(AppDomain.
if(!Directory.Exists(
Directory.CreateDirectory(
string newShortName = Guid.NewGuid().ToString()+Path
string newFileName = Path.Combine("Photos",
if (!File.Exists(newFileName))
File.Copy(dlg.FileName,
Contact.Photo = newShortName;
}
}
public void SaveContact()
{
if (View.groupList.SelectedItem != null)
Contact.GroupId = (View.groupList.SelectedItem as Group).Id;
else
{
MessageBox.Show("Необходимо выбрать группу");
return;
}
Loger.Write(string.Format("
_applicationPresenter.
}
public override bool Equals(object obj)
{
EditContactPresenter presenter = obj as EditContactPresenter;
return presenter != null && presenter.Contact.Equals(
}
}
}
EditDistributionListPresenter.
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 EditDistributionListPresenter:
{
private readonly ApplicationPresenter _applicationPresenter;
private readonly DistributionList _distributionList;
private VMDistributionTreeEdit _viewModel;
public DistributionList DistributionList
{
get { return _distributionList; }
}
public VMDistributionTreeEdit ViewModel
{
get { return _viewModel; }
set
{
_viewModel = value;
OnPropertyChanged("ViewModel")
}
}
public EditDistributionListPresenter(
EditDistributionListView view,
DistributionList distributionList,
List<Group> groups)
: base(view, "DistributionList.Title")
{
_applicationPresenter = applicationPresenter;
ViewModel = new VMDistributionTreeEdit();
ViewModel.SetupGroups(groups);
_distributionList = distributionList;
//Получаем все id контактов списка
List<Guid> DistributionContacts = (from c in DistributionList.Contacts select c.Id).ToList();
//Устанавливаем чекед для каждого контакта модели если он в списке рассылки
foreach (var group in ViewModel.Groups)
foreach (var contact in group.Contacts)
if (DistributionContacts.
{
contact.IsChecked = true;
group.IsChecked = true;
}
}
public void SaveDistributionList()
{
if (_distributionList.Contacts != null)
{
_distributionList.ContactsId.
_distributionList.Contacts.
}
if(_distributionList.Groups!=n
_distributionList.Groups.
//Заполняем новые контакты
foreach (DistributionTreeGroup g in ViewModel.Groups)
foreach (var contact in g.Contacts)
if(contact.IsChecked)
DistributionList.ContactsId.
//Заполняем контакты по контактам
DistributionList.Contacts = _applicationPresenter.
DistributionList.Groups = DistributionList.
Loger.Write(string.Format("
_applicationPresenter.
}
public override bool Equals(object obj)
{
EditDistributionListPresenter presenter = obj as EditDistributionListPresenter;
return presenter != null && presenter.DistributionList.
}
}
}
EditGroupPresenter.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;
namespace SmsMessanger.Presenters
{
public class EditGroupPresenter:PresenterBa
{
private readonly Group _group;
private readonly ApplicationPresenter _applicationPresenter;
private readonly List<Group> _avalableGroups;
public EditGroupPresenter(Application
: base(view, "Group.Title")
{
_applicationPresenter = applicationPresenter;
_group = contact;
}
public Group Group
{
get { return _group; }
}
public void SaveGroup()
{
Loger.Write(string.Format("
_applicationPresenter.
}
public override bool Equals(object obj)
{
EditGroupPresenter presenter = obj as EditGroupPresenter;
return presenter != null && presenter.Group.Equals(Group);
}
}
}
EditSmsTemplateGroupPresenter.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmsMessanger.Views;
using SmsMessanger.Model;
namespace SmsMessanger.Presenters
{
class EditSmsTemplateGroupPresenter:
{
private SmsTemplateGroup _smsTemplateGroup;
private readonly ApplicationPresenter _appPresenter;
private readonly EditSmsTemplateGroupView _view;
public SmsTemplateGroup SmsTemplateGroup
{
get { return _smsTemplateGroup; }
set
{
_smsTemplateGroup = value;
OnPropertyChanged("
}
}
public ApplicationPresenter AppPresenter
{
get { return _appPresenter; }
}
public EditSmsTemplateGroupView View
{
get { return _view; }
}
public EditSmsTemplateGroupPresenter(
{
SmsTemplateGroup = smsTemplateGroup;
_appPresenter = appPresenter;
}
public void Save()
{
AppPresenter.
}
public override bool Equals(object obj)
{
EditSmsTemplateGroupPresenter other = obj as EditSmsTemplateGroupPresenter;
if (other == null) return false;
return other.SmsTemplateGroup == SmsTemplateGroup;
}
}
}
EditSmsTemplatePresenter.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;
namespace SmsMessanger.Presenters
{
public class EditSmsTemplatePresenter:Prese
{
private readonly SmsTemplate _smsTemplate;
private readonly ApplicationPresenter _applicationPresenter;
public EditSmsTemplatePresenter(Appli
: base(view, "SmsTemplate.Title")
{
_applicationPresenter = applicationPresenter;
_smsTemplate = smsTemplate;
}
public SmsTemplate SmsTemplate
{
get { return _smsTemplate; }
}
public void SaveSmsTemplate()
{
Loger.Write(string.Format("
_applicationPresenter.
}
public override bool Equals(object obj)
{
EditSmsTemplatePresenter presenter = obj as EditSmsTemplatePresenter;
return presenter != null && presenter.SmsTemplate.Equals(
}
}
}
LogPresenter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmsMessanger.Views;
using SmsMessanger.Model;
namespace SmsMessanger.Presenters
{
public class LogPresenter:PresenterBase<Log
{
private List<LogEvent> _logEvents;
private DateTime? _beginDate;
private DateTime? _endDate;
public DateTime? BeginDate
{
get
{
return _beginDate;
}
set
{
_beginDate = value;
OnPropertyChanged("BeginDate")
OnPropertyChanged("
}
}
public DateTime? EndDate
{
get
{
return _endDate;
}
set
{
_endDate = value;
OnPropertyChanged("EndDate");
OnPropertyChanged("
}
}
public List<LogEvent> CurrentLogEvents
{
get
{
if (_beginDate == null || _endDate == null)
return _logEvents;
else
return (from l in _logEvents where l.Date >= _beginDate && l.Date <= _endDate select l).ToList();
}
}
public string TabHeader { get { return "Лог событий"; } }
public LogPresenter(ApplicationPresen
: base(view, "TabHeader")
{
_logEvents = log;
SetPeriod(DateTime.Now.
}
public override bool Equals(object obj)
{
if ((obj as LogPresenter)!=null)
Информация о работе Разработка системы рассылки СМС сообщений